create simple way to add more configurations to take snapshots of
This commit is contained in:
parent
3244efa1f9
commit
6bae9c0044
2 changed files with 22 additions and 8 deletions
17
snapper-post
17
snapper-post
|
|
@ -20,12 +20,19 @@
|
||||||
|
|
||||||
# Takes a snapper post snapshot after a pacman transaction
|
# Takes a snapper post snapshot after a pacman transaction
|
||||||
|
|
||||||
|
# Change this variable to include other configs in the post snapshot
|
||||||
|
# You must also change it in the pre snapshot script
|
||||||
|
CONFIGS="root"
|
||||||
|
#CONFIGS="root home"
|
||||||
|
|
||||||
PACMAN_CMD=$(ps -C pacman -o args=)
|
PACMAN_CMD=$(ps -C pacman -o args=)
|
||||||
PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre
|
PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre
|
||||||
if [ -f $PREFILE ]; then
|
for x in $CONFIGS; do
|
||||||
SNAPPERPACPRE=$(cat $PREFILE)
|
if [ -f $PREFILE"_"$x ]; then
|
||||||
snapper --config root create --cleanup-algorithm number --type post --pre-number $SNAPPERPACPRE --description "$PACMAN_CMD"
|
SNAPPERPACPRE=$(cat $PREFILE"_"$x)
|
||||||
rm $PREFILE
|
snapper --config $x create --cleanup-algorithm number --type post --pre-number $SNAPPERPACPRE --description "$PACMAN_CMD"
|
||||||
|
rm $PREFILE"_"$x
|
||||||
else
|
else
|
||||||
echo "WARNING: $PREFILE does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal."
|
echo "WARNING: $PREFILE"_"$x does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal."
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,13 @@
|
||||||
|
|
||||||
# Takes a snapper pre snapshot before a pacman transaction
|
# Takes a snapper pre snapshot before a pacman transaction
|
||||||
|
|
||||||
|
# Change this variable to include other configs in the pre snapshot
|
||||||
|
# You must also change it in the post snapshot script
|
||||||
|
CONFIGS="root"
|
||||||
|
#CONFIGS="root home"
|
||||||
|
|
||||||
PACMAN_CMD=$(ps -C pacman -o args=)
|
PACMAN_CMD=$(ps -C pacman -o args=)
|
||||||
PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre
|
PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre
|
||||||
snapper --config root create --type pre --cleanup-algorithm number --print-number --description "$PACMAN_CMD" > $PREFILE
|
for x in $CONFIGS; do
|
||||||
|
snapper --config $x create --type pre --cleanup-algorithm number --print-number --description "$PACMAN_CMD" > $PREFILE"_"$x
|
||||||
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue