make variables read only

This commit is contained in:
James Barnett 2016-04-25 15:16:44 -05:00
parent cef3d00b01
commit 96b282e4fa
2 changed files with 13 additions and 14 deletions

View file

@ -26,16 +26,15 @@ else
echo "WARNING: /etc/snap-pac.conf is missing. Using default settings."
fi
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
configurations=${CONFIGS:-"root"}
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
declare -r cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
declare -r description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
declare -r configurations=${CONFIGS:-"root"}
declare -r prefile_prefix="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
for x in $configurations; do
if [ -f $PREFILE_PREFIX"_"$x ]; then
SNAPPERPACPRE=$(cat $PREFILE_PREFIX"_"$x)
snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $SNAPPERPACPRE --description "$description"
rm $PREFILE_PREFIX"_"$x
if [ -f $prefile_prefix"_"$x ]; then
snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $(cat $prefile_prefix"_"$x) --description "$description"
rm $prefile_prefix"_"$x
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
done

View file

@ -26,10 +26,10 @@ else
echo "WARNING: /etc/snap-pac.conf is missing. Using default settings."
fi
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
configurations=${CONFIGS:-"root"}
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
declare -r cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
declare -r description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
declare -r configurations=${CONFIGS:-"root"}
declare -r prefile_prefix="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
for x in $configurations; do
snapper --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
done