summaryrefslogtreecommitdiff
path: root/package/base-files
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2016-04-29 11:34:44 +0000
committerDaniel Golle <daniel@makrotopia.org>2016-05-04 14:24:37 +0100
commit9b9c78e071469313566473984fb79f54c1881c10 (patch)
treeb7db8926486d5cd2d14551398263afa2f1e92634 /package/base-files
parentf6adbdf3cdb8ce0d5a730575cab797ced956a59e (diff)
downloadmtk-20170518-9b9c78e071469313566473984fb79f54c1881c10.zip
mtk-20170518-9b9c78e071469313566473984fb79f54c1881c10.tar.gz
mtk-20170518-9b9c78e071469313566473984fb79f54c1881c10.tar.bz2
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 <daniel@makrotopia.org>
Diffstat (limited to 'package/base-files')
-rwxr-xr-xpackage/base-files/files/lib/functions.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 33b22d2..7bce122 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -220,6 +220,17 @@ default_postinst() {
ret=$?
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