diff --git a/man8/snap-pac.8 b/man8/snap-pac.8 index b5a3268..dd2abf0 100644 --- a/man8/snap-pac.8 +++ b/man8/snap-pac.8 @@ -56,14 +56,14 @@ Default is "number". .RS 4 snapper description used for the pacman pre snapshot. -Default is the pacman command that called the snapshot. +Default is the parent program (usually pacman) that called the snapshot script. .RE \fBPACMAN_POST_DESCRIPTION=\fR\fB\fIstring\fR\fR .RS 4 snapper description used for the pacman post snapshot. -Default is the pacman command that called the snapshot. +Default is the parent program (usually pacman) that called the snapshot script. .RE The following setting can be changed in the snapper configuration file diff --git a/scripts/snap-pac b/scripts/snap-pac index 201c1f5..0a5823a 100755 --- a/scripts/snap-pac +++ b/scripts/snap-pac @@ -24,7 +24,7 @@ declare -r SNAPPER_CONFIG_FILE=/etc/conf.d/snapper declare -r DESC_LIMIT=48 declare -r name="snap-pac" declare PACMAN_ABORT_ON_FAIL="no" -declare -r pacman_cmd="$(sed 's./usr/bin/pacman.pacman.g' <(ps -C pacman -o args=))" +declare -r pacman_cmd="$(ps -q $(ps -p "$$" -o ppid=) -o args=)" declare -i x=0 declare -r pre_or_post=$1 @@ -59,7 +59,7 @@ set_defaults() { trap error_exit ERR trap kill_exit SIGTERM SIGINT -[[ -z "$pacman_cmd" ]] && die "snap-pac should only be called via provided pacman hooks." +[[ "$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"