[openwrt/openwrt] base-files: execute package's "postinst" after executing uci-defaults

LEDE Commits lede-commits at lists.infradead.org
Sat Jan 27 01:37:21 PST 2024


rmilecki pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/6b7c4739c407588865aaa0d6868cf6bfe216a987

commit 6b7c4739c407588865aaa0d6868cf6bfe216a987
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Sun Nov 26 21:24:28 2023 +0100

    base-files: execute package's "postinst" after executing uci-defaults
    
    Allow "postinst" scripts to perform extra actions after applying all
    kind of fixups implemented using uci-defaults.
    
    This is needed e.g. by uhttpd-mod-ubus which after installation in a
    running systems needs to:
    1. Update uhttpd config using its uci-defaults script
    2. Reload uhttpd
    
    While this approach makes sense there is a risk it'll blow up some
    corner case postinst usages. There is only 1 way to find out.
    
    Cc: Hauke Mehrtens <hauke at hauke-m.de>
    Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
    (cherry picked from commit b799dd3c705dfd95745cdd94b13d1cd2ad2367a6)
---
 package/base-files/files/lib/functions.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 4b1b838572..50aed53b06 100644
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -262,11 +262,6 @@ default_postinst() {
 
 	add_group_and_user "${pkgname}"
 
-	if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
-		( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )
-		ret=$?
-	fi
-
 	if [ -d "$root/rootfs-overlay" ]; then
 		cp -R $root/rootfs-overlay/. $root/
 		rm -fR $root/rootfs-overlay/
@@ -292,6 +287,11 @@ default_postinst() {
 		rm -f /tmp/luci-indexcache
 	fi
 
+	if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
+		( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )
+		ret=$?
+	fi
+
 	local shell="$(command -v bash)"
 	for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
 		if [ -n "$root" ]; then




More information about the lede-commits mailing list