summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2016-04-29 03:13:40 +0200
committerJohn Crispin <blogic@openwrt.org>2016-04-29 04:15:34 +0200
commited07ef1601a1fa36764c61a87e5f927309d68025 (patch)
treeee9e8b3f3db4b1815a2bfe4755d562e3889a7ac2 /package
parent797fb8a302831a3d310e451bde4c8a262cddf00e (diff)
downloadmtk-20170518-ed07ef1601a1fa36764c61a87e5f927309d68025.zip
mtk-20170518-ed07ef1601a1fa36764c61a87e5f927309d68025.tar.gz
mtk-20170518-ed07ef1601a1fa36764c61a87e5f927309d68025.tar.bz2
base-files: split user/group addition code into a function
Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/lib/functions.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index dde1ac4..33b22d2 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -173,11 +173,9 @@ default_prerm() {
done
}
-default_postinst() {
- local root="${IPKG_INSTROOT}"
- local pkgname="$(basename ${1%.*})"
+add_group_and_user() {
+ local pkgname="$1"
local rusers="$(sed -ne 's/^Require-User: *//p' $root/usr/lib/opkg/info/${pkgname}.control 2>/dev/null)"
- local ret=0
if [ -n "$rusers" ]; then
local tuple oIFS="$IFS"
@@ -208,6 +206,14 @@ default_postinst() {
unset uid gid uname gname
done
fi
+}
+
+default_postinst() {
+ local root="${IPKG_INSTROOT}"
+ local pkgname="$(basename ${1%.*})"
+ local ret=0
+
+ add_group_and_user "${pkgname}"
if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )