store probed androidserial for later use by enableremote
This commit is contained in:
parent
bc90c71b54
commit
ceee0ea5f1
1 changed files with 9 additions and 7 deletions
|
@ -98,28 +98,30 @@ adbSetup _ mu _ c gc = do
|
||||||
adir <- maybe (giveup "Specify androiddirectory=") (pure . AndroidPath)
|
adir <- maybe (giveup "Specify androiddirectory=") (pure . AndroidPath)
|
||||||
(M.lookup "androiddirectory" c)
|
(M.lookup "androiddirectory" c)
|
||||||
serial <- getserial =<< liftIO enumerateAdbConnected
|
serial <- getserial =<< liftIO enumerateAdbConnected
|
||||||
|
let c' = M.insert "androidserial" (fromAndroidSerial serial) c
|
||||||
|
|
||||||
(c', _encsetup) <- encryptionSetup c gc
|
(c'', _encsetup) <- encryptionSetup c' gc
|
||||||
|
|
||||||
ok <- liftIO $ adbShellBool serial
|
ok <- liftIO $ adbShellBool serial
|
||||||
[Param "mkdir", Param "-p", File (fromAndroidPath adir)]
|
[Param "mkdir", Param "-p", File (fromAndroidPath adir)]
|
||||||
unless ok $
|
unless ok $
|
||||||
giveup "Creating directory on Android device failed."
|
giveup "Creating directory on Android device failed."
|
||||||
|
|
||||||
gitConfigSpecialRemote u c'
|
gitConfigSpecialRemote u c''
|
||||||
[ ("adb", "true")
|
[ ("adb", "true")
|
||||||
, ("androiddirectory", fromAndroidPath adir)
|
, ("androiddirectory", fromAndroidPath adir)
|
||||||
, ("androidserial", fromAndroidSerial serial)
|
, ("androidserial", fromAndroidSerial serial)
|
||||||
]
|
]
|
||||||
|
|
||||||
return (c', u)
|
return (c'', u)
|
||||||
where
|
where
|
||||||
getserial [] = giveup "adb does not list any connected android devices. Plug in an Android device, or configure adb, and try again.."
|
getserial [] = giveup "adb does not list any connected android devices. Plug in an Android device, or configure adb, and try again.."
|
||||||
getserial (s:[]) = return s
|
|
||||||
getserial l = case M.lookup "androidserial" c of
|
getserial l = case M.lookup "androidserial" c of
|
||||||
Nothing -> giveup $ unlines $
|
Nothing -> case l of
|
||||||
"There are multiple connected android devices, specify which to use with androidserial="
|
(s:[]) -> return s
|
||||||
: map fromAndroidSerial l
|
_ -> giveup $ unlines $
|
||||||
|
"There are multiple connected android devices, specify which to use with androidserial="
|
||||||
|
: map fromAndroidSerial l
|
||||||
Just cs
|
Just cs
|
||||||
| AndroidSerial cs `elem` l -> return (AndroidSerial cs)
|
| AndroidSerial cs `elem` l -> return (AndroidSerial cs)
|
||||||
| otherwise -> giveup $ "The device with androidserial=" ++ cs ++ " is not connected."
|
| otherwise -> giveup $ "The device with androidserial=" ++ cs ++ " is not connected."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue