bin: script adjustments

This commit is contained in:
xeruf 2023-12-01 17:17:35 +01:00
parent 4f82c00060
commit 4be82b0adb
3 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh -e
# Backup linux system and user files with borg # Backup linux system and user files with borg
# Usage: bag [-n] [--dry-run] [--home] [--root MOUNTED_ROOT] # Usage: bag [-n] [--dry-run] [--home] [--root MOUNTED_ROOT]
root="/" root="/"
@ -8,8 +8,8 @@ while test $# -gt 0; do
(-n) run="arg-test"; shift;; (-n) run="arg-test"; shift;;
(--dry-run) args="--dry-run --list"; name=test-$(date +%s); shift;; (--dry-run) args="--dry-run --list"; name=test-$(date +%s); shift;;
(--root) shift; root="$1"; name="$(basename "$(realpath "$root")")"; echo $root $name; shift;; (--root) shift; root="$1"; name="$(basename "$(realpath "$root")")"; echo $root $name; shift;;
(--home) "$0" home /home -e "sh:$HOME/data/4-*" -e "sh:$HOME/data/5-*" -e "sh:**/.stfolder" -e "sh:**/0-forks" -e "sh:**/.git" (--home) "$0" home /home -e "sh:$HOME/.local/state" -e "sh:$HOME/data/4-*" -e "sh:$HOME/data/5-*" -e "sh:**/.stfolder" -e "sh:**/0-forks" -e "sh:**/.git"
return $?;; exit $?;;
(-*) name="${1#-}"; shift;; (-*) name="${1#-}"; shift;;
(*) break;; (*) break;;
esac esac
@ -17,6 +17,7 @@ done
test $# -gt 0 || cd "$root" test $# -gt 0 || cd "$root"
name="::$(test -n "$name" && echo "$name" || cat /etc/hostname)_${1:-system}_$(date -u +"%y%m%d")" name="::$(test -n "$name" && echo "$name" || cat /etc/hostname)_${1:-system}_$(date -u +"%y%m%d")"
echo "Backing up as $name" echo "Backing up as $name"
# TODO ignore electron caches
${run:-sudo --preserve-env=BORG_REPO BORG_PASSPHRASE="$($BORG_PASSCOMMAND)" borg} create --exclude-caches $args \ ${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 -x $HOME/.gem | $(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') \ sed 's|-x \([^ ]\+\)|-e sh:**/\1|g') \

5
.local/bin/scripts/flash Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
lsblk $2
echo -n "Flash $1?"
read
sudo dd if=$1 of=$2 status=progress bs=1M

View File

@ -3,6 +3,7 @@ light -S .01
pkill --echo electron pkill --echo electron
pkill --echo --ignore-case discord pkill --echo --ignore-case discord
pkill --echo signal pkill --echo signal
pkill --echo telegram
pkill --echo aw-server pkill --echo aw-server
pkill --echo aw-qt pkill --echo aw-qt
systemctl stop --user syncthing plasma-baloorunner kde-baloo systemctl stop --user syncthing plasma-baloorunner kde-baloo