make sure defaults are set if user removes options
This commit is contained in:
parent
8194b4ac7b
commit
33efa4484d
3 changed files with 16 additions and 4 deletions
|
|
@ -28,6 +28,12 @@ AUR](https://aur.archlinux.org/packages/snap-pac/).
|
|||
After installation, the hooks are located at `/usr/share/libalpm/hooks`, and the
|
||||
scripts are located at `/usr/share/libalpm/hooks.bin/snap-pac`.
|
||||
|
||||
## Configuration
|
||||
|
||||
The configuration file is located at `/etc/snap-pac.conf`. There you can choose
|
||||
which snapper configurations of which to take snapshots, the descriptions used
|
||||
for the snapshots, and the snapper algorithm to use.
|
||||
|
||||
## Usage
|
||||
|
||||
### Taking snapshots
|
||||
|
|
|
|||
|
|
@ -22,11 +22,14 @@
|
|||
|
||||
source /etc/snap-pac.conf
|
||||
|
||||
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
||||
description=${POST_DESCRIPTION:-"$(ps -C pacman -o args=)"}
|
||||
configurations=${CONFIGS:-"root"}
|
||||
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
||||
for x in $CONFIGS; do
|
||||
for x in $configurations; do
|
||||
if [ -f $PREFILE_PREFIX"_"$x ]; then
|
||||
SNAPPERPACPRE=$(cat $PREFILE_PREFIX"_"$x)
|
||||
snapper --config $x create --cleanup-algorithm $CLEANUP_ALGORITHM --type post --pre-number $SNAPPERPACPRE --description "$PRE_DESCRIPTION"
|
||||
snapper --config $x create --cleanup-algorithm $cleanupalgo --type post --pre-number $SNAPPERPACPRE --description "$description"
|
||||
rm $PREFILE_PREFIX"_"$x
|
||||
else
|
||||
echo "WARNING: $PREFILE_PREFIX"_"$x does not exist, so not performing post snapshot. If you are initially installing snap-pac, this is normal."
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@
|
|||
|
||||
source /etc/snap-pac.conf
|
||||
|
||||
cleanupalgo=${CLEANUP_ALGORITHM:-"number"}
|
||||
description=${PRE_DESCRIPTION:-"$(ps -C pacman -o args=)"}
|
||||
configurations=${CONFIGS:-"root"}
|
||||
PREFILE_PREFIX="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
||||
for x in $CONFIGS; do
|
||||
snapper --config $x create --type pre --cleanup-algorithm $CLEANUP_ALGORITHM --print-number --description "$POST_DESCRIPTION" > $PREFILE_PREFIX"_"$x
|
||||
for x in $configurations; do
|
||||
snapper --config $x create --type pre --cleanup-algorithm $cleanupalgo --print-number --description "$description" > $PREFILE_PREFIX"_"$x
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue