diff options
author | Max Reitz | 2018-04-11 17:28:50 +0200 |
---|---|---|
committer | Max Reitz | 2018-04-11 17:28:50 +0200 |
commit | 4b16d8eef6c776aa894ec2919ce13eca33d1cd35 (patch) | |
tree | edecc591f64776715e86261c3011220c0234dfdb | |
parent | 3a6e58536fed6aaf108127112c41fb2b7aea3573 (diff) | |
download | aur-4b16d8eef6c776aa894ec2919ce13eca33d1cd35.tar.gz |
Fix PID file location on upgrade
post_upgrade() is usually run under sudo, so $XDG_RUNTIME_DIR is not set
and $(id -u) is pretty much useless. So if neither gives us a usable
path, try /var/run/user/$SUDO_UID as a last resort.
Note that in addition, the /var/run path was wrong. It is
"/var/run/user", not "/var/run/users".
Good thing this happened on the first version so probably nobody has run
post_upgrade() so far.
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 2 | ||||
-rw-r--r-- | krunner-mpd-git.install | 11 |
3 files changed, 9 insertions, 6 deletions
@@ -1,7 +1,7 @@ pkgbase = krunner-mpd-git pkgdesc = KRunner plugin to control an MPD server pkgver = r32.96f8e44 - pkgrel = 1 + pkgrel = 2 url = https://github.com/XanClic/krunner-mpd install = krunner-mpd-git.install arch = any @@ -1,7 +1,7 @@ # Maintainer: Max Reitz <xanclic at xanclic dot moe> pkgname=krunner-mpd-git pkgver=r32.96f8e44 -pkgrel=1 +pkgrel=2 pkgdesc="KRunner plugin to control an MPD server" arch=('any') url="https://github.com/XanClic/krunner-mpd" diff --git a/krunner-mpd-git.install b/krunner-mpd-git.install index 0e6071078a41..766cf3a2b66b 100644 --- a/krunner-mpd-git.install +++ b/krunner-mpd-git.install @@ -6,13 +6,16 @@ post_install() { post_upgrade() { # Kill the old instance so that krunner launches the new version + local _pid_file='krunner-mpd.pid' local _pid_dir=$XDG_RUNTIME_DIR if [ -z "$_pid_dir" ]; then - _pid_dir="/var/run/users/$(id -u)" + _pid_dir="/var/run/user/$(id -u)" + if [ ! -f "$_pid_dir/$_pid_file" -a -n "$SUDO_UID" ]; then + _pid_dir="/var/run/user/$SUDO_UID" + fi fi - local _pid_file="$_pid_dir/krunner-mpd.pid" - if [ -f "$_pid_file" ]; then - kill "$(cat "$_pid_file")" + if [ -f "$_pid_dir/$_pid_file" ]; then + kill "$(cat "$_pid_dir/$_pid_file")" fi } |