From 406b5748d77aec618dadc4bb96b19dac8a6bef55 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 27 May 2024 18:23:18 +0200 Subject: try to elevate privileges with run0 This required systemd >= 256, which is the first version to ship with run0... https://www.freedesktop.org/software/systemd/man/run0.html --- bin/pacman-offline | 5 +++++ 1 file changed, 5 insertions(+) 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 -- cgit v1.2.3-70-g09d2