sys-apps/micro-evtd: correct system detect

(Portage version: 2.2.0_alpha78/git/Linux x86_64, unsigned Manifest commit)
This commit is contained in:
Mario Fetka
2011-12-21 21:18:46 +01:00
parent df335ea69a
commit 48d86b63b3
5 changed files with 46 additions and 71 deletions

View File

@@ -1,58 +0,0 @@
#!/bin/sh
# Wrapper script for micro-evtd to execute single commands.
DAEMON_BASE=/usr/sbin/micro-evtd
MICROAPL="/usr/sbin/microapl -a"
PIDFILE=/var/run/micro-evtd.pid
# Test if device is supported
machine=`sed -n '/Hardware/ {s/^Hardware\s*:\s//;p}' /proc/cpuinfo`
case $machine in
"Buffalo Linkstation Pro/Live" | "Buffalo/Revogear Kurobox Pro")
DAEMON=$DAEMON_BASE.pro ;;
*)
DAEMON=$DAEMON_BASE.tera ;;
esac
micro-evtd_start() {
$DAEMON >/dev/null # daemon forks on its own
# Allow time to startup
sleep 1
pid=$(cat $PIDFILE)
if [ "$pid" ]; then
echo $pid
return 0
fi
return 1
}
# Execute commands here
case "$1" in
finish)
$MICROAPL led_set_blink power
$MICROAPL led_set_code_information 15
;;
init)
$MICROAPL led_set_blink 0
$MICROAPL bz_melody 30 b4 || true
;;
start)
# Start micro-evtd if not already running, exit with failure
# if start failed
[ -n "$(pidof micro-evtd)" ] || micro-evtd_start || exit 1
;;
startup)
$MICROAPL led_set_blink power
;;
stop)
kill -TERM $(cat $PIDFILE)
rm -f $PIDFILE
;;
*)
$DAEMON "$@"
;;
esac
exit 0

View File

@@ -6,20 +6,47 @@
description="Linkstation/Kurobox/Terastation micro controller daemon"
depend() {
need localmount
use logger
need localmount
use logger
}
start() {
# micro_evtd doesn't start properly from s-s-d, need to investigate
ebegin "Starting ${description}"
#start-stop-daemon --start --exec /usr/sbin/micro-evtd
/usr/sbin/micro-evtd
eend $?
# micro_evtd doesn't start properly from s-s-d, need to investigate
ebegin "Starting ${description}"
device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
head -n1 | sed "s/^[^:]*: //")
case $device in
"Buffalo Linkstation Pro/Live" | "Buffalo/Revogear Kurobox Pro")
deamon=micro-evtd.pro
;;
"Buffalo TeraStation Pro/Live" )
deamon=micro-evtd.tera
;;
*)
eerror "micro-evtd error: device is not supported"
;;
esac
#start-stop-daemon --start --exec /usr/sbin/micro-evtd
/usr/sbin/$deamon
eend $?
}
stop() {
ebegin "Stopping ${description}"
start-stop-daemon --stop --exec /usr/sbin/micro-evtd
device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
head -n1 | sed "s/^[^:]*: //")
case $device in
"Buffalo Linkstation Pro/Live" | "Buffalo/Revogear Kurobox Pro")
deamon=micro-evtd.pro
;;
"Buffalo TeraStation Pro/Live" )
deamon=micro-evtd.tera
;;
*)
eerror "micro-evtd error: device is not supported"
;;
esac
start-stop-daemon --stop --exec /usr/sbin/$deamon
eend $?
}