bin: fix mouling

This commit is contained in:
xeruf 2022-12-22 15:40:56 +01:00
parent 655bd6bdc7
commit b3989a1969
2 changed files with 5 additions and 4 deletions

View File

@ -15,7 +15,7 @@ test $# -gt 0 || cd "$root"
name="::$(test -n "$name" && echo "$name" || cat /etc/hostname)_${1:-system}_$(date -u +"%y%m%d")"
echo "Backing up as $name"
${run:-sudo --preserve-env=BORG_REPO BORG_PASSPHRASE="$($BORG_PASSCOMMAND)" borg} create --exclude-caches $args \
$(echo $DIRS_IGNORE_SAFE -x 'software-challenge/**/build' -x state/emacs -x state/go -x .local/lib -x .cpan -x *cache |
$(echo $DIRS_IGNORE_SAFE -x 'software-challenge/**/build' -x state/emacs -x state/go -x .local/lib -x .cpan -x *cache -x $HOME/.gem |
sed 's|-x \([^ ]\+\)|-e sh:**/\1|g') \
"$name" $(test $# -eq 0 && echo etc home root || test $# -eq 1 && echo $1) "${@:2}" 2>&1
test -n "$run" || sudo chown -R $USER:$USER "$BORG_REPO"

View File

@ -16,18 +16,19 @@ case $1 in
code=$?
sudo rm -df "$last"
exit $code;;
(*) arg=$1;;
(*) arg=$1
shift;;
esac
# FSTAB: BY LABEL
if grep --word-regexp "LABEL=$arg" /etc/fstab
then # have to mount twice as the first one might be creating the directory
mount -L "$@" 2>/dev/null || mount -L "$@"
mount -L "$arg" "$@" 2>/dev/null || mount -L "$arg" "$@"
exit $?
fi
# FSTAB: BY MOUNTPOINT/NAME
if grep --word-regexp "$arg" /etc/fstab
then mount "$@"; exit $?
then mount "$arg" "$@"; exit $?
fi
# MANUALLY