summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-20 18:38:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-20 18:39:10 -0400
commit4509637a6af277606332274a1e8cfc93f7fec628 (patch)
tree324fcdbe2930eab14c528a9361074af7632f3dfa
parentd966ae01814e1f818ddf8afd58dd8ef9c7668b51 (diff)
webapp: Support using git-annex on a remote server, which was installed from the standalone tarball or OSX app, and so does not have git-annex in PATH (and may also not have git or rsync in PATH).
* webapp: Support using git-annex on a remote server, which was installed from the standalone tarball or OSX app, and so does not have git-annex in PATH (and may also not have git or rsync in PATH). * standalone tarball, OSX app: Install a ~/.ssh/git-annex-wrapper, which can be used to run git-annex, git, rsync, etc.
-rw-r--r--Assistant/Install.hs37
-rw-r--r--debian/changelog5
-rwxr-xr-xstandalone/linux/skel/runshell15
-rwxr-xr-xstandalone/osx/git-annex.app/Contents/MacOS/runshell15
4 files changed, 56 insertions, 16 deletions
diff --git a/Assistant/Install.hs b/Assistant/Install.hs
index 883ca484c..afbe5b9c0 100644
--- a/Assistant/Install.hs
+++ b/Assistant/Install.hs
@@ -30,8 +30,8 @@ standaloneAppBase = getEnv "GIT_ANNEX_APP_BASE"
{- The standalone app does not have an installation process.
- So when it's run, it needs to set up autostarting of the assistant
- - daemon, as well as writing the programFile, and putting a
- - git-annex-shell wrapper into ~/.ssh
+ - daemon, as well as writing the programFile, and putting the
+ - git-annex-shell and git-annex-wrapper wrapper scripts into ~/.ssh
-
- Note that this is done every time it's started, so if the user moves
- it around, the paths this sets up won't break.
@@ -59,30 +59,35 @@ ensureInstalled = go =<< standaloneAppBase
#endif
installAutoStart program autostartfile
- {- This shim is only updated if it doesn't
- - already exist with the right content. -}
sshdir <- sshDir
- let shim = sshdir </> "git-annex-shell"
- let runshell var = "exec " ++ base </> "runshell" ++
- " git-annex-shell -c \"" ++ var ++ "\""
- let content = unlines
+ let runshell var = "exec " ++ base </> "runshell " ++ var
+ let rungitannexshell var = runshell $ "git-annex-shell -c \"" ++ var ++ "\""
+
+ installWrapper (sshdir </> "git-annex-shell") $ unlines
[ shebang_local
, "set -e"
, "if [ \"x$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then"
- , runshell "$SSH_ORIGINAL_COMMAND"
+ , rungitannexshell "$SSH_ORIGINAL_COMMAND"
, "else"
- , runshell "$@"
+ , rungitannexshell "$@"
, "fi"
]
-
- curr <- catchDefaultIO "" $ readFileStrict shim
- when (curr /= content) $ do
- createDirectoryIfMissing True (parentDir shim)
- viaTmp writeFile shim content
- modifyFileMode shim $ addModes [ownerExecuteMode]
+ installWrapper (sshdir </> "git-annex-wrapper") $ unlines
+ [ shebang_local
+ , "set -e"
+ , runshell "\"$@\""
+ ]
installNautilus program
+installWrapper :: FilePath -> String -> IO ()
+installWrapper file content = do
+ curr <- catchDefaultIO "" $ readFileStrict file
+ when (curr /= content) $ do
+ createDirectoryIfMissing True (parentDir file)
+ viaTmp writeFile file content
+ modifyFileMode file $ addModes [ownerExecuteMode]
+
installNautilus :: FilePath -> IO ()
#ifdef linux_HOST_OS
installNautilus program = do
diff --git a/debian/changelog b/debian/changelog
index 1650a07ed..0d19407ad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,11 @@ git-annex (5.20140413) UNRELEASED; urgency=medium
* webapp: Fix UI for removing XMPP connection.
* When init detects that git is not configured to commit, and sets
user.email to work around the problem, also make it set user.name.
+ * webapp: Support using git-annex on a remote server, which was installed
+ from the standalone tarball or OSX app, and so does not have
+ git-annex in PATH (and may also not have git or rsync in PATH).
+ * standalone tarball, OSX app: Install a ~/.ssh/git-annex-wrapper, which
+ can be used to run git-annex, git, rsync, etc.
-- Joey Hess <joeyh@debian.org> Fri, 11 Apr 2014 21:33:35 -0400
diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell
index 4481b0d7f..73703358d 100755
--- a/standalone/linux/skel/runshell
+++ b/standalone/linux/skel/runshell
@@ -34,11 +34,26 @@ if [ ! -e "$HOME/.ssh/git-annex-shell" ]; then
(
echo "#!/bin/sh"
echo "set -e"
+ echo "if [ \"x\$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then"
echo "exec $base/runshell git-annex-shell -c \"\$SSH_ORIGINAL_COMMAND\""
+ echo "else"
+ echo "exec $base/runshell git-annex-shell -c \"\$@\""
+ echo "fi"
) > "$HOME/.ssh/git-annex-shell"
chmod +x "$HOME/.ssh/git-annex-shell"
fi
+# And this shim is used by the webapp when adding a remote ssh server.
+if [ ! -e "$HOME/.ssh/git-annex-wrapper" ]; then
+ mkdir "$HOME/.ssh" >/dev/null 2>&1 || true
+ (
+ echo "#!/bin/sh"
+ echo "set -e"
+ echo "exec $base/runshell \"\$@\""
+ ) > "$HOME/.ssh/git-annex-wrapper"
+ chmod +x "$HOME/.ssh/git-annex-wrapper"
+fi
+
# Put our binaries first, to avoid issues with out of date or incompatable
# system binaries.
ORIG_PATH="$PATH"
diff --git a/standalone/osx/git-annex.app/Contents/MacOS/runshell b/standalone/osx/git-annex.app/Contents/MacOS/runshell
index 9f1457e25..c5d689c6e 100755
--- a/standalone/osx/git-annex.app/Contents/MacOS/runshell
+++ b/standalone/osx/git-annex.app/Contents/MacOS/runshell
@@ -36,11 +36,26 @@ if [ ! -e "$HOME/.ssh/git-annex-shell" ]; then
(
echo "#!/bin/sh"
echo "set -e"
+ echo "if [ \"x\$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then"
echo "exec $base/runshell git-annex-shell -c \"\$SSH_ORIGINAL_COMMAND\""
+ echo "else"
+ echo "exec $base/runshell git-annex-shell -c \"\$@\""
+ echo "fi"
) > "$HOME/.ssh/git-annex-shell"
chmod +x "$HOME/.ssh/git-annex-shell"
fi
+# And this shim is used by the webapp when adding a remote ssh server.
+if [ ! -e "$HOME/.ssh/git-annex-wrapper" ]; then
+ mkdir "$HOME/.ssh" >/dev/null 2>&1 || true
+ (
+ echo "#!/bin/sh"
+ echo "set -e"
+ echo "exec $base/runshell \"\$@\""
+ ) > "$HOME/.ssh/git-annex-wrapper"
+ chmod +x "$HOME/.ssh/git-annex-wrapper"
+fi
+
# Put our binaries first, to avoid issues with out of date or incompatable
# system binaries.
ORIG_PATH="$PATH"