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:41:41 +0000 |
commit | 9b98c97338b4c3f985eca572d6a1e21324fa0fbc (patch) | |
tree | 296b462d66685d2c4c9585e6723531ad7167585c /meta/recipes-core/initrdscripts/initramfs-framework | |
parent | a41f7cdf0cbc56a283d5c845c36d88a0208bf386 (diff) | |
download | openembedded-core-contrib-9b98c97338b4c3f985eca572d6a1e21324fa0fbc.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.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
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 @@ +#!/bin/sh +# Copyright (C) 2017 O.S. Systems Software LTDA. +# Licensed on MIT + +EXEC_DIR=/exec.d # place to look for modules + +exec_enabled() { + return 0 +} + +exec_run() { + if [ ! -d $EXEC_DIR ]; then + msg "No contents to exec in $EXEC_DIR. Starting shell ..." + sh + fi + + # Load and run modules + for m in $EXEC_DIR/*; do + # Skip backup files + if [ "`echo $m | sed -e 's/\~$//'`" != "$m" ]; then + continue + fi + + debug "Starting $m" + + # process module + ./$m + done +} |