Added generic "script" infrastructre
Kyle Sheumaker [Tue, 7 Feb 2012 21:07:15 +0000 (15:07 -0600)]
etc/script/startup.sh [new file with mode: 0755]
scripts/.keep [new file with mode: 0644]

diff --git a/etc/script/startup.sh b/etc/script/startup.sh
new file mode 100755 (executable)
index 0000000..8068bad
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/ash -l
+
+. /etc/library.sh
+. /tmp/cmdline.dat
+
+header "Starting scripts"
+
+if [ "${_nfs}" == "" ]
+then
+       msg -n "You must specify an 'nfs' server on the command line"
+       fail_msg
+       return 1
+fi
+
+if [ "${_scripts}" == "" ]
+then
+       msg -n "You must specify an 'scripts' directory on the command line"
+       fail_msg 
+       return 1
+
+fi
+
+msg -n "Attempting mount of '${_nfs}' to /scripts"
+mount -t nfs -o nolock ${_nfs} /scripts/       
+if [ "$?" != 0 ]
+then
+       fail_msg
+       return 1
+else
+       ok_msg
+fi
+
+SCRIPT_PATH="/scripts/${_scripts}"
+
+header "Executing scripts in '${_scripts}'"
+
+for i in `ls ${SCRIPT_PATH}`
+do
+       if [ -x "${SCRIPT_PATH}/${i}" ]
+       then
+               msg -n "Executing ${i}"
+               ok_msg
+               CURDIR=`pwd`
+               cd ${SCRIPT_PATH}
+               ./${i}
+               cd ${CURDIR}
+       else
+               msg -n "Skipping ${i} not set to be executable"
+               fail_msg
+       fi
+done
diff --git a/scripts/.keep b/scripts/.keep
new file mode 100644 (file)
index 0000000..e69de29