mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-26 08:52:16 +00:00
abuild: remove dependency of sudo
use the abuild-sudo tool instead fixes #951
This commit is contained in:
parent
442e804291
commit
c6263baeb9
26
abuild.in
26
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user