#!/bin/bash echo echo "-----------------------------------------------------------------------------------------------------" echo "WARNING: This script will clear enviroment variables on older Speeports without EVA Bootloader!!!!!" echo "If this is the case you need to add some individual variables into this skript at the marked position" echo "-----------------------------------------------------------------------------------------------------" echo . incl_var ETHLIST=" eth0 eth1 eth2 eth3" if [ $ETH_IF ]; then ETHLIST="$ETH_IF" echo "Net cards set up for search active netconnections: $ETHLIST" else echo "Net cards set up for search active netconnections: $ETHLIST" echo "This list was set default, but can be set in advance." fi for ETH in ${ETHLIST} ; do if ifconfig $ETH > /dev/null ; then echo "Ethernet card found on: $ETH" break fi done ifconfig $ETH down ifconfig $ETH netmask 255.255.0.0 -promisc up echo echo "You should now turn off and on your box and then, when the Power LED" echo "of your box is flashing the first time, press ENTER here on the PC..." echo "The right time for pushing the ENTER Key is critical, maybe you" echo "must repeat the starting of this script several times until you" echo "get a positive answer!" echo while !(read -s);do sleep 1 done #ping to Broadcast of running router can show router IP, but not ADAMs IP #ping 192.168.178.255 -b -w 1 #ping 192.168.2.255 -b -w 1 exec 2>"/dev/null" #cant be used becaus to much delay when finshed. #while [ `ping -c1 -w0 -b 192.168.178.255 | grep 'receive' | awk '{ print $4 }'` == "1" ] || [ `ping -c1 -w0 -b 192.168.2.255 | grep 'receive' | awk '{ print $4 }'` == "1" ]; do #echo -n "-" #sleep 0 #done #ifconfig $ETH netmask 255.255.0.0 -promisc up #while [ `ping -c1 -w1 -b 192.168.178.255 | grep 'receive' | awk '{ print $4 }'` == "0" ]; do #echo -n "." #done echo echo "Be patient, nmap will take some time to scan possible IPs ..." mapresult=`nmap --send-eth -oG log -PE -n -p21 192.168.178.1 192.168.2.1 192.168.1.1 192.168.1-101.1` echo #echo "${mapresult}" if ! [ `echo "${mapresult}" | grep 'open' | awk '{ print $2 }'` == "open" ]; then echo "--------------- Could NOT find open FTP Port! -----------------" sleep 8 exit 0 fi IPADDRESS=`echo "${mapresult}" | grep '192.168.'` IPADDRESS=${IPADDRESS##*on } IPADDRESS=${IPADDRESS%%.1:*} echo "IPaddress: ${IPADDRESS}.1" echo "${mapresult}" | grep 'open' ifconfig $ETH add ${IPADDRESS}.10 touch empty export IPADDRESS="${IPADDRESS}.1" sleep 10 echo "You should now reboot your box again!. Waiting for box to shut down for restart ..." while eval "ping -c1 -w1 ${IPADDRESS} > /dev/null"; do echo -n "." sleep 0.2 done while ! eval "ping -c1 -w1 ${IPADDRESS} > /dev/null"; do echo -n "." sleep 0.2 done echo "." echo "Reset Environment..." ftp -n -p <