X-Git-Url: http://git.pld-linux.org/?p=packages%2Fem8300.git;a=blobdiff_plain;f=em8300.init;h=3235dbc187f7a24828ccd37f4f0e25ca971e63db;hp=ecc0c7d33f4b4f853e9b5dbdba7ba3af7e26ed48;hb=HEAD;hpb=cd464eeeb5ae72be051c188d3b08ae0e235103fb diff --git a/em8300.init b/em8300.init index ecc0c7d..3235dbc 100644 --- a/em8300.init +++ b/em8300.init @@ -1,10 +1,10 @@ #!/bin/sh # -# chkconfig: 2345 11 89 -# description: loads em8300 modules and uploads microcode +# chkconfig: 2345 11 89 +# description: loads em8300 modules and uploads microcode -if [ ! -f /etc/sysconfig/em8300 ] ; then - exit 0 +if [ ! -f /etc/sysconfig/em8300 ]; then + exit 0 fi # Source function library. @@ -12,27 +12,36 @@ fi . /etc/sysconfig/em8300 -load_module () { run_cmd "Loading module $1" modprobe "$*"; } +start() { + is_yes "$BT_LOAD" && _modprobe single bt865 $BT_OPT + _modprobe single adv717x $ADV_OPT + _modprobe single em8300 $EM_OPT + run_cmd "Uploading em8300 microcode" "sh -c 'em8300setup 2>/dev/null'" + [ $? -ne 0 ] && RETVAL=1 +} +stop() { + run_cmd "Removing em8300 modules" "sh -c 'rmmod em8300 adv717x bt865 2>/dev/null'" +} + +RETVAL=0 # See how we were called. case "$1" in - start) - is_yes "$BT_LOAD" && load_module bt865 $BT_OPT - load_module adv717x $ADV_OPT - load_module em8300 $EM_OPT - run_cmd "Uploading em8300 microcode" "sh -c 'em8300_microcode_upload 2>/dev/null'" + start|reload|force-reload) + start ;; stop) - run_cmd "Removing em8300 modules" "sh -c 'rmmod em8300 adv717x bt865 2>/dev/null'" + stop + ;; + status) ;; restart) - $0 stop - $0 start + stop + start ;; *) - msg_usage "$0 {start|stop|restart}" - exit 1 + msg_usage "$0 {start|stop|restart|reload|force-reload|status}" + exit 3 esac -exit 0 - +exit $RETVAL