From 4a9f4d3145c1ff63b09072663829c166bb524571 Mon Sep 17 00:00:00 2001 From: Amar Al-Zubaidi <92645199+amarakon@users.noreply.github.com> Date: Wed, 21 Sep 2022 12:26:23 -0500 Subject: [PATCH] Support `doas` and `su` for root authentication (#593) --- install.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/install.sh b/install.sh index 2ed5999..ace98de 100755 --- a/install.sh +++ b/install.sh @@ -17,6 +17,14 @@ set -e _where=`pwd` srcdir="$_where" +# Command used for superuser privileges (`sudo`, `doas`, `su`) +if [ ! -x "$(command -v sudo)" ]; then + if [ -x "$(command -v doas)" ]; then sudo() { doas "$@"; } + elif [ -x "$(command -v su)" -a -x "$(command -v xargs)" ]; then + sudo() { echo "$@" | xargs -I {} su -c '{}'; } + fi +fi + source customization.cfg source linux-tkg-config/prepare