[source] functions.sh: fix default_postinst function

LEDE Commits lede-commits at lists.infradead.org
Wed Nov 8 14:29:20 PST 2017


mkresin pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/a0ef1c478ae56ce8cff1ce925caab527c5992d3c

commit a0ef1c478ae56ce8cff1ce925caab527c5992d3c
Author: Marko Ratkaj <marko.ratkaj at sartura.hr>
AuthorDate: Tue Nov 7 06:48:09 2017 +0100

    functions.sh: fix default_postinst function
    
    When we run "opkg install" on a package that installs an uci-defaults
    script, functions.sh will fail to evaluate that script in its
    default_postinst function.
    
    This happens because there is no "./" present and it searches for the
    file in paths specified by the PATH variable. This would work on bash,
    but it will not work on ash and some other shells like sh, zsh. This
    applys to the ". filename" directive used in this case.
    
    This patch will make the path relative to the /etc/uci-defaults
    directory.
    
    Fixes: FS#1021
    
    Signed-off-by: Marko Ratkaj <marko.ratkaj at sartura.hr>
---
 package/base-files/files/lib/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index b68db6b..992d88f 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -240,7 +240,7 @@ default_postinst() {
 		[ -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
-			[ -f "$i" ] && . "$i" && rm -f "$i"
+			[ -f "$i" ] && . ./"$i" && rm -f "$i"
 		) done
 		uci commit
 	fi



More information about the lede-commits mailing list