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
21
snapper-post
21
snapper-post
|
|
@ -20,12 +20,19 @@
|
|||
|
||||
# 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=)
|
||||
PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre
|
||||
if [ -f $PREFILE ]; then
|
||||
SNAPPERPACPRE=$(cat $PREFILE)
|
||||
snapper --config root create --cleanup-algorithm number --type post --pre-number $SNAPPERPACPRE --description "$PACMAN_CMD"
|
||||
rm $PREFILE
|
||||
else
|
||||
echo "WARNING: $PREFILE does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal."
|
||||
fi
|
||||
for x in $CONFIGS; do
|
||||
if [ -f $PREFILE"_"$x ]; then
|
||||
SNAPPERPACPRE=$(cat $PREFILE"_"$x)
|
||||
snapper --config $x create --cleanup-algorithm number --type post --pre-number $SNAPPERPACPRE --description "$PACMAN_CMD"
|
||||
rm $PREFILE"_"$x
|
||||
else
|
||||
echo "WARNING: $PREFILE"_"$x does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal."
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@
|
|||
|
||||
# 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=)
|
||||
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