summaryrefslogtreecommitdiff
path: root/abuild.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-02-17 13:48:11 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-02-17 13:48:11 +0000
commitc6263baeb91c5e0c8b02f93ac9abd910a9b96c03 (patch)
tree5b8e837c62ca7ba30105cfdcf89a053fe0948861 /abuild.in
parent442e804291b54a2ff4a8b9fcbec20be4c759289c (diff)
downloadabuild-c6263baeb91c5e0c8b02f93ac9abd910a9b96c03.tar.gz
abuild-c6263baeb91c5e0c8b02f93ac9abd910a9b96c03.tar.bz2
abuild-c6263baeb91c5e0c8b02f93ac9abd910a9b96c03.tar.xz
abuild-c6263baeb91c5e0c8b02f93ac9abd910a9b96c03.zip
abuild: remove dependency of sudo
use the abuild-sudo tool instead fixes #951
Diffstat (limited to 'abuild.in')
-rwxr-xr-xabuild.in26
1 files changed, 14 insertions, 12 deletions
diff --git a/abuild.in b/abuild.in
index 9758f85..064b072 100755
--- a/abuild.in
+++ b/abuild.in
@@ -18,9 +18,12 @@ abuild_path=$(readlink -f $0)
# defaults
BUILD_BASE="build-base"
-SUDO=${SUDO:-"sudo"}
FAKEROOT=${FAKEROOT:-"fakeroot"}
-APK=${APK:-apk}
+
+: ${APK:=abuild-apk}
+: ${ADDUSER:=abuild-adduser}
+: ${ADDGROUP:=abuild-addgroup}
+
apk_opt_wait="--wait 30"
# read config
@@ -100,7 +103,7 @@ cleanup() {
set_xterm_title ""
if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then
msg "Uninstalling dependencies..."
- $SUDO $APK del --quiet $apk_opt_wait $uninstall_after
+ $APK del --quiet $apk_opt_wait $uninstall_after
fi
if [ -n "$CLEANUP_FILES" ]; then
rm -f $CLEANUP_FILES
@@ -485,13 +488,13 @@ mkusers() {
if getent group $i >/dev/null; then
gopt="-G $i"
fi
- $SUDO adduser -S -D -H $gopt $i || return 1
+ $ADDUSER -S -D -H $gopt $i || return 1
fi
done
for i in $pkggroups; do
if ! getent group $i >/dev/null; then
msg "Creating group $i"
- $SUDO addgroup -S $i || return 1
+ $ADDGROUP -S $i || return 1
fi
done
}
@@ -1289,10 +1292,10 @@ builddeps() {
if [ -n "$install_deps" ] && [ -z "$recursive" ] && [ -n "$deps" ]; then
# make a --simluate run first to detect missing deps
# apk-tools --virtual is no goot at reporting those.
- $SUDO $APK add --repository "$abuildrepo" \
+ $APK add --repository "$abuildrepo" \
$apk_opt_wait \
--simulate --quiet $deps || return 1
- $SUDO $APK add --repository "$abuildrepo" \
+ $APK add --repository "$abuildrepo" \
$apk_opt_wait \
--virtual .makedepends-$pkgname $deps \
&& return 0
@@ -1324,7 +1327,7 @@ builddeps() {
cd "$dir" && $0 $forceroot $keep $quiet $install_deps \
$recursive $upgrade $color_opt abuildindex || return 1
done
- $SUDO $APK add -u --repository "$abuildrepo" \
+ $APK add -u --repository "$abuildrepo" \
$apk_opt_wait \
--virtual .makedepends-$pkgname $deps
}
@@ -1439,18 +1442,18 @@ post_add() {
post_add $i || return 1
fi
done
- $SUDO $APK add $apk_opt_wait -u "$pkgf" || die "Failed to install $1"
+ $APK add $apk_opt_wait -u "$pkgf" || die "Failed to install $1"
}
installdeps() {
local deps i
- $SUDO $APK add $apk_opt_wait --repository "$abuildrepo" \
+ $APK add $apk_opt_wait --repository "$abuildrepo" \
--virtual .makedepends-$pkgname \
$makedepends
}
uninstalldeps (){
- $SUDO $APK del $apk_opt_wait .makedepends-$pkgname
+ $APK del $apk_opt_wait .makedepends-$pkgname
}
all() {
@@ -1540,7 +1543,6 @@ shift $(( $OPTIND - 1 ))
# check so we are not root
if [ "$(whoami)" = "root" ] && [ -z "$FAKEROOTKEY" ]; then
[ -z "$forceroot" ] && die "Do not run abuild as root"
- SUDO=
FAKEROOT=
fi