X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=package%2Fbase-files%2Ffiles%2Flib%2Ffunctions.sh;fp=package%2Fbase-files%2Ffiles%2Flib%2Ffunctions.sh;h=860fc045100f15a0725e47a38f28f9855835291a;hp=edce75e8ff877aa28adea5b58463a95b19f8f7e2;hb=3dc4f59eabaed5135cd4eed8d1846248d5f1b37c;hpb=a8f0c02f80fa0c7c55702770b3ca99f6db5405e7 diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index edce75e8ff..860fc04510 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -213,6 +213,7 @@ add_group_and_user() { default_postinst() { local root="${IPKG_INSTROOT}" local pkgname="$(basename ${1%.*})" + local filelist="/usr/lib/opkg/info/${pkgname}.list" local ret=0 add_group_and_user "${pkgname}" @@ -227,23 +228,29 @@ default_postinst() { rm -fR $root/rootfs-overlay/ fi - if [ -z "$root" ] && grep -q -s "^/etc/modules.d/" "/usr/lib/opkg/info/${pkgname}.list"; then - kmodloader - fi + if [ -z "$root" ]; then + if grep -m1 -q -s "^/etc/modules.d/" "$filelist"; then + kmodloader + 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 - for i in $(grep -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"); do - ( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i" - done - uci commit - fi + if grep -m1 -q -s "^/etc/sysctl.d/" "$filelist"; then + /etc/init.d/sysctl restart + fi - [ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null + if grep -m1 -q -s "^/etc/uci-defaults/" "$filelist"; then + . /lib/functions/system.sh + [ -d /tmp/.uci ] || mkdir -p /tmp/.uci + for i in $(grep -s "^/etc/uci-defaults/" "$filelist"); do + ( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i" + done + uci commit + fi + + rm -f /tmp/luci-indexcache + fi local shell="$(which bash)" - for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do + for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do if [ -n "$root" ]; then ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable else