diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2017-12-01 11:05:32 -0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-12-10 22:45:19 +0000 |
commit | 72d677b2bd267b8ff1ae84a93b4ac01fe9f7803c (patch) | |
tree | c975c99c889b93d511fb07a1a0da7343d6bc799a /meta/recipes-core/initrdscripts/initramfs-framework | |
parent | 5e82878c5d32256f7b539fff1881ea67694cbfd7 (diff) | |
download | poky-72d677b2bd267b8ff1ae84a93b4ac01fe9f7803c.tar.gz |
initramfs-framework: Add exec module
This new module allow for easy execution of external scripts or
applications. It runs anything found in /exec.d directory in order and
in case of no scripts to be available, it opens a shell.
(From OE-Core rev: 9b98c97338b4c3f985eca572d6a1e21324fa0fbc)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initrdscripts/initramfs-framework')
-rw-r--r-- | meta/recipes-core/initrdscripts/initramfs-framework/exec | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/exec b/meta/recipes-core/initrdscripts/initramfs-framework/exec new file mode 100644 index 0000000000..a8e2432bb6 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/exec | |||
@@ -0,0 +1,29 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright (C) 2017 O.S. Systems Software LTDA. | ||
3 | # Licensed on MIT | ||
4 | |||
5 | EXEC_DIR=/exec.d # place to look for modules | ||
6 | |||
7 | exec_enabled() { | ||
8 | return 0 | ||
9 | } | ||
10 | |||
11 | exec_run() { | ||
12 | if [ ! -d $EXEC_DIR ]; then | ||
13 | msg "No contents to exec in $EXEC_DIR. Starting shell ..." | ||
14 | sh | ||
15 | fi | ||
16 | |||
17 | # Load and run modules | ||
18 | for m in $EXEC_DIR/*; do | ||
19 | # Skip backup files | ||
20 | if [ "`echo $m | sed -e 's/\~$//'`" != "$m" ]; then | ||
21 | continue | ||
22 | fi | ||
23 | |||
24 | debug "Starting $m" | ||
25 | |||
26 | # process module | ||
27 | ./$m | ||
28 | done | ||
29 | } | ||