create basic configuration file

This commit is contained in:
James Barnett 2016-04-25 11:40:34 -05:00
parent 02a37e8289
commit 976d440616
4 changed files with 11 additions and 19 deletions

View file

@ -32,4 +32,5 @@ install -Dm 755 snap-pac-clean $SCRIPTS_DIR
install -Dm 644 10_snapper-pre.hook $HOOKS_DIR
install -Dm 644 10_snapper-post.hook $HOOKS_DIR
install -Dm 644 20_snap-pac-clean.hook $HOOKS_DIR
install -Dm 644 snap-pac.conf /etc/
install -Dm 644 LICENSE "$INSTALL_DIR/usr/share/licenses/snap-pac/LICENSE"

View file

@ -20,5 +20,6 @@
# Takes a snapper pre snapshot before a pacman transaction
rm /usr/share/libalpm/hooks.bin/snap-pac/.pre*
source /etc/snap-pac.conf
rm "$PREFIX_PREFILE"*
echo "NOTE: No post snapshot will be performed for this transaction, since you are removing the pacman hooks."

View file

@ -20,19 +20,14 @@
# 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"
source /etc/snap-pac.conf
PACMAN_CMD=$(ps -C pacman -o args=)
PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre
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
if [ -f $PREFILE_PREFIX"_"$x ]; then
SNAPPERPACPRE=$(cat $PREFILE_PREFIX"_"$x)
snapper --config $x create --cleanup-algorithm number --type post --pre-number $SNAPPERPACPRE --description "$PRE_DESCRIPTION"
rm $PREFILE_PREFIX"_"$x
else
echo "WARNING: $PREFILE"_"$x does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal."
echo "WARNING: $PREFILE_PREFIX"_"$x does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal."
fi
done

View file

@ -20,13 +20,8 @@
# 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"
source /etc/snap-pac.conf
PACMAN_CMD=$(ps -C pacman -o args=)
PREFILE=/usr/share/libalpm/hooks.bin/snap-pac/.pre
for x in $CONFIGS; do
snapper --config $x create --type pre --cleanup-algorithm number --print-number --description "$PACMAN_CMD" > $PREFILE"_"$x
snapper --config $x create --type pre --cleanup-algorithm number --print-number --description "$POST_DESCRIPTION" > $PREFILE_PREFIX"_"$x
done