altboot: Fix redirection so altboot can now be launched remotely and remove dependenc...
authorMatthias Hentges <oe@hentges.net>
Sun, 7 May 2006 11:37:01 +0000 (11:37 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Sun, 7 May 2006 11:37:01 +0000 (11:37 +0000)
packages/altboot/altboot_0.0.0.bb
packages/altboot/files/altboot.func
packages/altboot/files/init.altboot

index 9179871..2935ded 100644 (file)
@@ -18,7 +18,6 @@ RRECOMMENDS_${PN}_append_spitz = " kexec-tools"
 RRECOMMENDS_${PN}_append_c7x0 = " kexec-tools"
 
 RDEPENDS_${PN} = "${PN}-conf"
-RDEPENDS_${PN}-conf = "${PN}"
 
 ######################################################################################
 
index 73e82e3..98c38b4 100644 (file)
@@ -43,14 +43,14 @@ check_target() {
                        
                        if test "$AUTOBOOT" != "yes"
                        then
-                               read junk < /dev/tty1
+                               read junk < "$OUT_TTY"
                        else
                                if test -e /etc/.altboot-real-or-loop.last
                                then
                                        junk="`cat /etc/.altboot-real-or-loop.last`"
-                                       test -z "$junk" && read junk < /dev/tty1 || echo "$junk (autoboot)"
+                                       test -z "$junk" && read junk < "$OUT_TTY" || echo "$junk (autoboot)"
                                else
-                                       read junk < /dev/tty1
+                                       read junk < "$OUT_TTY"
                                fi
                        fi      
                        
@@ -133,14 +133,14 @@ pivot_image() {
                        echo -en "Please choose one of the above: "
                        if test "$AUTOBOOT" != "yes"
                        then
-                               read junk < /dev/tty1
+                               read junk < "$OUT_TTY"
                        else
                                if test -e /etc/.altboot-loopimage.last
                                then
                                        junk="`cat /etc/.altboot-loopimage.last`"
-                                       test -z "$junk" && read junk < /dev/tty1 || echo "$junk (autoboot)"
+                                       test -z "$junk" && read junk < "$OUT_TTY" || echo "$junk (autoboot)"
                                else
-                                       read junk < /dev/tty1
+                                       read junk < "$OUT_TTY"
                                fi
                        fi      
 
@@ -331,7 +331,7 @@ image_conf(){
 # This functions configures the master password for altboot if none is set
 set_password() {
        mount -o remount,rw /
-       if test -z "$MASTER_PASSWORD"
+       if test -z "$MASTER_PASSWORD" -a "$ENABLE_DEBUG" != yes
        then
                echo -e "\nAltboot is a boot-manager which allows to boot from SD,\nCF, USB-Storage and NFS"
                echo -e "\nFor security reasons altboot requires a password\nto boot into init=/bin/sh."
@@ -612,8 +612,9 @@ get_pref() {
        data_out="$3"
        data_list="`eval echo -e \\$${data_name}`"
        
-       data_value="`echo "$data_list"| sed "s/\#\#\#/\\n/g"|sed s/^\ // | grep "^$data_id##" | sed -n "s/.*\#\(.*\)$/\1/p"`"
-       
+       #data_value="`echo "$data_list"| sed "s/\#\#\#/\\n/g"|sed s/^\ // | grep "^$data_id##" | sed -n "s/.*\#\(.*\)$/\1/p"`"
+       #data_value="`echo "$data_list"| sed "s/\#\#\#/\\n/g"|sed s/^\ // |  sed -n "/^$data_id/s/.*\#\(.*\)$/\1/p"`"
+       data_value="`echo "$data_list"| sed "s/\#\#\#/\\n/g" | sed -n "s/^\ //;/^$data_id\#/s/.*\#\(.*\)$/\1/p"`"
        # echo "WERT: [$data_value]"
        
        export "${data_out}"="$data_value"
@@ -748,7 +749,7 @@ start_networking() {
                                                echo "Restarting udhcpc for [$WLAN_NIC]"
                                                killall udhcpc
                                        
-                                               udhcpc -i "$WLAN_NIC" -H `cat /etc/hostname` >/dev/tty1 2>&1
+                                               udhcpc -i "$WLAN_NIC" -H `cat /etc/hostname` >"$OUT_TTY" 2>&1
                                        fi
                                        
                                        if test "$NW_TYPE" = "USB"
index 7539a29..08ba81e 100644 (file)
@@ -17,7 +17,7 @@ REAL_INIT="/sbin/init.sysvinit"
 INIT_RUNLEVEL="`cat /etc/inittab | sed -n "/^id\:/s/id\:\([0-9]\)\:.*$/\1/p"`"
 test -z "$INIT_RUNLEVEL" && INIT_RUNLEVEL=5
 
-OUT_TTY="/dev/tty1"
+OUT_TTY="`tty`" ; test -z "$OUT_TTY" && OUT_TTY="/dev/tty1"
 
 case "`uname -r`" in
 2.6*)  ALTBOOT_CFG_FILE="/etc/altboot-2.6.cfg";;
@@ -26,7 +26,7 @@ case "`uname -r`" in
        ALTBOOT_CFG_FILE="/etc/altboot-2.6.cfg";;
 esac
 
-test -e "$ALTBOOT_CFG_FILE" && . "$ALTBOOT_CFG_FILE" || echo "WARNING: No $ALTBOOT_CFG_FILE found! Check your installation of Altboot!" > /dev/tty1
+test -e "$ALTBOOT_CFG_FILE" && . "$ALTBOOT_CFG_FILE" || echo "WARNING: No $ALTBOOT_CFG_FILE found! Check your installation of Altboot!" > "$OUT_TTY"
 
 C_RED="\033[31m"
 C_YELLOW="\033[33m"
@@ -181,7 +181,7 @@ run_timer() {
                esac            
        
                stty -echo  <"$OUT_TTY" >"$OUT_TTY" 2>&1
-               echo -en "\n\nPlease press any key to launch altboot." > /dev/tty1
+               echo -en "\n\nPlease press any key to launch altboot." > "$OUT_TTY"
                
                test -z "$TIMEOUT" && TIMEOUT="3"
 
@@ -201,7 +201,7 @@ run_timer() {
                                stty echo <"$OUT_TTY" >"$OUT_TTY" 2>&1
                                break
                        fi
-                       echo -n "." >/dev/tty1
+                       echo -n "." >"$OUT_TTY"
                        let cnt=$cnt+1
                done
                
@@ -325,7 +325,7 @@ fi
 
 if test -f /proc/cmdline -a "`ps ax|wc -l|tr -d " "`" -gt 30 -a "$1" != "-force"
 then
-       echo "altboot: Using real init [$REAL_INIT] [$*] [`ps ax|wc -l|tr -d " "`] *" >/dev/tty1
+       echo "altboot: Using real init [$REAL_INIT] [$*] [`ps ax|wc -l|tr -d " "`] *" >"$OUT_TTY"
        exec $REAL_INIT $*
 #      exec $SH_SHELL </dev/tty0 >/dev/tty0 2>&1
        exit 0
@@ -333,7 +333,7 @@ else
        # Boot original init if altboot is turned off
        if test "$ENABLE_ALTBOOT" != "yes" 
        then    
-               echo "altboot: Using real init [$REAL_INIT] **" >/dev/tty1
+               echo "altboot: Using real init [$REAL_INIT] **" >"$OUT_TTY"
                exec $REAL_INIT $INIT_RUNLEVEL
                exit 0
        fi
@@ -344,7 +344,7 @@ else
 
        for file in $RC_FILES
        do
-                . /etc/altboot.rc/$file >/dev/tty1 2>&1 || echo "/etc/altboot.rc/$file failed!"
+                . /etc/altboot.rc/$file >"$OUT_TTY" 2>&1 || echo "/etc/altboot.rc/$file failed!"
        done
                        
        # Make sure altboots master password is set
@@ -357,7 +357,7 @@ else
        
        # This timeout works by reading /proc/interrupts to see if the keyboard interrupt
        # increases while the timer is running. A TIMEOUT of 0 will always launch altboot.      
-       run_timer >/dev/tty1 
+       run_timer >"$OUT_TTY" 
                
        echo "" >"$OUT_TTY"