add verbose option
This commit is contained in:
parent
3a9aaadb1f
commit
7ad490c283
3 changed files with 17 additions and 2 deletions
|
|
@ -13,3 +13,6 @@
|
||||||
|
|
||||||
# Snapper cleanup algorithm to use.
|
# Snapper cleanup algorithm to use.
|
||||||
#CLEANUP_ALGORITHM="number"
|
#CLEANUP_ALGORITHM="number"
|
||||||
|
|
||||||
|
# Set to "true" to make commands verbose
|
||||||
|
#VERBOSE="false"
|
||||||
|
|
|
||||||
10
snapper-post
10
snapper-post
|
|
@ -29,12 +29,20 @@ fi
|
||||||
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
||||||
description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
||||||
configurations=${CONFIGS:-"root"}
|
configurations=${CONFIGS:-"root"}
|
||||||
|
be_verbose=${VERBOSE:-"false"}
|
||||||
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
||||||
for x in $configurations; do
|
for x in $configurations; do
|
||||||
if [ -f $PREFILE_PREFIX"_"$x ]; then
|
if [ -f $PREFILE_PREFIX"_"$x ]; then
|
||||||
SNAPPERPACPRE=$(cat $PREFILE_PREFIX"_"$x)
|
SNAPPERPACPRE=$(cat $PREFILE_PREFIX"_"$x)
|
||||||
snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $SNAPPERPACPRE --description "$description"
|
snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $SNAPPERPACPRE --description "$description"
|
||||||
rm $PREFILE_PREFIX"_"$x
|
case "${be_verbose}" in
|
||||||
|
true)
|
||||||
|
snapper -v --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $SNAPPERPACPRE --description "$description"
|
||||||
|
rm -v $PREFILE_PREFIX"_"$x;;
|
||||||
|
*)
|
||||||
|
snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $SNAPPERPACPRE --description "$description"
|
||||||
|
rm $PREFILE_PREFIX"_"$x
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
echo "WARNING: $PREFILE_PREFIX"_"$x does not exist, so no post snapshot will be taken. If you are initially installing snap-pac, this is normal."
|
echo "WARNING: $PREFILE_PREFIX"_"$x does not exist, so no post snapshot will be taken. If you are initially installing snap-pac, this is normal."
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,11 @@ fi
|
||||||
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
||||||
description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
||||||
configurations=${CONFIGS:-"root"}
|
configurations=${CONFIGS:-"root"}
|
||||||
|
be_verbose=${VERBOSE:-"false"}
|
||||||
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
||||||
for x in $configurations; do
|
for x in $configurations; do
|
||||||
snapper --config $x create --type pre --cleanup-algorithm $cleanupalgo --print-number --description "$description" > $PREFILE_PREFIX"_"$x
|
case "${be_verbose}" in
|
||||||
|
true) snapper -v --config $x create --type pre --cleanup-algorithm $cleanupalgo --print-number --description "$description" > $PREFILE_PREFIX"_"$x;;
|
||||||
|
*) snapper --config $x create --type pre --cleanup-algorithm $cleanupalgo --print-number --description "$description" > $PREFILE_PREFIX"_"$x
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue