diff options
author | Christian Hesse <mail@eworm.de> | 2024-05-27 18:23:18 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-05-29 09:23:49 +0200 |
commit | 406b5748d77aec618dadc4bb96b19dac8a6bef55 (patch) | |
tree | 19a4c9b21993630928c8f7998ea9034c9b165a71 | |
parent | c46764a5f6f7aa4f09bab4a38305ae4e39d65bb8 (diff) | |
download | pacman-offline-406b5748d77aec618dadc4bb96b19dac8a6bef55.tar.gz pacman-offline-406b5748d77aec618dadc4bb96b19dac8a6bef55.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
-rwxr-xr-x | bin/pacman-offline | 5 |
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 |