aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2016-04-30 16:53:21 +0000
committerLuka Perkov <luka@openwrt.org>2016-06-19 19:17:12 +0200
commit899f8d5c564f7bdd567943d6682ec554f244f1f0 (patch)
tree1763309decd07177be1a7f3f56684c9ce34905ed /package/base-files
parentf9a0e8448ab5e88145ef1888a35e9e73341d565e (diff)
downloadmaster-187ad058-899f8d5c564f7bdd567943d6682ec554f244f1f0.tar.gz
master-187ad058-899f8d5c564f7bdd567943d6682ec554f244f1f0.tar.bz2
master-187ad058-899f8d5c564f7bdd567943d6682ec554f244f1f0.zip
base-files: split user/group addition code into a function
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@49275 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files')
-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 8582605991..4ec0cac332 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" )