From: Daniel Dickinson Date: Sun, 19 Sep 2010 23:29:40 +0000 (+0000) Subject: base-files: Add function pi_include the /lib/functions/boot.sh used by preinit, which... X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1385904dfa12b76d208e564b541bd8a81dee22d6;p=openwrt%2Fstaging%2Fnbd.git base-files: Add function pi_include the /lib/functions/boot.sh used by preinit, which safely sources files as well as working correctly whether the script using it is a package added to the jffs2 part of a squashfs or built into an image or on some other root filesystem. SVN-Revision: 23099 --- diff --git a/package/base-files/files/lib/functions/boot.sh b/package/base-files/files/lib/functions/boot.sh index f93eec99a9..91ab9306e1 100644 --- a/package/base-files/files/lib/functions/boot.sh +++ b/package/base-files/files/lib/functions/boot.sh @@ -98,3 +98,16 @@ ramoverlay() { mount -t tmpfs root /tmp/root fopivot /tmp/root /rom 1 } + +pi_include() { + if [ -f "/tmp/overlay/$1" ]; then + . "/tmp/overlay/$1" + elif [ -f "$1" ]; then + . "$1" + else + echo "WARNING: $1 not found" + return 1 + fi + return 0 +} +