Add support for the SUDO variable

This can be used to pick another tool to elevate privileges.
This commit is contained in:
Leo 2019-11-26 20:29:55 +01:00 committed by Natanael Copa
parent 69fc8b8fc1
commit d4c670bc44
1 changed files with 6 additions and 3 deletions

View File

@ -8,6 +8,7 @@
program_version=@VERSION@
sharedir=${ABUILD_SHAREDIR:-@sharedir@}
SUDO="${SUDO:-sudo}"
if ! [ -f "$sharedir/functions.sh" ]; then
echo "$sharedir/functions.sh: not found" >&2
@ -54,11 +55,10 @@ do_keygen() {
)
openssl rsa -in "$privkey" -pubout -out "$pubkey"
if [ -n "$install_pubkey" ]; then
msg "Installing $pubkey to /etc/apk/keys..."
sudo mkdir -p /etc/apk/keys
sudo cp -i "$pubkey" /etc/apk/keys/
$SUDO mkdir -p /etc/apk/keys
$SUDO cp -i "$pubkey" /etc/apk/keys/
else
msg ""
@ -101,6 +101,9 @@ usage() {
-q, --quiet
-h, --help Show this help
The SUDO variable can be set to pick which tool can be used to
elevate privileges, if it is not set it defaults to sudo.
__EOF__
}