poky/meta/recipes-core/initrdscripts/initramfs-framework/exec
Otavio Salvador 72d677b2bd 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>
2017-12-10 22:45:19 +00:00

469 B

#!/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

}