deal with Android's nonstandard shell location
This is so gratutious and pointless. It's a shame that everything we learned about Unix portability and the importance of standards has been thrown out the window by these guys.
This commit is contained in:
parent
8c66801c78
commit
f40180f033
5 changed files with 32 additions and 7 deletions
|
@ -14,6 +14,7 @@ import Assistant.Install.AutoStart
|
||||||
import Assistant.Ssh
|
import Assistant.Ssh
|
||||||
import Locations.UserConfig
|
import Locations.UserConfig
|
||||||
import Utility.FileMode
|
import Utility.FileMode
|
||||||
|
import Utility.Shell
|
||||||
|
|
||||||
#ifdef darwin_HOST_OS
|
#ifdef darwin_HOST_OS
|
||||||
import Utility.OSX
|
import Utility.OSX
|
||||||
|
@ -58,7 +59,7 @@ ensureInstalled = go =<< standaloneAppBase
|
||||||
sshdir <- sshDir
|
sshdir <- sshDir
|
||||||
let shim = sshdir </> "git-annex-shell"
|
let shim = sshdir </> "git-annex-shell"
|
||||||
let content = unlines
|
let content = unlines
|
||||||
[ "#!/bin/sh"
|
[ shebang
|
||||||
, "set -e"
|
, "set -e"
|
||||||
, "exec", base </> "runshell" ++
|
, "exec", base </> "runshell" ++
|
||||||
" git-annex-shell -c \"$SSH_ORIGINAL_COMMAND\""
|
" git-annex-shell -c \"$SSH_ORIGINAL_COMMAND\""
|
||||||
|
|
|
@ -10,6 +10,7 @@ module Assistant.Ssh where
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
import Utility.TempFile
|
import Utility.TempFile
|
||||||
import Utility.UserInfo
|
import Utility.UserInfo
|
||||||
|
import Utility.Shell
|
||||||
import Git.Remote
|
import Git.Remote
|
||||||
|
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
|
@ -155,7 +156,7 @@ addAuthorizedKeysCommand rsynconly dir pubkey = join "&&"
|
||||||
echoval v = "echo " ++ shellEscape v
|
echoval v = "echo " ++ shellEscape v
|
||||||
wrapper = "~/.ssh/git-annex-shell"
|
wrapper = "~/.ssh/git-annex-shell"
|
||||||
script =
|
script =
|
||||||
[ "#!/bin/sh"
|
[ shebang
|
||||||
, "set -e"
|
, "set -e"
|
||||||
, "exec git-annex-shell -c \"$SSH_ORIGINAL_COMMAND\""
|
, "exec git-annex-shell -c \"$SSH_ORIGINAL_COMMAND\""
|
||||||
]
|
]
|
||||||
|
|
|
@ -25,6 +25,7 @@ import qualified Git.Branch
|
||||||
import Locations.UserConfig
|
import Locations.UserConfig
|
||||||
import qualified Types.Remote as Remote
|
import qualified Types.Remote as Remote
|
||||||
import Utility.FileMode
|
import Utility.FileMode
|
||||||
|
import Utility.Shell
|
||||||
|
|
||||||
import Network.Protocol.XMPP
|
import Network.Protocol.XMPP
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
@ -141,7 +142,7 @@ xmppPush cid gitpush = runPush SendPack cid handleDeferred $ do
|
||||||
let wrapper = tmpdir </> "git-remote-xmpp"
|
let wrapper = tmpdir </> "git-remote-xmpp"
|
||||||
program <- readProgramFile
|
program <- readProgramFile
|
||||||
writeFile wrapper $ unlines
|
writeFile wrapper $ unlines
|
||||||
[ "#!/bin/sh"
|
[ shebang
|
||||||
, "exec " ++ program ++ " xmppgit"
|
, "exec " ++ program ++ " xmppgit"
|
||||||
]
|
]
|
||||||
modifyFileMode wrapper $ addModes executeModes
|
modifyFileMode wrapper $ addModes executeModes
|
||||||
|
|
10
Init.hs
10
Init.hs
|
@ -21,6 +21,7 @@ import Logs.UUID
|
||||||
import Annex.Version
|
import Annex.Version
|
||||||
import Annex.UUID
|
import Annex.UUID
|
||||||
import Utility.UserInfo
|
import Utility.UserInfo
|
||||||
|
import Utility.Shell
|
||||||
|
|
||||||
genDescription :: Maybe String -> Annex String
|
genDescription :: Maybe String -> Annex String
|
||||||
genDescription (Just d) = return d
|
genDescription (Just d) = return d
|
||||||
|
@ -92,7 +93,8 @@ preCommitHook :: Annex FilePath
|
||||||
preCommitHook = (</>) <$> fromRepo Git.localGitDir <*> pure "hooks/pre-commit"
|
preCommitHook = (</>) <$> fromRepo Git.localGitDir <*> pure "hooks/pre-commit"
|
||||||
|
|
||||||
preCommitScript :: String
|
preCommitScript :: String
|
||||||
preCommitScript =
|
preCommitScript = unlines
|
||||||
"#!/bin/sh\n" ++
|
[ shebang
|
||||||
"# automatically configured by git-annex\n" ++
|
, "# automatically configured by git-annex"
|
||||||
"git annex pre-commit .\n"
|
, "git annex pre-commit ."
|
||||||
|
]
|
||||||
|
|
20
Utility/Shell.hs
Normal file
20
Utility/Shell.hs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{- /bin/sh handling
|
||||||
|
-
|
||||||
|
- Copyright 2013 Joey Hess <joey@kitenet.net>
|
||||||
|
-
|
||||||
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
|
-}
|
||||||
|
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
|
module Utility.Shell where
|
||||||
|
|
||||||
|
shellPath :: FilePath
|
||||||
|
#ifndef WITH_ANDROID
|
||||||
|
shellPath = "/bin/sh"
|
||||||
|
#else
|
||||||
|
shellPath = "/system/bin/sh"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
shebang :: String
|
||||||
|
shebang = "#!" ++ shellPath
|
Loading…
Reference in a new issue