chamesle-snapshot.pre-commit (576B)
1 #!/bin/sh 2 # a snapshot before every update (apk upgrade, the updater and the store), so a bad one can be undone from the 3 # boot menu. installing or removing an app doesn't take one, and neither does an upgrade with nothing to do. 4 # a pre-commit hook that fails stops the update, so this one never does 5 [ "$1" = pre-commit ] || exit 0 6 tr '\0' ' ' < /proc/$PPID/cmdline 2>/dev/null | grep -qw upgrade || exit 0 7 [ -n "$(apk list --upgradable 2>/dev/null)" ] || exit 0 8 /usr/bin/chamesle-snapshot take || echo "chamesle-snapshot: no snapshot this time, updating anyway" >&2 9 exit 0