diff --git a/.local/bin/scripts/bag b/.local/bin/scripts/bag index afa792c..a47969a 100755 --- a/.local/bin/scripts/bag +++ b/.local/bin/scripts/bag @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -e # Backup linux system and user files with borg # Usage: bag [-n] [--dry-run] [--home] [--root MOUNTED_ROOT] root="/" @@ -8,8 +8,8 @@ while test $# -gt 0; do (-n) run="arg-test"; shift;; (--dry-run) args="--dry-run --list"; name=test-$(date +%s); 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" - return $?;; + (--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" + exit $?;; (-*) name="${1#-}"; shift;; (*) break;; esac @@ -17,6 +17,7 @@ done 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" +# TODO ignore electron caches ${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 | sed 's|-x \([^ ]\+\)|-e sh:**/\1|g') \ diff --git a/.local/bin/scripts/flash b/.local/bin/scripts/flash new file mode 100755 index 0000000..6098ec5 --- /dev/null +++ b/.local/bin/scripts/flash @@ -0,0 +1,5 @@ +#!/bin/sh +lsblk $2 +echo -n "Flash $1?" +read +sudo dd if=$1 of=$2 status=progress bs=1M diff --git a/.local/bin/scripts/save-power b/.local/bin/scripts/save-power index ebf497f..4534f10 100755 --- a/.local/bin/scripts/save-power +++ b/.local/bin/scripts/save-power @@ -3,6 +3,7 @@ light -S .01 pkill --echo electron pkill --echo --ignore-case discord pkill --echo signal +pkill --echo telegram pkill --echo aw-server pkill --echo aw-qt systemctl stop --user syncthing plasma-baloorunner kde-baloo