From 55faf0c143bdaeb0bcd6025607f9d326079033e6 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 7 Dec 2017 12:16:08 +0100 Subject: [PATCH] autorun.sh: align to neutrino's exit codes Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a88019dc69f2699a5d3b3f8851f9e3fc9c198380 Author: vanhofen Date: 2017-12-07 (Thu, 07 Dec 2017) Origin message was: ------------------ - autorun.sh: align to neutrino's exit codes ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- autorun.sh | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/autorun.sh b/autorun.sh index d0b799034..b20ef463d 100755 --- a/autorun.sh +++ b/autorun.sh @@ -1,19 +1,31 @@ -export LD_LIBRARY_PATH=/var/lib +#!/bin/sh + export PATH=${PATH}:/var/bin:/var/plugins -echo "### Starting NEUTRINO ###" +# Neutrino's exit codes +ERROR=-1 +NORMAL=0 +SHUTDOWN=1 +REBOOT=2 + +echo "Starting Neutrino" cd /tmp -/bin/neutrino > /dev/null 2> /dev/null +/bin/neutrino >/dev/null 2>&1; RET=$? +sync -/bin/sync -/bin/sync +echo "Neutrino exited with exit code $RET" -if [ -e /tmp/.reboot ] ; then - /bin/dt -t"Rebooting..." - /sbin/reboot -f +if [ $RET -eq $NORMAL ]; then + # do nothing +elif [ $RET -eq $SHUTDOWN ]; then + dt -t"Shutdown ..." + poweroff +elif [ $RET -eq $REBOOT ]; then + dt -t"Reboot ..." + reboot else - /bin/dt -t"Panic..." - sleep 5 - /sbin/reboot -f + dt -t"Panic ..." + sleep 5 + reboot -f fi