initscript # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # Explicit paths specified without -i nor -o; assuming --only paths... # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached ..." to unstage) # # new file: add-ons/initscript # diff --git a/add-ons/initscript b/add-ons/initscript new file mode 100644 index 0000000..dae484b --- /dev/null +++ b/add-ons/initscript @@ -0,0 +1,48 @@ +#!/bin/bash + +. $(dirname $0)/functions + +option fast boolean_option 1 +option slow boolean_option 0 +option idle boolean_option 0 + +option led1 standard_option usage +option led2 standard_option eth0 eth1 eth2 +option led3 standard_option disk + +option bin reserved_option /usr/sbin/alix-leds +option pidfile reserved_option /var/run/alix-led.pid +option cmdline reserved_option '$bin -p $pidfile' + +function fct_end_section { + local led opt val + + [ "$opt_idle" -eq 1 ] && cmdline+=" -I" + + for led in ${!opt_led*} ; do + opt="${!led}" + + cmdline+=" -l ${led##*[[:alpha:]]}" + +# Report error: +# LED already assigned to non-running polling +# +# if [ "$opt_fast" -eq 1 ] ; then +# cmdline+=" -r" +# elif [ "$opt_slow" -eq 1 ] ; then +# cmdline+=" -R" +# fi + + for val in ${opt} ; do + case "${opt}" in + usage) cmdline+=" -u" ;; + disk) cmdline+=" -d" ;; + eth*) cmdline+=" -i ${val}" ;; + tun*) cmdline+=" -t ${val}" ;; + *) echo "Don't known what is ${val}" ; return 1 ;; + esac + done + done +} + +load_config