#!/bin/sh #start.local,v 1.08-1 2006/11/13 16:14 fernsehass # -----------------Pfad zu insmod und den Modules festlegen------------------- export IM="/sbin/insmod" export MD="/lib/modules/"$(uname -r)"/misc" # ------------------------------ sportster.conf ------------------------------ SPORTSTER_CONF="/var/tuxbox/config/sportster.conf" CHILDPROOF=`grep "^CHILDPROOF=" $SPORTSTER_CONF | cut -d '=' -f 2` START_STANDBY=`grep "^START_STANDBY=" $SPORTSTER_CONF | cut -d '=' -f 2` START_ANI=`grep "^START_ANI=" $SPORTSTER_CONF | cut -d '=' -f 2` PINGER=`grep "^PINGER=" $SPORTSTER_CONF | cut -d '=' -f 2` CROND=`grep "^CROND=" $SPORTSTER_CONF | cut -d '=' -f 2` SYSLOGD=`grep "^SYSLOGD=" $SPORTSTER_CONF | cut -d '=' -f 2` AUTOMOUNT=`grep "^AUTOMOUNT=" $SPORTSTER_CONF | cut -d '=' -f 2` KEYBOARD=`grep "^KEYBOARD=" $SPORTSTER_CONF | cut -d '=' -f 2` RAMDEFRAG=`grep "^RAMDEFRAG=" $SPORTSTER_CONF | cut -d '=' -f 2` LOGOLOAD=`grep "^LOGOLOAD=" $SPORTSTER_CONF | cut -d '=' -f 2` LOGOMOUNT=`grep "^LOGOMOUNT=" $SPORTSTER_CONF | cut -d '=' -f 2` SDMMC=`grep "^SDMMC=" $SPORTSTER_CONF | cut -d '=' -f 2` # ----------------------------- sectionsd.conf ------------------------------- SECTIONSD_CONF="/var/tuxbox/config/sectionsd.conf" #-----------------------------Passwortabfrage--------------------------------- if [ $CHILDPROOF -eq 1 ]; then /var/bin/lcdmenu fi # ----------------------------Animation starten-------------------------------------- if [ $START_ANI -eq 1 ] ; then /var/bin/aniplay /var/bin/animation.ani & ( sleep 40 ; killall -9 aniplay ) & fi . /etc/profile if grep -q "^ntp=0" $SECTIONSD_CONF; then date -s 010101001970 fi if grep -q "^ntp=1" $SECTIONSD_CONF; then date -s 010101001970 fi #------------------------------Zapit optionen---------------------------------------- if [ -e /var/etc/.start ] ; then ZAPIT="-a -r" fi; if [ -e /var/etc/.pmt_update ] ; then ZAPIT="-u "$ZAPIT fi; if [ -e /var/etc/.nobouquets ] ; then ZAPIT="-sb "$ZAPIT fi AVIA_CONF="/var/tuxbox/config/avia.conf" if grep -q "^enx_reset=1" $AVIA_CONF; then ZAPIT="-enx "$ZAPIT fi #------------------------------Zapit start------------------------------------------- if [ -e /var/bin/zapit ] ; then echo "############## Experimentelle zapit aktiv! ##############" chmod +x /var/bin/zapit /var/bin/zapit $ZAPIT else zapit $ZAPIT fi # -------------------------------Sectionsd starten----------------------------------- if [ -e /var/bin/sectionsd ] ; then echo "############ Experimentelle sectionsd aktiv! ############" chmod +x /var/bin/sectionsd /var/bin/sectionsd else sectionsd fi # --------------------------------Timerdd starten------------------------------------ timerd # --------------------------Sectionsd priorität herabsetzen-------------------------- #sleep 2 #renice 15 `pidof sectionsd` # --------------------------------Controld starten----------------------------------- controld #--------------------------Webinterface starten(evtl.alternatives)------------------- if [ -e /var/bin/nhttpd ] ; then echo "########## Experimentelles Webinterface aktiv! ##########" /var/bin/nhttpd else nhttpd fi #----------------------------cardserver+multicam start hier--------------------------- #$IM -f $MD/camd-cardserver.o $IM -f $MD/multicam.o if lsmod | grep multicam > /dev/null; then echo "############## Multicam-Treiber geladen #################" else echo "######### Multicam-Treiber laden gescheitert ############" fi # -----------------------------sd-mmc geschichte-------------------------------------- #if [ ! $SDMMC -eq 0 ] ; then # /var/etc/init.d/sdmmc.local #fi #-------------------------------- Friedel MC Frequenz ------------------------------------- if ls -a1 /var/etc/ | grep -q "^.freq[0-9]\{4\}$" || ls -a1 /var/etc/ | grep -q "^.sw[0-9]\{1\}$"; then $IM -f $MD/pcf8574.o if [ -e /var/etc/.freq3573 ]; then #echo "schalte Friedel MC auf 3.57MHz..." echo "0" > /proc/friedelMC/pcffreq elif [ -e /var/etc/.freq3686 ]; then #echo "schalte Friedel MC auf 3.68MHz..." echo "1" > /proc/friedelMC/pcffreq elif [ -e /var/etc/.freq6000 ]; then #echo "schalte Friedel MC auf 6.00MHz..." echo "2" > /proc/friedelMC/pcffreq fi #-------------------------------- Friedel MC Schaltausgänge ------------------------------- j=1 while [ $j -le 5 ]; do if [ -e /var/etc/.sw$j ] ; then #echo "aktiviere Schaltausgang $j" echo "1" > /proc/friedelMC/sw$j fi j=`expr $j + 1` done fi #-----------------------------------EMU-Start-------------------------------------- /var/bin/sportster startemu noGUI #--------------------------------Start Standby------------------------------------- if [ $START_STANDBY -eq 1 ] ; then ( sleep 15 ; rcsim KEY_POWER ) & fi #--------------------------------Pinger Start-------------------------------------- if [ $PINGER -eq 1 ] ; then /var/bin/pinger & fi #--------------------------------crond Start--------------------------------------- if [ $CROND -eq 1 ] ; then crond & fi # --------------------------------kb2rcd starten------------------------------------- if [ $KEYBOARD -eq 1 ] ; then if [ $SYSLOGD -eq 1 ]; then kb2rcd -syslog & echo "################ syslog keyb2rc aktiv! ##################" else kb2rcd & echo "################### keyb2rc geladen #####################" fi fi # ---------------------tuxmail-Daemon starten--------------------------------- if [ -e /var/etc/.tuxmaild ]; then if [ $SYSLOGD -eq 1 ]; then /var/bin/tuxmaild -syslog & echo "################# syslog tuxmaild aktiv! ################" else /var/bin/tuxmaild & echo "################### tuxmaild geladen ####################" fi fi # ---------------------tuxcal-Daemon starten--------------------------------- if [ -e /var/etc/.tuxcald ]; then if [ $SYSLOGD -eq 1 ]; then /var/bin/tuxcald -syslog & echo "################# syslog tuxcald aktiv! #################" else /var/bin/tuxcald & echo "#################### tuxcald geladen ####################" fi fi # ------------------------tuxdns-Daemon starten------------------------------- if [ -e /var/tuxbox/config/tuxdns.conf ]; then tuxdns & fi # ----------------------supdaterd starten------------------------------------ if [ -e /var/etc/.update ] ; then if [ $SYSLOGD -eq 1 ]; then echo "################# syslog supdaterd aktiv! ###############" supdaterd -syslog & else supdaterd & echo "#################### supdaterd geladen ##################" fi fi # ---------------------- fritzbox callmonitor --------------------------------- if [ -e /var/bin/fritzboxcallmon ]; then fritzboxcallmon fi if [ -e /var/tuxbox/plugins/verpasst.sh ]; then ( sleep 180 ; /var/tuxbox/plugins/verpasst.sh ) & fi #--------------------------automounter geschichte--------------------------------- DEBUG="-d" VERBOSE="-v" GHOSTMODE="-g" PIDFILE="/tmp/automounter.pid" MOUNTDIR="/mnt" MAPFILE="/var/etc/auto.net" if [ $AUTOMOUNT -eq 1 ]; then echo "################# Automounter geladen ###################" /sbin/automount $DEBUG $VERBOSE $GHOSTMODE -p $PIDFILE $MOUNTDIR file $MAPFILE fi #--------------------------------RAM Defrag nach start------------------------------- if [ $RAMDEFRAG -eq 1 ]; then ( sleep 180 ; /var/tuxbox/plugins/ramfree.sh ) & fi #---------------------------------TVTV syncronisation-------------------------------- if [ -e /var/bin/tvtvsync ]; then ( sleep 120 ; tvtvsync -u user -p password -f -i 15 ) & fi # ------------------------------ Samba Daemons starten ---------------------------- if [ -e /var/etc/.samba ]; then if [ -e /var/bin/nmbd ]; then /var/bin/nmbd -D & fi if [ -e /var/bin/smbd ]; then /var/bin/smbd -D & fi echo "################# Samba Daemon gestartet #############" fi #--------------------------------Start Neutrino------------------------------------- if [ -e /tmp/neutrino ] ; then echo "############## Experimentelle neutrino aktiv! ###########" if [ -e /var/share/fonts/micron.ttf ] ; then chmod +x /tmp/neutrino /tmp/neutrino -u -f --font Micron 0 /var/share/fonts/micron.ttf /var/share/fonts/micron_bold.ttf /var/share/fonts/micron_italic.ttf else chmod +x /tmp/neutrino /tmp/neutrino -u -f fi else if [ -e /var/share/fonts/micron.ttf ] ; then until neutrino -u -f --font Micron 0 /var/share/fonts/micron.ttf /var/share/fonts/micron_bold.ttf /var/share/fonts/micron_italic.ttf ; do echo "Irregular neutrino shutdown -- restarting..." pidof sectionsd >/dev/null || sectionsd pidof timerd >/dev/null || timerd pidof zapit >/dev/null || zapit pidof controld >/dev/null || controld pidof nhttpd >/dev/null || nhttpd done else until neutrino -u -f ; do echo "Irregular neutrino shutdown -- restarting..." pidof sectionsd >/dev/null || sectionsd pidof timerd >/dev/null || timerd pidof zapit >/dev/null || zapit pidof controld >/dev/null || controld pidof nhttpd >/dev/null || nhttpd done fi fi #---Ab hier wird alles beim shutdown abgearbeitet----------------------------------- #--------------------- heruntergeladene Logos abspeichern --------------------- if [ $LOGOLOAD -eq 1 ] ; then echo "############## Logos werden gesichert! ###########" mv -f /var/tmp/sysup/*.raw $LOGOMOUNT fi #--------------------------------logcsd speichern----------------------------------- if pidof logcsd > /dev/null; then killall logcsd fi #-----------------------------------Daemons beenden------------------------------- if [ -e /var/tmp/tuxmaild.pid ]; then kill -TERM $(pidof tuxmaild) echo "################### tuxmaild beendet! #################" fi if [ -e /var/tuxbox/config/tuxdns.conf ]; then killall tuxdns echo "#################### tuxdns beendet! ##################" fi if [ -e /var/tmp/tuxcald.pid ]; then kill -TERM $(pidof tuxcald) echo "#################### tuxcald beendet! #################" fi if [ -e /var/tmp/supdaterd.pid ]; then kill -TERM $(pidof supdaterd) echo "#################### supdaterd beendet! ###############" fi if [ -e /var/tmp/automount.pid ]; then kill -TERM $(pidof automount) echo "################## automounter beendet! ##############" fi if [ -e /var/tmp/fritzboxcallmon.pid ]; then kill -TERM $(pidof fritzboxcallmon) echo "############### fritzboxcallmon beendet! ##############" fi if [ -e /var/tmp/kb2rcd.pid ] ; then kill -TERM $(pidof kb2rcd) echo "############### keyboarddaemon beendet! #############" fi if [ -e /var/etc/.samba ]; then killall smbd killall nmbd echo "############### sambaserver/client beendet! ###########" fi #-----------------------------------EMU-ENDE-------------------------------------- /var/bin/sportster emuShutDown #--------warte max 50 sec, damit zapit die currentservices.xml schreiben kann----------- pzapit -kill i=50 while expr $i != 0 > /dev/null do if pidof zapit > /dev/null; then echo "Waiting for zapit (max. $i seconds)" else break; fi i=`expr $i - 1` sleep 1 done #-------------------------------------controld------------------------------------------ VENDOR_ID=`/bin/tuxinfo -v` if [ $VENDOR_ID -eq 2 ]; then # Philips/Sat switch -rv 3 3 -rv 2 2 -ra 3 2 -v 0 -fnc 0 else switch -fnc 0 -fblk 0 fi; sleep 5 #------------------------------das geht schneller :)---------------------------------- i=10 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)" else break; fi i=`expr $i - 1` sleep 1 done # ----------------------- Friedel Schaltausgäge abschaltem ------------------------- j=1 while [ $j -le 5 ]; do if [ -e /var/etc/.sw$j ] ; then echo "0" > /proc/friedelMC/sw$j fi j=`expr $j + 1` done if [ -e /tmp/.nohalt ] ; then killall -q sectionsd killall -q timerd killall -q zapit killall -q controld killall -q nhttpd saa --fbas switch -fnc 0 -fblk 0 echo "Neutrino und seine daemons beendet!" exit fi # ------------------ Entmounten der gemounteten verzeichnisse ------------------------ /var/etc/init.d/unmount # ------------------------------------- RTC abspeichern ------------------------------------ if grep -q "^ntp=2" $SECTIONSD_CONF; then /var/bin/hwrtc systohw fi # ------------------------ Reboot oder shutdown -------------------------------------- if [ -e /tmp/.reboot ] ; then reboot else halt fi