base-files: split user/group addition code into a function

Signed-off-by: John Crispin <john@phrozen.org>
master
John Crispin 9 years ago
parent 797fb8a302
commit ed07ef1601
  1. 14
      package/base-files/files/lib/functions.sh

@ -173,11 +173,9 @@ default_prerm() {
done done
} }
default_postinst() { add_group_and_user() {
local root="${IPKG_INSTROOT}" local pkgname="$1"
local pkgname="$(basename ${1%.*})"
local rusers="$(sed -ne 's/^Require-User: *//p' $root/usr/lib/opkg/info/${pkgname}.control 2>/dev/null)" 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 if [ -n "$rusers" ]; then
local tuple oIFS="$IFS" local tuple oIFS="$IFS"
@ -208,6 +206,14 @@ default_postinst() {
unset uid gid uname gname unset uid gid uname gname
done done
fi 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 if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ) ( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )

Loading…
Cancel
Save