aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-05-27 18:23:18 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-05-29 09:23:49 +0200
commit406b5748d77aec618dadc4bb96b19dac8a6bef55 (patch)
tree19a4c9b21993630928c8f7998ea9034c9b165a71 /bin
parentc46764a5f6f7aa4f09bab4a38305ae4e39d65bb8 (diff)
downloadpacman-offline-systemd-256.tar.gz
pacman-offline-systemd-256.tar.zst
try to elevate privileges with run0systemd-256
This required systemd >= 256, which is the first version to ship with run0... https://www.freedesktop.org/software/systemd/man/run0.html
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pacman-offline5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/pacman-offline b/bin/pacman-offline
index fbb9526..a8474e2 100755
--- a/bin/pacman-offline
+++ b/bin/pacman-offline
@@ -34,6 +34,11 @@ while getopts 'cfhrty' opt; do
done
if [ "${UID}" -ne 0 ]; then
+ if command -v run0 >/dev/null; then
+ echo 'Missing privileges, trying to elevate.' >&2
+ exec run0 "${0}" "${@}"
+ fi
+
echo "You need elevated privileges. Please run as user 'root'!" >&2
exit 1
fi