summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-08-21 07:54:53 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-08-21 07:54:53 +0000
commit32f3fce837569e2a3fb2545d8e09c95ae793ea47 (patch)
treee63dc561b94c89c283c1331af8f8cf73ab464fe4
parent5108c97824436a0f912c54e9f7c6d56fd75ffebc (diff)
downloadalpine-iso-32f3fce837569e2a3fb2545d8e09c95ae793ea47.tar.bz2
alpine-iso-32f3fce837569e2a3fb2545d8e09c95ae793ea47.tar.xz
abuild: implement pkgusers/pkggroups
-rwxr-xr-xabuild.in24
1 files changed, 21 insertions, 3 deletions
diff --git a/abuild.in b/abuild.in
index faa569e..8862a56 100755
--- a/abuild.in
+++ b/abuild.in
@@ -26,7 +26,7 @@ BUILD_BASE="build-base"
SUDO=${SUDO:-"sudo"}
-default_cmds="sanitycheck builddeps clean fetch unpack rootpkg apkcache"
+default_cmds="sanitycheck builddeps clean fetch unpack mkusers rootpkg apkcache"
# read config
ABUILD_CONF=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
@@ -264,7 +264,24 @@ cleanoldpkg() {
done
return 0
}
-
+
+mkusers() {
+ local i
+ for i in $pkgusers; do
+ if ! getent passwd $i >/dev/null; then
+ msg "Creating user $i"
+ $SUDO adduser -D -H $i || return 1
+ fi
+ done
+ for i in $pkggroups; do
+ if ! getent group $i >/dev/null; then
+ msg "Creating group $i"
+ $SUDO addgroup $i || return 1
+ fi
+ done
+}
+
+
runpart() {
local part=$1
[ -n "$DEBUG" ] && msg "$part"
@@ -488,7 +505,8 @@ create_apks() {
apkcache() {
if ! apk_up2date || [ -n "$force" ]; then
- sanitycheck && builddeps && clean && fetch && unpack && rootpkg || return 1
+ sanitycheck && builddeps && clean && fetch && unpack \
+ && mkusers && rootpkg || return 1
fi
local apk