runshell: Update files atomically when preparing to run git-annex
This does not make it entirely idempotent, but it's a start.
This commit is contained in:
parent
b91d97c3d2
commit
e0ca1236ee
3 changed files with 21 additions and 10 deletions
|
@ -42,6 +42,7 @@ git-annex (8.20200909) UNRELEASED; urgency=medium
|
||||||
off when the criterion library is not installed.
|
off when the criterion library is not installed.
|
||||||
* runshell: Fix a edge case where rm errors were sent to stdout, which
|
* runshell: Fix a edge case where rm errors were sent to stdout, which
|
||||||
could confuse things parsing git-annex output.
|
could confuse things parsing git-annex output.
|
||||||
|
* runshell: Update files atomically when preparing to run git-annex.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 14 Sep 2020 18:34:37 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 14 Sep 2020 18:34:37 -0400
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,9 @@ if [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then
|
||||||
echo "else"
|
echo "else"
|
||||||
echo "exec '$base/runshell' git-annex-shell -c \"\$@\""
|
echo "exec '$base/runshell' git-annex-shell -c \"\$@\""
|
||||||
echo "fi"
|
echo "fi"
|
||||||
) > "$HOME/.ssh/git-annex-shell"
|
) > "$HOME/.ssh/git-annex-shell.$$"
|
||||||
chmod +x "$HOME/.ssh/git-annex-shell"
|
chmod +x "$HOME/.ssh/git-annex-shell.$$"
|
||||||
|
mv -f "$HOME/.ssh/git-annex-shell.$$" "$HOME/.ssh/git-annex-shell"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -77,8 +78,9 @@ if [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then
|
||||||
echo "#!/bin/sh"
|
echo "#!/bin/sh"
|
||||||
echo "set -e"
|
echo "set -e"
|
||||||
echo "exec '$base/runshell' \"\$@\""
|
echo "exec '$base/runshell' \"\$@\""
|
||||||
) > "$HOME/.ssh/git-annex-wrapper"
|
) > "$HOME/.ssh/git-annex-wrapper.$$"
|
||||||
chmod +x "$HOME/.ssh/git-annex-wrapper"
|
chmod +x "$HOME/.ssh/git-annex-wrapper.$$"
|
||||||
|
mv -f "$HOME/.ssh/git-annex-wrapper.$$" "$HOME/.ssh/git-annex-wrapper"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -155,10 +157,16 @@ if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then
|
||||||
echo "Unable to write to $LOCPATH; can't continue!" >&2
|
echo "Unable to write to $LOCPATH; can't continue!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "$base" > "$LOCPATH/base"
|
# This is updated each time, because the bundle could be moved to a
|
||||||
|
# different directory.
|
||||||
|
echo "$base" > "$LOCPATH/base.$$"
|
||||||
|
mv -f "$LOCPATH/base.$$" "$LOCPATH/base"
|
||||||
|
# This is updated each time, because the bundle could be updated
|
||||||
|
# in place to a new version.
|
||||||
# Not using cp to avoid using the one bundled with git-annex before
|
# Not using cp to avoid using the one bundled with git-annex before
|
||||||
# the environment is set up to run it.
|
# the environment is set up to run it.
|
||||||
cat < "$base/buildid" > "$LOCPATH/buildid"
|
cat < "$base/buildid" > "$LOCPATH/buildid.$$"
|
||||||
|
mv -f "$LOCPATH/buildid.$$" "$LOCPATH/buildid"
|
||||||
|
|
||||||
# Generate locale definition files for the locales in use,
|
# Generate locale definition files for the locales in use,
|
||||||
# using the localedef and locale files from the bundle.
|
# using the localedef and locale files from the bundle.
|
||||||
|
|
|
@ -45,8 +45,9 @@ if [ ! -e "$HOME/.ssh/git-annex-shell" ]; then
|
||||||
echo "else"
|
echo "else"
|
||||||
echo "exec '$base/runshell' git-annex-shell -c \"\$@\""
|
echo "exec '$base/runshell' git-annex-shell -c \"\$@\""
|
||||||
echo "fi"
|
echo "fi"
|
||||||
) > "$HOME/.ssh/git-annex-shell"
|
) > "$HOME/.ssh/git-annex-shell.$$"
|
||||||
chmod +x "$HOME/.ssh/git-annex-shell"
|
chmod +x "$HOME/.ssh/git-annex-shell.$$"
|
||||||
|
mv "$HOME/.ssh/git-annex-shell.$$" "$HOME/.ssh/git-annex-shell"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -58,8 +59,9 @@ if [ ! -e "$HOME/.ssh/git-annex-wrapper" ]; then
|
||||||
echo "#!/bin/sh"
|
echo "#!/bin/sh"
|
||||||
echo "set -e"
|
echo "set -e"
|
||||||
echo "exec '$base/runshell' \"\$@\""
|
echo "exec '$base/runshell' \"\$@\""
|
||||||
) > "$HOME/.ssh/git-annex-wrapper"
|
) > "$HOME/.ssh/git-annex-wrapper.$$"
|
||||||
chmod +x "$HOME/.ssh/git-annex-wrapper"
|
chmod +x "$HOME/.ssh/git-annex-wrapper.$$"
|
||||||
|
mv "$HOME/.ssh/git-annex-wrapper.$$" "$HOME/.ssh/git-annex-wrapper"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue