Author: luka Date: 2016-05-11 00:36:49 +0200 (Wed, 11 May 2016) New Revision: 49340
Modified: trunk/package/base-files/files/lib/functions.sh Log: base-files: evaluate uci-defaults on run-time installations Packages may install scripts into /etc/uci-defaults to be executed once after installation, usually at the first boot of the target. This works fine if the package was installed to the rootfs during build or using the ImageBuilder. If the package is installed using opkg during run-time uci-defaults were applied only after a reboot of the device. Avoid the need to reboot by evaluting the package's uci-defaults in default-postinst. Signed-off-by: Daniel Golle <[email protected]> Modified: trunk/package/base-files/files/lib/functions.sh =================================================================== --- trunk/package/base-files/files/lib/functions.sh 2016-05-10 22:36:47 UTC (rev 49339) +++ trunk/package/base-files/files/lib/functions.sh 2016-05-10 22:36:49 UTC (rev 49340) @@ -231,6 +231,17 @@ 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 _______________________________________________ openwrt-commits mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits
