[Runnix-commits] SF.net SVN: runnix:[115] trunk/target/generic/target_skeleton/runnix
Status: Alpha
Brought to you by:
krisk84
From: <abe...@us...> - 2010-12-12 19:42:50
|
Revision: 115 http://runnix.svn.sourceforge.net/runnix/?rev=115&view=rev Author: abelbeck Date: 2010-12-12 19:42:43 +0000 (Sun, 12 Dec 2010) Log Message: ----------- More /runnix tweaks, rename 'dofail' command line option to 'doshell_ssh', better organize with functions Modified Paths: -------------- trunk/target/generic/target_skeleton/runnix Modified: trunk/target/generic/target_skeleton/runnix =================================================================== --- trunk/target/generic/target_skeleton/runnix 2010-12-12 16:36:57 UTC (rev 114) +++ trunk/target/generic/target_skeleton/runnix 2010-12-12 19:42:43 UTC (rev 115) @@ -11,11 +11,55 @@ DRIVES="hda hdb hdc hdd hde hdf hdg hdh sda sdb sdc sdd" -do_failure () { +setup_network () { + + if [ -z "$NDEV" -a -n "$1" ]; then + NDEV="$1" + fi + + #VLANS + for i in $VLANS; do + IF=`echo $i | cut -d. -f1` + VID=`echo $i | cut -d. -f2` + ifconfig $IF up + vconfig add $IF $VID > /dev/null + done + + if [ -n "$NDEV" ]; then + ifconfig lo up 127.0.0.1 + + if [ -n "$MAC" ]; then + ifconfig "$NDEV" hw ether "$MAC" + fi + + if [ "$IP" = "dhcp" ]; then + echo "Configuring $NDEV with DHCP..." + udhcpc -nq -s /etc/udhcpc.script -i "$NDEV" + else + ifconfig "$NDEV" inet "$IP" netmask "$NM" + route add -net default gw "$GW" + + for i in $DNS; do + echo "nameserver $i" >> /tmp/etc/resolv.conf + done + + fi + return 0 + fi + + return 1 +} + +setup_ssh () { + + if [ -z "$SSHPORT" -a -n "$1" ]; then + SSHPORT="$1" + fi + if [ -n "$SSHPORT" ]; then mount -t devpts devpts /dev/pts - echo "Generating keys" + echo "Generating keys..." dropbearkey -t rsa -f /tmp/rsa_key -s 1024 dropbearkey -t dss -f /tmp/dss_key -s 1024 @@ -35,10 +79,17 @@ touch /var/log/lastlog touch /var/log/wtmp - echo "Starting dropbear" + echo "Starting ssh..." dropbear -d /tmp/dss_key -r /tmp/rsa_key -E -P /tmp/dropbear.pid -p $SSHPORT fi + return 1 +} + +do_failure () { + + setup_ssh + do_shell } @@ -90,6 +141,7 @@ if [ -z "$DEVICE" ]; then echo "Runnix device not found" do_shell + # reboot fi # get image name @@ -106,47 +158,22 @@ fi if echo "$CMDLINE" | grep -q doshell; then + if echo "$CMDLINE" | grep -q doshell_ssh; then + if setup_network eth0; then + setup_ssh 2222 + fi + fi do_shell + # reboot fi -if echo "$CMDLINE" | grep -q dofail; then - do_failure -fi - if [ -z "$RUNIMG" ]; then RUNIMG="auto" fi #Network support - yikes -#VLANS -for i in $VLANS; do - IF=`echo $i | cut -d. -f1` - VID=`echo $i | cut -d. -f2` - ifconfig $IF up - vconfig add $IF $VID > /dev/null -done - -if [ -n "$NDEV" ]; then - ifconfig lo up 127.0.0.1 - - if [ -n "$MAC" ]; then - ifconfig "$NDEV" hw ether "$MAC" - fi - - if [ "$IP" = "dhcp" ]; then - echo "Configuring $NDEV with DHCP..." - udhcpc -nq -s /etc/udhcpc.script -i "$NDEV" - else - ifconfig "$NDEV" inet "$IP" netmask "$NM" - route add -net default gw "$GW" - - for i in $DNS; do - echo "nameserver $i" >> /tmp/etc/resolv.conf - done - - fi - +if setup_network; then if [ -n "$URL" ]; then echo "Checking for updates..." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |