From 3e49f9fcab9a62a76ec63b06c3987adba838d174 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 10 Nov 2015 11:42:06 -0400 Subject: [PATCH] runshell: Avoid failing when $HOME/.ssh does not exist and cannot be created. --- debian/changelog | 2 ++ standalone/linux/skel/runshell | 14 ++++++++------ .../osx/git-annex.app/Contents/MacOS/runshell | 14 ++++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/debian/changelog b/debian/changelog index d45a9d269a..18a8556618 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,8 @@ git-annex (5.20151102.2) UNRELEASED; urgency=medium recover. * quvi may output utf-8 encoded data when the conifigured locale doesn't support that; avoid crashing on such invalid encoding. + * runshell: Avoid failing when $HOME/.ssh does not exist and cannot be + created. -- Joey Hess Wed, 04 Nov 2015 12:50:20 -0400 diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index b540c983b5..68a462266b 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -64,12 +64,14 @@ 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" + if [ -e "$HOME/.ssh" ]; then + ( + echo "#!/bin/sh" + echo "set -e" + echo "exec '$base/runshell' \"\$@\"" + ) > "$HOME/.ssh/git-annex-wrapper" + chmod +x "$HOME/.ssh/git-annex-wrapper" + fi fi # Put our binaries first, to avoid issues with out of date or incompatable diff --git a/standalone/osx/git-annex.app/Contents/MacOS/runshell b/standalone/osx/git-annex.app/Contents/MacOS/runshell index 0af0a0c6f3..b48017f432 100755 --- a/standalone/osx/git-annex.app/Contents/MacOS/runshell +++ b/standalone/osx/git-annex.app/Contents/MacOS/runshell @@ -50,12 +50,14 @@ 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" + if [ -e "$HOME/.ssh" ]; then + ( + echo "#!/bin/sh" + echo "set -e" + echo "exec '$base/runshell' \"\$@\"" + ) > "$HOME/.ssh/git-annex-wrapper" + chmod +x "$HOME/.ssh/git-annex-wrapper" + fi fi # Put our binaries first, to avoid issues with out of date or incompatable