Browse Source

- re-unify start_neutrino script

master
vanhofen 4 years ago
parent
commit
5b68b54fcc
  1. 2
      make/target-neutrino.mk
  2. 22
      package/neutrino/files/start_neutrino
  3. 68
      package/neutrino/files/start_neutrino.coolstream
  4. 2
      package/sysvinit/files/rcS-vuplus
  5. 16
      skel-root/general/scripts/init.functions

2
make/target-neutrino.mk

@ -189,7 +189,7 @@ $(NEUTRINO_BUILD_DIR)/config.status: $(NEUTRINO_DEPENDENCIES)
neutrino: $(NEUTRINO_BUILD_DIR)/config.status
$(MAKE) -C $(NEUTRINO_BUILD_DIR)
$(MAKE) -C $(NEUTRINO_BUILD_DIR) install DESTDIR=$(NEUTRINO_INST_DIR)
$(INSTALL_EXEC) $(PKG_FILES_DIR)/start_neutrino.$(BOXTYPE) $(TARGET_sysconfdir)/init.d/start_neutrino
$(INSTALL_EXEC) $(PKG_FILES_DIR)/start_neutrino $(TARGET_sysconfdir)/init.d/start_neutrino
$(TOUCH)
# -----------------------------------------------------------------------------

22
package/neutrino/files/start_neutrino.armbox → package/neutrino/files/start_neutrino

@ -9,11 +9,15 @@ NORMAL=0
SHUTDOWN=1
REBOOT=2
# uncomment for gstreamer debugging
#export GST_DEBUG=4
# if neutrino crashes, just restart it or reboot the box?
REBOOT_ON_ERROR=false
case "$(get_boxmodel)" in
nevis|apollo|shiner|kronos|kronos_v2)
REBOOT_ON_ERROR=true
;;
*)
REBOOT_ON_ERROR=false
;;
esac
do_cleanup() {
# remove files created by neutrino
@ -21,12 +25,12 @@ do_cleanup() {
}
do_shutdown() {
display_msg "Shutdown ..."
display_msg "N: SHUTDOWN"
poweroff
}
do_reboot() {
display_msg "Reboot ..."
display_msg "N: REBOOT"
reboot
}
@ -53,10 +57,10 @@ while true; do
break
fi
display_msg "Neutrino: $RET"
display_msg "NEUTRINO: $RET"
# report errors on external display
if [ -e /tmp/.lcd-* ]; then
if [ -e /tmp/.lcd-* -a -e /tmp/lcd ]; then
echo "0" > /tmp/lcd/mode_logo
echo "Neutrino" > /tmp/lcd/service
echo "Error: $RET" > /tmp/lcd/event
@ -68,5 +72,5 @@ while true; do
break
fi
LOGINFO "Restarting neutrino after exit code $RET"
LOGINFO "Restarting Neutrino after exit code $RET"
done

68
package/neutrino/files/start_neutrino.coolstream

@ -1,68 +0,0 @@
#!/bin/sh
. /etc/init.d/globals
# Neutrino's exit codes
ERROR=-1
NORMAL=0
SHUTDOWN=1
REBOOT=2
# if neutrino crashes, just restart it or reboot the box?
REBOOT_ON_ERROR=true
do_cleanup() {
# remove files created by neutrino
rm -f /tmp/.timer
}
do_shutdown() {
dt -t"SHUTDOWN"
poweroff
}
do_reboot() {
dt -t"REBOOT"
reboot
}
while true; do
do_cleanup
if [ -e /var/etc/.coredump ]; then
# unlimit core file size
ulimit -c unlimited
fi
neutrino; RET=$?
LOGINFO "Neutrino exited with exit code $RET"
if [ $RET -eq $NORMAL ]; then
# do nothing
break
elif [ $RET -eq $SHUTDOWN ]; then
do_shutdown
break
elif [ $RET -eq $REBOOT ]; then
do_cleanup
do_reboot
break
fi
dt -t"NEUTRINO: $RET"
# report errors on external display
if [ -e /tmp/.lcd-* ]; then
echo "0" > /tmp/lcd/mode_logo
echo "Neutrino" > /tmp/lcd/service
echo "Error: $RET" > /tmp/lcd/event
fi
if $REBOOT_ON_ERROR; then
LOGINFO "Rebooting due to REBOOT_ON_ERROR=true and exit code $RET"
do_reboot
break
fi
LOGINFO "Restarting neutrino after exit code $RET"
done

2
package/sysvinit/files/rcS-vuplus

@ -83,7 +83,7 @@ service ntpdate start
# say hi to everyone
oled -b 5
oled -tc "Booting... NI"
display_msg "Booting... NI"
# trap CTRL-C only in this shell so we can interrupt subprocesses
trap ":" INT QUIT TSTP

16
skel-root/general/scripts/init.functions

@ -88,9 +88,19 @@ get_boxmodel()
display_msg()
{
msg="$*"
if [ -e /dev/dbox/oled0 ]; then
echo "${msg}" > /dev/dbox/oled0
fi
case "$(get_boxmodel)" in
nevis|apollo|shiner|kronos|kronos_v2)
dt -t "${msg}"
;;
hd51|bre2ze4k|h7|hd60|hd61|multiboxse)
if [ -e /dev/dbox/oled0 ]; then
echo "${msg}" > /dev/dbox/oled0
fi
;;
solo4k|duo4k|duo4kse|ultimo4k|zero4k|uno4k|uno4kse)
oled -tc "${msg}"
;;
esac
}
get_setting()

Loading…
Cancel
Save