aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authorLuka Perkov <luka@openwrt.org>2016-05-10 22:36:49 +0000
committerLuka Perkov <luka@openwrt.org>2016-06-19 19:30:02 +0200
commit535a2648b20d1ee10cb444d590aebfd488d2c180 (patch)
treee8d4030457c20b7d0e3af86c4a05d55e58bd933e /package/base-files
parent32de2e4468e7a54d9e150c666f1537ae2ebe6d4d (diff)
downloadmaster-187ad058-535a2648b20d1ee10cb444d590aebfd488d2c180.tar.gz
master-187ad058-535a2648b20d1ee10cb444d590aebfd488d2c180.tar.bz2
master-187ad058-535a2648b20d1ee10cb444d590aebfd488d2c180.zip
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> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@49340 3c298f89-4303-0410-b956-a3cf2f4a3e73
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 4ec0cac332..cf1fa4874a 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -231,6 +231,17 @@ default_postinst() {
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