Output each configuration name and snapshot number during transactions
This commit is contained in:
parent
14b9e99d04
commit
9de30a8075
4 changed files with 42 additions and 15 deletions
21
README.md
21
README.md
|
|
@ -100,12 +100,19 @@ Installing the `nano` package as normal:
|
||||||
(1/1) checking for file conflicts [######################################] 100%
|
(1/1) checking for file conflicts [######################################] 100%
|
||||||
(1/1) checking available disk space [######################################] 100%
|
(1/1) checking available disk space [######################################] 100%
|
||||||
:: Running pre-transaction hooks...
|
:: Running pre-transaction hooks...
|
||||||
(1/1) snapper pre snapshot
|
(1/1) Performing snapper pre snapshots...
|
||||||
|
home N/A
|
||||||
|
root 1033 ✓
|
||||||
:: Processing package changes...
|
:: Processing package changes...
|
||||||
(1/1) installing nano [######################################] 100%
|
(1/1) installing nano [######################################] 100%
|
||||||
:: Running post-transaction hooks...
|
:: Running post-transaction hooks...
|
||||||
(1/2) snapper post snapshot
|
(1/1) Performing snapper post snapshots...
|
||||||
(2/2) generate GRUB configuration file
|
home N/A
|
||||||
|
root 1034 ✓
|
||||||
|
|
||||||
|
The snapper snapshot number is given for each snapper configuration that is
|
||||||
|
used (tip: this is also logged in pacman's log). "N/A" means that configuration
|
||||||
|
is not set up for snap-pac (see above).
|
||||||
|
|
||||||
And here are the snapshots:
|
And here are the snapshots:
|
||||||
|
|
||||||
|
|
@ -176,6 +183,14 @@ removed before the post snapshot could be taken. When you initially install
|
||||||
*snap-pac* the post hook is run, but the pre hook never was, so this message
|
*snap-pac* the post hook is run, but the pre hook never was, so this message
|
||||||
will show up then as well.
|
will show up then as well.
|
||||||
|
|
||||||
|
**I see an "N/A" next to one of my snapper configurations in the hook's output**
|
||||||
|
|
||||||
|
snap-pac lists all snapper configurations it finds and tells you which ones it
|
||||||
|
took a snapshot of. "N/A" means the configuration is not set up for snap-pac, so
|
||||||
|
no snapshot was taken.
|
||||||
|
|
||||||
|
See [configuration](#configuration).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
snap-pac
|
snap-pac
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ Type = Package
|
||||||
Target = *
|
Target = *
|
||||||
|
|
||||||
[Action]
|
[Action]
|
||||||
Description = Performing snapper pre snapshot...
|
Description = Performing snapper pre snapshots...
|
||||||
Depends = snap-pac
|
Depends = snap-pac
|
||||||
When = PreTransaction
|
When = PreTransaction
|
||||||
Exec = /usr/share/libalpm/scripts/snap-pac pre
|
Exec = /usr/share/libalpm/scripts/snap-pac pre
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ Type = Package
|
||||||
Target = *
|
Target = *
|
||||||
|
|
||||||
[Action]
|
[Action]
|
||||||
Description = Performing snapper post snapshot...
|
Description = Performing snapper post snapshots...
|
||||||
Depends = snap-pac
|
Depends = snap-pac
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/share/libalpm/scripts/snap-pac post
|
Exec = /usr/share/libalpm/scripts/snap-pac post
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,9 @@ for CONFIG in $SNAPPER_CONFIGS; do
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source /etc/snapper/configs/"$CONFIG"
|
source /etc/snapper/configs/"$CONFIG"
|
||||||
|
|
||||||
[[ $PACMAN_PRE_POST != "yes" ]] && continue
|
echo -n " $CONFIG "
|
||||||
|
|
||||||
|
if [[ $PACMAN_PRE_POST == "yes" ]]; then
|
||||||
|
|
||||||
prefile="/tmp/snap-pac-pre_$CONFIG"
|
prefile="/tmp/snap-pac-pre_$CONFIG"
|
||||||
snapper_cmd="snapper --config $CONFIG create --type $pre_or_post --cleanup-algorithm $PACMAN_CLEANUP_ALGORITHM"
|
snapper_cmd="snapper --config $CONFIG create --type $pre_or_post --cleanup-algorithm $PACMAN_CLEANUP_ALGORITHM"
|
||||||
|
|
@ -75,13 +77,23 @@ for CONFIG in $SNAPPER_CONFIGS; do
|
||||||
|
|
||||||
if [[ "$pre_or_post" == "pre" ]]; then
|
if [[ "$pre_or_post" == "pre" ]]; then
|
||||||
$snapper_cmd --description "$PACMAN_PRE_DESCRIPTION" --print-number > "$prefile"
|
$snapper_cmd --description "$PACMAN_PRE_DESCRIPTION" --print-number > "$prefile"
|
||||||
|
echo -n "$(< "$prefile") "
|
||||||
elif [[ -f $prefile ]]; then
|
elif [[ -f $prefile ]]; then
|
||||||
$snapper_cmd --description "$PACMAN_POST_DESCRIPTION" --pre-number "$(< "$prefile")"
|
postnum=$($snapper_cmd --description "$PACMAN_POST_DESCRIPTION" --print-number --pre-number "$(< "$prefile")")
|
||||||
|
echo -n "$postnum "
|
||||||
rm "$prefile"
|
rm "$prefile"
|
||||||
else
|
else
|
||||||
echo "WARNING: $prefile does not exist, so no post snapshot will be taken. If you are initially installing snap-pac, this is normal."
|
echo "WARNING: $prefile does not exist, so no post snapshot will be taken. If you are initially installing snap-pac, this is normal."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "✓"
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
echo "N/A"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $x -eq 0 ]]; then
|
if [[ $x -eq 0 ]]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue