[READ-ONLY] Mirror of https://github.com/probablykasper/my-bash-scripts. My personal bash scripts
cli
0

Configure Feed

Select the types of activity you want to include in your feed.

backup: Add --run-restic

Kasper (Dec 28, 2025, 9:44 AM +0100) 2761f825 a8f85c13

+15 -3
+15 -3
bin/backup
··· 5 5 echo "" 6 6 echo "To save your password, run:" 7 7 echo " security add-generic-password -T '$(realpath "$0")' -s Restic -a <RESTIC_REPOSITORY> -w" 8 + echo "" 9 + echo "To run a restic command:" 10 + echo " $(basename "$0") <restic_repository> --run-restic" 11 + } 12 + 13 + get_pw() { 14 + security find-generic-password -w -s 'Restic' -a "$REPO" 8 15 } 9 16 10 17 REPO="$1" 11 - MODE="${2:-fast}" 18 + MODE="$2" 12 19 13 20 if [ "$REPO" = "" ]; then 14 21 help ··· 19 26 CHUNK_SIZE="8M" 20 27 elif [ "$MODE" = "slow" ]; then 21 28 CHUNK_SIZE="256K" 29 + elif [ "$MODE" = "--run-restic" ]; then 30 + shift 2 31 + RESTIC_ARGS=("$@") 32 + RESTIC_REPOSITORY="$REPO" RESTIC_PASSWORD="$(get_pw)" restic "$@" 33 + exit 0 22 34 else 23 35 help 24 36 exit 0 25 37 fi 26 38 echo "Running in ${MODE} mode (chunk size: $CHUNK_SIZE)" 27 39 28 - PW=$(security find-generic-password -w -s 'Restic' -a "$REPO") 40 + PW="$(get_pw)" 29 41 30 42 copy_if_different() { 31 43 if ! cmp -s "$1" "$2"; then ··· 37 49 38 50 # RCLONE_BWLIMIT=100M \ 39 51 ( 40 - RESTIC_REPOSITORY="$REPO" 52 + RESTIC_REPOSITORY="$REPO" \ 41 53 RESTIC_PASSWORD="$PW" \ 42 54 GOMAXPROCS=5 \ 43 55 RESTIC_PROGRESS_FPS=1 \