From 325c8f45c346d3e27a697276570e707cbe5487ef Mon Sep 17 00:00:00 2001 From: James Barnett Date: Tue, 21 Mar 2017 16:18:23 -0500 Subject: [PATCH] udpate docs, rm unneeded checks --- man8/snap-pac.8 | 41 ++++++++++------------------------------- scripts/snap-pac | 13 +++---------- 2 files changed, 13 insertions(+), 41 deletions(-) diff --git a/man8/snap-pac.8 b/man8/snap-pac.8 index dd2abf0..a7aa8af 100644 --- a/man8/snap-pac.8 +++ b/man8/snap-pac.8 @@ -100,12 +100,12 @@ Installing the nano package as normal: (1/1) checking available disk space [######################################] 100% :: Running pre-transaction hooks... (1/1) Performing snapper pre snapshots for the following configurations... - root: 1033 + => root: 1033 :: Processing package changes... (1/1) installing nano [######################################] 100% :: Running post-transaction hooks... (1/1) Performing snapper post snapshots for the following configurations... - root: 1034 + => root: 1034 .EE @@ -163,17 +163,16 @@ And nano is now gone, along with all the files it changed: .SH TROUBLESHOOTING -.SS ERROR: \fI/etc/conf.d/snapper\fR does not exist! -snap-pac reads in the snapper configurations from \fI/etc/conf.d/snapper\fR. It can't -do that if the file doesn't exist. I'm not sure what you've done to not have it -exist in the default location. +.SS error: No dbus available. Are you in a chroot environment? +Snapper requires dbus. If you chroot into another environment, dbus will not be +available, so snapper can't take snapshots. Although snapper can be set up to +not need dbus, this is a simple way to check if one is in a chroot and avoid +attempting snapshots in it. -.SS WARNING: No snapper configurations found, so not taking any snapshots! -No snapper configurations were found in \fI/etc/conf.d/snapper\fR. This means you -haven't created any configurations yet using snapper create-config. See the -snapper manpage on how to do this. +.SS snap-pac is only taking snapshots of the root configuration +That's the default behavior. See \fBCONFIGURATION\fR. -.SS WARNING: No snapper configurations are set up for snapshots to be taken! +.SS No snapshots are being taken when I run pacman Although you seem to have created at least one snapper configuration, none of them are set up for snap-pac's pacman hooks. By default snap-pac will take snapshots for the root configuration and any other configuration which has @@ -181,30 +180,10 @@ PACMAN_PRE_POST set to yes in its configuration file. This message means you don't have a snapper configuration named root (or PACMAN_PRE_POST is set to no for it) and no other configuration is set up for snapshots. See configuration. -.SS WARNING: prefile does not exist, so no post snapshot will be taken. If you are initially installing snap-pac, this is normal. -snap-pac saves the pre snapshot's number in a temporary file. Somehow it got -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 will -show up then as well and is safe to ignore in that circumstance. - -.SS WARNING: Didn't find pacman running. -The script gets the description from the pacman command that was run. If you get -this warning it looks like you may have run the script directly instead of -letting it run through pacman's hooks. - -.SS ERROR: Unable to use snapper without dbus. Are you in a chroot environment? -Snapper requires dbus. If you chroot into another environment, dbus will not be -available, so snapper can't take snapshots. Although snapper can be set up to -not need dbus, this is a simple way to check if one is in a chroot and avoid -attempting snapshots in it. - .SS After restoring snapshot from snap-pac, pacman database is locked The pre/post snaphots are taken while pacman is running, so this is expected. Follow the instructions pacman gives you (e.g., removing the lock file). -.SS snap-pac is only taking snapshots of the root configuration -That's the default behavior. See \fBCONFIGURATION\fR. - .SH FAQ .SS Does snap-pac backup non-btrfs /boot partitions? Nope. But you can add hook that does it for you. It would be something like the diff --git a/scripts/snap-pac b/scripts/snap-pac index eb1ede3..d17c0b9 100755 --- a/scripts/snap-pac +++ b/scripts/snap-pac @@ -3,23 +3,21 @@ # snap-pac # https://github.com/wesbarnett/snap-pac # Copyright (C) 2016, 2017 James W. Barnett - +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. - +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - +# # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# Main script. - declare -r SNAPPER_CONFIG_FILE=/etc/conf.d/snapper declare -r DESC_LIMIT=48 declare -r name="snap-pac" @@ -58,7 +56,6 @@ set_defaults() { trap error_exit ERR trap kill_exit SIGTERM SIGINT -[[ "$pre_or_post" != "pre" ]] && [[ "$pre_or_post" != "post" ]] && die "First argument must be 'pre' or 'post'." [[ ! -d /var/run/dbus ]] && die "No dbus available. Are you in a chroot environment?" source "$SNAPPER_CONFIG_FILE" @@ -73,8 +70,6 @@ for CONFIG in $SNAPPER_CONFIGS; do prefile="/tmp/$name-pre_$CONFIG" snapper_cmd="snapper --config $CONFIG create --type $pre_or_post --cleanup-algorithm $PACMAN_CLEANUP_ALGORITHM --print-number --description" - x=$((x+1)) - if [[ "$pre_or_post" == "pre" ]]; then printf "==> %s: $($snapper_cmd "$(truncate_description $PACMAN_PRE_DESCRIPTION)" | tee "$prefile")\n" "$CONFIG" elif [[ -f $prefile && "$pre_or_post" == "post" ]]; then @@ -84,6 +79,4 @@ for CONFIG in $SNAPPER_CONFIGS; do done -[[ $x -eq 0 ]] && die "No snapper configurations are set up for snapshots to be taken." - exit 0