#!/bin/sh
# JTG-Team-Image start_neutrino v1.03 # 07.03.2006

/bin/sectionsd
/bin/timerd

######################### Ab hier wurde eingefgt

if [ -e /var/etc/.start_ide ] ; then
	if [ -e /var/etc/.autocheck_hdd ] ; then
		if [ -e /var/etc/fsck.log ] ; then
			msgbox size=26 title="Festplattencheck" popup=/var/etc/fsck.log timeout=10 &
		fi;
	fi;
fi;
######################### Bis hier wurde eingefgt

if [ -e /var/etc/.pmt_update ] ; then
 /bin/zapit -u
else
 /bin/zapit
fi;

if [ -x /var/bin/camd2 ]; then
 /var/bin/camd2
else
 if [ -e /var/bin/camd2 ]; then
  chmod +x /var/bin/camd2
  /var/bin/camd2
 else
  /bin/camd2
 fi;
fi;

if [ -e /var/etc/.kb2rcd ]; then
 if [ -x /var/bin/kb2rcd ]; then
 /var/bin/kb2rcd
else
 /bin/kb2rcd
 fi;
fi;

/bin/controld
/bin/nhttpd
/bin/neutrino -u -f

pzapit -kill

######################### Ab hier wurde eingefgt

if [ ! -f /tmp/.reboot ] ; then
	touch /tmp/.halt
fi;

sleep 1

if [ -e /var/etc/.start_ide ] ; then
	if [ -e /var/etc/.autocheck_hdd ] ; then
		sleep 10 && rcsim KEY_OK &
		/var/tuxbox/plugins/hddcheck2.sh
	fi;
fi;

######################### Bis hier wurde eingefgt

i=5
while expr $i != 0 > /dev/null; do
 if pidof controld > /dev/null; then echo "Waiting for controld (max. $i seconds)"
 elif pidof timerd > /dev/null; then echo "Waiting for timerd (max. $i seconds)"
 elif pidof zapit > /dev/null; then echo "Waiting for zapit (max. $i seconds)"
 else break;
 fi
 i=`expr $i - 1`
 sleep 1
done

if [ -e /tmp/.reboot ] ; then
 /sbin/reboot
else
 echo "Going to halt system now ..."
 /sbin/halt
fi;

exit 0
