diff options
author | Daniel Dickinson <daniel@cshore.neomailbox.net> | 2010-09-19 23:29:40 +0000 |
---|---|---|
committer | Daniel Dickinson <daniel@cshore.neomailbox.net> | 2010-09-19 23:29:40 +0000 |
commit | 6a745d7e2a692af9b0776a0a8f32bff4f1e366cc (patch) | |
tree | 2050f46f4b32122abf995a1d451bc22b6d39272b /package/base-files/files/lib/functions/boot.sh | |
parent | 18c8d922b7fc0f8f6bfb8af4338d8e203098a8a9 (diff) | |
download | upstream-6a745d7e2a692af9b0776a0a8f32bff4f1e366cc.tar.gz upstream-6a745d7e2a692af9b0776a0a8f32bff4f1e366cc.tar.bz2 upstream-6a745d7e2a692af9b0776a0a8f32bff4f1e366cc.zip |
[package] 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.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23099 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/lib/functions/boot.sh')
-rw-r--r-- | package/base-files/files/lib/functions/boot.sh | 13 |
1 files changed, 13 insertions, 0 deletions
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 +} + |