make variables read only
This commit is contained in:
parent
cef3d00b01
commit
96b282e4fa
2 changed files with 13 additions and 14 deletions
17
snapper-post
17
snapper-post
|
|
@ -26,16 +26,15 @@ else
|
||||||
echo "WARNING: /etc/snap-pac.conf is missing. Using default settings."
|
echo "WARNING: /etc/snap-pac.conf is missing. Using default settings."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
declare -r cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
||||||
description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
declare -r description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
||||||
configurations=${CONFIGS:-"root"}
|
declare -r configurations=${CONFIGS:-"root"}
|
||||||
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
declare -r 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)
|
snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $(cat $prefile_prefix"_"$x) --description "$description"
|
||||||
snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $SNAPPERPACPRE --description "$description"
|
rm $prefile_prefix"_"$x
|
||||||
rm $PREFILE_PREFIX"_"$x
|
|
||||||
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
|
||||||
done
|
done
|
||||||
|
|
|
||||||
10
snapper-pre
10
snapper-pre
|
|
@ -26,10 +26,10 @@ else
|
||||||
echo "WARNING: /etc/snap-pac.conf is missing. Using default settings."
|
echo "WARNING: /etc/snap-pac.conf is missing. Using default settings."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
declare -r cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
||||||
description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
declare -r description=${POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
||||||
configurations=${CONFIGS:-"root"}
|
declare -r configurations=${CONFIGS:-"root"}
|
||||||
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
declare -r 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
|
snapper --config $x create --type pre --cleanup-algorithm $cleanupalgo --print-number --description "$description" > $prefile_prefix"_"$x
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue