base-files: rework postinstall uci-defaults handling
Some package postinstall operations, e.g. those emitted by the LuCI build system, source and delete the uci-defaults themselves upon package insteall, causing the generic defaults apply code to trigger shell errors like: .../luci-app-ddns.postinst: .: line 130: can't open './40_luci-ddns' Rework the generic apply code to check the existence of the uci-defaults script before trying to source it, use sed to prefilter the list of entries from the control file and perform the directory change in a subshell, avoiding the need for cd $OLDPWD. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
749d4b77bd
commit
7f69458296
|
@ -223,12 +223,11 @@ default_postinst() {
|
||||||
if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then
|
if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then
|
||||||
. /lib/functions/system.sh
|
. /lib/functions/system.sh
|
||||||
[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
|
[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
|
||||||
|
for i in $(sed -ne 's!^/etc/uci-defaults/!!p' "/usr/lib/opkg/info/${pkgname}.list"); do (
|
||||||
cd /etc/uci-defaults
|
cd /etc/uci-defaults
|
||||||
for i in $(grep -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"); do
|
[ -f "$i" ] && . "$i" && rm -f "$i"
|
||||||
( . "./$(basename $i)" ) && rm -f "$i"
|
) done
|
||||||
done
|
|
||||||
uci commit
|
uci commit
|
||||||
cd $OLDPWD
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null
|
[ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null
|
||||||
|
|
Loading…
Reference in New Issue