X-Git-Url: https://git.archive.openwrt.org/?p=openwrt.git;a=blobdiff_plain;f=package%2Fbase-files%2Ffiles%2Flib%2Ffunctions.sh;h=2f78d67025d0f52968fb47d6ee60a8b1163b5e6a;hp=8582605991fd1c41b483ad0a38bc2145befe5715;hb=HEAD;hpb=8ed0bc77e7805a5898e1334dd3d909551b94ac64 diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 8582605991..cf1fa4874a 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" ) @@ -225,6 +231,17 @@ default_postinst() { cd $OLDPWD fi + if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then + . /lib/functions/system.sh + [ -d /tmp/.uci ] || mkdir -p /tmp/.uci + cd /etc/uci-defaults + for i in $(grep -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"); do + ( . "./$(basename $i)" ) && rm -f "$i" + done + uci commit + cd $OLDPWD + fi + [ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null if [ "$PKG_UPGRADE" != "1" ]; then