diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2019-06-20 10:29:53 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-04 13:18:19 +0200 |
commit | 6e0bd490140fcdbf577cf35671bf68f537d19ecc (patch) | |
tree | ba7e1ccf076bebf47e5da551f9a5868a96994b73 | |
parent | 97e52258d73abe2d9cd83ccf653a996e141b9046 (diff) | |
download | upstream-6e0bd490140fcdbf577cf35671bf68f537d19ecc.tar.gz upstream-6e0bd490140fcdbf577cf35671bf68f537d19ecc.tar.bz2 upstream-6e0bd490140fcdbf577cf35671bf68f537d19ecc.zip |
base-files: apply new sysctl.conf at postinst
This is mainly for kmod-br-netfilter. To turn off
bridge-netfilter-call-xxx immediately after installation
While at it
- Define filelist="/usr/lib/opkg/info/${pkgname}.list"
- Reuse "[ -z "$root" ]"
- Grep with "-m1"
Fixes FS#2300
Reported-by: Marco Sartorius <tidbits@ormoorgmen.info>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
(cherry picked from commit 3dc4f59eabaed5135cd4eed8d1846248d5f1b37c)
-rw-r--r-- | package/base-files/Makefile | 2 | ||||
-rwxr-xr-x | package/base-files/files/lib/functions.sh | 33 |
2 files changed, 21 insertions, 14 deletions
diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 91d677acb3..a6dee5aa5a 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=198 +PKG_RELEASE:=199 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ 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 |