summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo <thinkabit.ukim@gmail.com>2019-11-26 20:29:55 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2020-03-23 13:09:15 +0000
commitd4c670bc44918e1e32a10d603cc81e8d5f866b87 (patch)
treee1c387869f380da0740ed4ce8d6d44f974fe9f28
parent69fc8b8fc17e39a9fa17d8ace246e617c698fce0 (diff)
downloadabuild-d4c670bc44918e1e32a10d603cc81e8d5f866b87.tar.bz2
abuild-d4c670bc44918e1e32a10d603cc81e8d5f866b87.tar.xz
Add support for the SUDO variable
This can be used to pick another tool to elevate privileges.
-rw-r--r--abuild-keygen.in9
1 files changed, 6 insertions, 3 deletions
diff --git a/abuild-keygen.in b/abuild-keygen.in
index b34d0fc..57fbb23 100644
--- a/abuild-keygen.in
+++ b/abuild-keygen.in
@@ -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__
}