if ~/.ssh does not exist and cannot be created, avoid failing

This commit is contained in:
Joey Hess 2015-04-20 13:15:01 -04:00
parent 10afac3fba
commit 911335247c
2 changed files with 24 additions and 20 deletions

View file

@ -31,16 +31,18 @@ cd "$orig"
# assistant. # assistant.
if [ ! -e "$HOME/.ssh/git-annex-shell" ]; then if [ ! -e "$HOME/.ssh/git-annex-shell" ]; then
mkdir "$HOME/.ssh" >/dev/null 2>&1 || true mkdir "$HOME/.ssh" >/dev/null 2>&1 || true
( if [ -e "$HOME/.ssh" ]; then
echo "#!/bin/sh" (
echo "set -e" echo "#!/bin/sh"
echo "if [ \"x\$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then" echo "set -e"
echo "exec $base/runshell git-annex-shell -c \"\$SSH_ORIGINAL_COMMAND\"" echo "if [ \"x\$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then"
echo "else" echo "exec $base/runshell git-annex-shell -c \"\$SSH_ORIGINAL_COMMAND\""
echo "exec $base/runshell git-annex-shell -c \"\$@\"" echo "else"
echo "fi" echo "exec $base/runshell git-annex-shell -c \"\$@\""
) > "$HOME/.ssh/git-annex-shell" echo "fi"
chmod +x "$HOME/.ssh/git-annex-shell" ) > "$HOME/.ssh/git-annex-shell"
chmod +x "$HOME/.ssh/git-annex-shell"
fi
fi fi
# And this shim is used by the webapp when adding a remote ssh server. # And this shim is used by the webapp when adding a remote ssh server.

View file

@ -33,16 +33,18 @@ cd "$orig"
# assistant. # assistant.
if [ ! -e "$HOME/.ssh/git-annex-shell" ]; then if [ ! -e "$HOME/.ssh/git-annex-shell" ]; then
mkdir "$HOME/.ssh" >/dev/null 2>&1 || true mkdir "$HOME/.ssh" >/dev/null 2>&1 || true
( if [ -e "$HOME/.ssh" ]; then
echo "#!/bin/sh" (
echo "set -e" echo "#!/bin/sh"
echo "if [ \"x\$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then" echo "set -e"
echo "exec $base/runshell git-annex-shell -c \"\$SSH_ORIGINAL_COMMAND\"" echo "if [ \"x\$SSH_ORIGINAL_COMMAND\" != \"x\" ]; then"
echo "else" echo "exec $base/runshell git-annex-shell -c \"\$SSH_ORIGINAL_COMMAND\""
echo "exec $base/runshell git-annex-shell -c \"\$@\"" echo "else"
echo "fi" echo "exec $base/runshell git-annex-shell -c \"\$@\""
) > "$HOME/.ssh/git-annex-shell" echo "fi"
chmod +x "$HOME/.ssh/git-annex-shell" ) > "$HOME/.ssh/git-annex-shell"
chmod +x "$HOME/.ssh/git-annex-shell"
fi
fi fi
# And this shim is used by the webapp when adding a remote ssh server. # And this shim is used by the webapp when adding a remote ssh server.