From ae8912003022be1a8cd77684824a89460c7ff646 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 6 May 2013 15:58:13 -0400 Subject: fix use of wrong shebang when android is installing git-annex-shell wrapper on server --- Assistant/Install.hs | 2 +- Assistant/Ssh.hs | 2 +- Assistant/XMPP/Git.hs | 2 +- Init.hs | 2 +- Utility/Shell.hs | 16 +++++++++++----- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Assistant/Install.hs b/Assistant/Install.hs index ac1af0135..278190b35 100644 --- a/Assistant/Install.hs +++ b/Assistant/Install.hs @@ -63,7 +63,7 @@ ensureInstalled = go =<< standaloneAppBase let runshell var = "exec " ++ base "runshell" ++ " git-annex-shell -c \"" ++ var ++ "\"" let content = unlines - [ shebang + [ shebang_local , "set -e" , "if [ \"x$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then" , runshell "$SSH_ORIGINAL_COMMAND" diff --git a/Assistant/Ssh.hs b/Assistant/Ssh.hs index c7543d3bd..0c718d019 100644 --- a/Assistant/Ssh.hs +++ b/Assistant/Ssh.hs @@ -125,7 +125,7 @@ addAuthorizedKeysCommand rsynconly dir pubkey = intercalate "&&" echoval v = "echo " ++ shellEscape v wrapper = "~/.ssh/git-annex-shell" script = - [ shebang + [ shebang_portable , "set -e" , "if [ \"x$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then" , runshell "$SSH_ORIGINAL_COMMAND" diff --git a/Assistant/XMPP/Git.hs b/Assistant/XMPP/Git.hs index c1605bee2..6a50e13f6 100644 --- a/Assistant/XMPP/Git.hs +++ b/Assistant/XMPP/Git.hs @@ -156,7 +156,7 @@ xmppPush cid gitpush handledeferred = runPush SendPack cid handledeferred $ do let wrapper = tmpdir "git-remote-xmpp" program <- readProgramFile writeFile wrapper $ unlines - [ shebang + [ shebang_local , "exec " ++ program ++ " xmppgit" ] modifyFileMode wrapper $ addModes executeModes diff --git a/Init.hs b/Init.hs index 62b12283f..4d27c4f1c 100644 --- a/Init.hs +++ b/Init.hs @@ -106,7 +106,7 @@ preCommitHook = () <$> fromRepo Git.localGitDir <*> pure "hooks/pre-commit" preCommitScript :: String preCommitScript = unlines - [ shebang + [ shebang_local , "# automatically configured by git-annex" , "git annex pre-commit ." ] diff --git a/Utility/Shell.hs b/Utility/Shell.hs index f3858af7f..2227dc767 100644 --- a/Utility/Shell.hs +++ b/Utility/Shell.hs @@ -9,12 +9,18 @@ module Utility.Shell where -shellPath :: FilePath +shellPath_portable :: FilePath +shellPath_portable = "/bin/sh" + +shellPath_local :: FilePath #ifndef __ANDROID__ -shellPath = "/bin/sh" +shellPath_local = shellPath_portable #else -shellPath = "/system/bin/sh" +shellPath_local = "/system/bin/sh" #endif -shebang :: String -shebang = "#!" ++ shellPath +shebang_portable :: String +shebang_portable = "#!" ++ shellPath_portable + +shebang_local :: String +shebang_local = "#!" ++ shellPath_local -- cgit v1.2.3