From 49d3b32578cd539a2bbafa07b78c686bdd6385db Mon Sep 17 00:00:00 2001 From: Jordyn Carattini Date: Fri, 19 Aug 2016 22:53:31 -0500 Subject: [PATCH] Added config to chose where to run the local scripts Added a option to config if the local scripts are started before or after --- rc | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/rc b/rc index eb58796..43dae26 100755 --- a/rc +++ b/rc @@ -10,6 +10,8 @@ UDEV="busybox" NETWORK_INTERFACE="eth0" WIFI_INTERFACE="wlan0" HOSTNAME="$(cat /etc/hostname)" +LOCAL_STARTUP="after" +LOCAL_SHUTDOWN="after" # User-definable start/stop/restart/poll functions which fall back to defaults custom_restart() { default_restart "$@"; } @@ -58,6 +60,15 @@ on_boot() { mount -a mount -o remount,rw / + #=================== + if [ "$LOCAL_STARTUP" == "before" ]; then + # load /etc/minirc.local + if [ -x /etc/minirc.local ]; then + echo_color 3 loading /etc/minirc.local... + /etc/minirc.local + fi + fi + #=================== # start the default daemons echo_color 3 starting daemons... @@ -70,26 +81,40 @@ on_boot() { done #=================== + if [ "$LOCAL_STARTUP" == "after" ]; then # load /etc/minirc.local if [ -x /etc/minirc.local ]; then echo_color 3 loading /etc/minirc.local... /etc/minirc.local fi + fi } on_shutdown() { + + #=================== + if [ "$LOCAL_SHUTDOWN" == "after" ]; then + # load minirc.local.shutdown + if [ -x /etc/minirc.local.shutdown ]; then + echo_color 3 loading /etc/minirc.local.shutdown... + /etc/minirc.local.shutdown + fi + fi + #=================== # stop the default daemons echo_color 3 stopping daemons... custom_stop all - + #=================== + if [ "$LOCAL_SHUTDOWN" == "after" ]; then # load minirc.local.shutdown if [ -x /etc/minirc.local.shutdown ]; then echo_color 3 loading /etc/minirc.local.shutdown... /etc/minirc.local.shutdown fi - + fi + #=================== # shut down udev echo_color 3 shutting down udev...