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 3dc4f59eab)
			
			
This commit is contained in:
		 Yousong Zhou
					Yousong Zhou
				
			
				
					committed by
					
						 Jo-Philipp Wich
						Jo-Philipp Wich
					
				
			
			
				
	
			
			
			 Jo-Philipp Wich
						Jo-Philipp Wich
					
				
			
						parent
						
							97e52258d7
						
					
				
				
					commit
					6e0bd49014
				
			| @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk | |||||||
| include $(INCLUDE_DIR)/feeds.mk | include $(INCLUDE_DIR)/feeds.mk | ||||||
|  |  | ||||||
| PKG_NAME:=base-files | PKG_NAME:=base-files | ||||||
| PKG_RELEASE:=198 | PKG_RELEASE:=199 | ||||||
| PKG_FLAGS:=nonshared | PKG_FLAGS:=nonshared | ||||||
|  |  | ||||||
| PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ | PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ | ||||||
|   | |||||||
| @@ -213,6 +213,7 @@ add_group_and_user() { | |||||||
| default_postinst() { | default_postinst() { | ||||||
| 	local root="${IPKG_INSTROOT}" | 	local root="${IPKG_INSTROOT}" | ||||||
| 	local pkgname="$(basename ${1%.*})" | 	local pkgname="$(basename ${1%.*})" | ||||||
|  | 	local filelist="/usr/lib/opkg/info/${pkgname}.list" | ||||||
| 	local ret=0 | 	local ret=0 | ||||||
|  |  | ||||||
| 	add_group_and_user "${pkgname}" | 	add_group_and_user "${pkgname}" | ||||||
| @@ -227,23 +228,29 @@ default_postinst() { | |||||||
| 		rm -fR $root/rootfs-overlay/ | 		rm -fR $root/rootfs-overlay/ | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| 	if [ -z "$root" ] && grep -q -s "^/etc/modules.d/" "/usr/lib/opkg/info/${pkgname}.list"; then | 	if [ -z "$root" ]; then | ||||||
| 		kmodloader | 		if grep -m1 -q -s "^/etc/modules.d/" "$filelist"; then | ||||||
| 	fi | 			kmodloader | ||||||
|  | 		fi | ||||||
|  |  | ||||||
| 	if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then | 		if grep -m1 -q -s "^/etc/sysctl.d/" "$filelist"; then | ||||||
| 		. /lib/functions/system.sh | 			/etc/init.d/sysctl restart | ||||||
| 		[ -d /tmp/.uci ] || mkdir -p /tmp/.uci | 		fi | ||||||
| 		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 |  | ||||||
|  |  | ||||||
| 	[ -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)" | 	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 | 		if [ -n "$root" ]; then | ||||||
| 			${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable | 			${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable | ||||||
| 		else | 		else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user