#!/bin/sh -e # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Adaptions for coLinux (speedlinux). [ -e /etc/udev/rules.d/75-persistent-net-generator.rules ] && sed -i -e 's/eth..//' "/etc/udev/rules.d/75-persistent-net-generator.rules" [ -e /etc/udev/rules.d/70-persistent-net.rules ] && rm -f "/etc/udev/rules.d/70-persistent-net.rules" DISPLAY= ADR= ETH0_ADR= ETH0_MASK= ETH0_GW= ETH0_DHCP= ETH1_ADR= ETH1_MASK= ETH1_GW= ETH1_DHCP= ETH2_ADR= ETH2_MASK= ETH2_GW= ETH2_DHCP= SHOW_IF= for i in `cat /proc/cmdline` ; do case $i in DISPLAY=*) DISPLAY_IP_ARRAY="${i#*=}" ;; ETH0_ADR=*) ETH0_ADR="address ${i#*=}" ;; ETH0_MASK=*) ETH0_MASK="netmask ${i#*=}" ;; ETH0_GW=*) ETH0_GW="gateway ${i#*=}" ;; ETH0_DHCP=*) ETH0_DHCP="${i#*=}" ;; ETH1_ADR=*) ETH1_ADR="address ${i#*=}" ;; ETH1_MASK=*) ETH1_MASK="netmask ${i#*=}" ;; ETH1_GW=*) ETH1_GW="gateway ${i#*=}" ;; ETH1_DHCP=*) ETH1_DHCP="${i#*=}" ;; ETH2_ADR=*) ETH2_ADR="address ${i#*=}" ;; ETH2_MASK=*) ETH2_MASK="netmask ${i#*=}" ;; ETH2_GW=*) ETH2_GW="gateway ${i#*=}" ;; ETH2_DHCP=*) ETH2_DHCP="${i#*=}" ;; SHOW_IF=*) SHOW_IF="${i#*=}" ;; *) ;; esac done ifdown -a cat < /etc/network/interfaces # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. #------------------------------------------------------ # Dont edit - edit [wininstalldir]/settings.txt instead #------------------------------------------------------ auto lo iface lo inet loopback EOF ! [ -z "$ETH0_DHCP" ] && cat <> /etc/network/interfaces auto eth0 iface eth0 inet dhcp EOF ! [ -z "$ETH1_DHCP" ] && cat <> /etc/network/interfaces auto eth1 iface eth1 inet dhcp EOF ! [ -z "$ETH2_DHCP" ] && cat <> /etc/network/interfaces auto eth2 iface eth2 inet dhcp EOF ! [ -z "$ETH0_ADR" ] && cat <> /etc/network/interfaces auto eth0 iface eth0 inet static ${ETH0_ADR} ${ETH0_MASK} ${ETH0_GW} EOF ! [ -z "$ETH1_ADR" ] && cat <> /etc/network/interfaces auto eth1 iface eth1 inet static ${ETH1_ADR} ${ETH1_MASK} ${ETH1_GW} EOF ! [ -z "$ETH2_ADR" ] && cat <> /etc/network/interfaces auto eth2 iface eth2 inet static ${ETH2_ADR} ${ETH2_MASK} ${ETH2_GW} EOF #------------------------------------------------------------------------------------------------- # mounts /etc/mount_all #------------------------------------------------------------------------------------------------- . /usr/local/sbin/firstboot.sh echo " * Restarting networking ..." ifup -a 2> /var/log/if.log >> /var/log/if.log cat /var/log/if.log | grep -q eth && iferror="y" [ $iferror ] && echo "-----------------------------------------------------" if ! [ -z "$SHOW_IF" ] || [ $iferror ]; then echo " * interfaces:" cat /etc/network/interfaces | sed '/#/d' | sed '/lo /d' | sed '/auto /d' route if [ $iferror ]; then echo echo "-----------------------------------------------------" cat /var/log/if.log | grep eth echo echo "fix network settings on PC or/and within settings.txt" fi echo -n " Use 'Enter key' to continue!" read YESNO fi if ! [ -d /var/run/network ]; then mkdir -p /var/run/network/ && /etc/init.d/networking restart;fi #get instlalldir and displayip for i in `cat /mnt/and/firstboot.1.txt | sed 's| |_|g'` do case $i in installdir=*) INSTALLDIR=${i#*=} ;; displayip=*) D_IP=${i#*=} ;; *) ;; esac done echo " * Checking DISPLAY IP ..." if [ -x /usr/bin/fping ]; then exec 2> /var/log/if.log [ -z "$D_IP" ] || DISPLAY_TMP=`echo "$D_IP" | fping -a` [ -z "$DISPLAY_TMP" ] && DISPLAY_TMP=`echo "$DISPLAY_IP_ARRAY" | sed 's|,| |g' | fping -a` fi if [ -z "$DISPLAY_TMP" ]; then echo "Kernelparameter DISPLAY is missing! Set it via $INSTALLDIR/startup.bat or login with SSH and check the ip of host with command: 'set | grep SSH_CLIENT' Use the shown ip address and execute for example: 'DISPLAY=10.10.0.1:0.0 && terminal" DISPLAY_TMP=$D_IP fi echo " * Add set DISPLAY IP: $DISPLAY_TMP to /etc/profile ..." sleep 5 #echo Installdir: $INSTALLDIR #echo DISPLAY_IP: $DISPLAY_IP #echo DISPLAY_TMP: $DISPLAY_TMP sed -i -e "/ESPEAKER/d" -e "/PULSE_SERVER/d" -e "/DISPLAY/d" -e "/umask 022/d" -e "/# Don't/d" -e "/#-------/d" /etc/profile [ -f /etc/profile ] && cat <> /etc/profile #------------------------------------------------------------------------------ # Don't edit - edit $INSTALLDIR/fisrboot.1.txt instead #------------------------------------------------------------------------------ export ESPEAKER=${DISPLAY_TMP}:16001 export PULSE_SERVER=${DISPLAY_TMP} export DISPLAY=${DISPLAY_TMP}:0.0 umask 022 EOF # This is for andLinux KDE menu launcher [ -f /etc/inittab ] && grep -q 'startwindowsterminalsession' "/etc/inittab" && sed -i -e "/startwindowsterminalsession/d" "/etc/inittab" echo " * Start background termial session ..." [ -x /usr/bin/sux ] && /usr/bin/X11/startwindowsterminalsession & sleep 5 exit 0