Get parent of script call (may not be pacman)
Check for pre or post args, since no longer checking command. Update manpage.
This commit is contained in:
parent
613a1a3552
commit
c41c294dba
2 changed files with 4 additions and 4 deletions
|
|
@ -56,14 +56,14 @@ Default is "number".
|
||||||
.RS 4
|
.RS 4
|
||||||
snapper description used for the pacman pre snapshot.
|
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
|
.RE
|
||||||
|
|
||||||
\fBPACMAN_POST_DESCRIPTION=\fR\fB\fIstring\fR\fR
|
\fBPACMAN_POST_DESCRIPTION=\fR\fB\fIstring\fR\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
snapper description used for the pacman post snapshot.
|
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
|
.RE
|
||||||
|
|
||||||
The following setting can be changed in the snapper configuration file
|
The following setting can be changed in the snapper configuration file
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ declare -r SNAPPER_CONFIG_FILE=/etc/conf.d/snapper
|
||||||
declare -r DESC_LIMIT=48
|
declare -r DESC_LIMIT=48
|
||||||
declare -r name="snap-pac"
|
declare -r name="snap-pac"
|
||||||
declare PACMAN_ABORT_ON_FAIL="no"
|
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 -i x=0
|
||||||
declare -r pre_or_post=$1
|
declare -r pre_or_post=$1
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ set_defaults() {
|
||||||
trap error_exit ERR
|
trap error_exit ERR
|
||||||
trap kill_exit SIGTERM SIGINT
|
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?"
|
[[ ! -d /var/run/dbus ]] && die "No dbus available. Are you in a chroot environment?"
|
||||||
|
|
||||||
source "$SNAPPER_CONFIG_FILE"
|
source "$SNAPPER_CONFIG_FILE"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue