mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
51 lines
1.1 KiB
Text
51 lines
1.1 KiB
Text
|
#!/bin/bash
|
||
|
|
||
|
MARTIAN_TTY=
|
||
|
MARTIAN_USER=
|
||
|
MARTIAN_GROUP=
|
||
|
MARTIAN_COUNTRY=
|
||
|
[ -f /etc/conf.d/martian ] && . /etc/conf.d/martian
|
||
|
|
||
|
. /etc/rc.conf
|
||
|
. /etc/rc.d/functions
|
||
|
|
||
|
PIDFILE="/var/run/martian.pid"
|
||
|
PID=`pidof -o %PPID /usr/sbin/martian_modem`
|
||
|
|
||
|
case "$1" in
|
||
|
start)
|
||
|
stat_busy "Starting Martian Drivers"
|
||
|
[ -z "$PID" ] && martian_modem --daemon \
|
||
|
${MARTIAN_USER:+--user=${MARTIAN_USER}} \
|
||
|
${MARTIAN_GROUP:+--group=${MARTIAN_GROUP}} \
|
||
|
${MARTIAN_COUNTRY:+--country=${MARTIAN_COUNTRY}} \
|
||
|
${MARTIAN_TTY:+${MARTIAN_TTY}} &>/dev/null &
|
||
|
if [ $? -gt 0 ]; then
|
||
|
stat_fail
|
||
|
else
|
||
|
pidof -o %PPID /usr/sbin/martian_modem > "$PIDFILE"
|
||
|
add_daemon martian
|
||
|
stat_done
|
||
|
fi
|
||
|
;;
|
||
|
stop)
|
||
|
stat_busy "Stopping Martian Drivers"
|
||
|
[ -f "$PIDFILE" ] && kill `cat $PIDFILE` &> /dev/null
|
||
|
if [ $? -gt 0 ]; then
|
||
|
stat_fail
|
||
|
else
|
||
|
rm -f "$PIDFILE" &> /dev/null
|
||
|
rm_daemon martian
|
||
|
stat_done
|
||
|
fi
|
||
|
;;
|
||
|
restart)
|
||
|
$0 stop
|
||
|
sleep 1
|
||
|
$0 start
|
||
|
;;
|
||
|
*)
|
||
|
echo "Usage $0 {start|stop|restart}"
|
||
|
;;
|
||
|
esac
|