Change -f checks to -e for /dev nodes
authorAndrew Gaffney <agaffney@gentoo.org>
Sun, 14 Dec 2008 21:37:33 +0000 (15:37 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Sun, 14 Dec 2008 21:37:33 +0000 (15:37 -0600)
Check that dropbear exists before starting it

ChangeLog
netboot/linuxrc.x

index ad5421b797575a3a71a1254138609738cb7abfaa..95d7f055227a658b759e2c4b89df252a7f167933 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 # Copyright 1999-2008 Gentoo Foundation; 2008 Chris Gianelloni, Andrew Gaffney
 # Distributed under the GPL v2
 
+  14 Dec 2008; Andrew Gaffney <agaffney@gentoo.org> netboot/linuxrc.x:
+  Change -f checks to -e for /dev nodes Check that dropbear exists before
+  starting it
+
   14 Dec 2008; Andrew Gaffney <agaffney@gentoo.org> gen_compile.sh:
   Explicitly set UTILS_{CC,LD,AS} if UTILS_CROSS_COMPILE is set
 
index b607fe28d83f90a069e3f851f45b59ff1a4b70aa..e982202fad66868c3797c02bd87397488e7518ea 100644 (file)
@@ -53,12 +53,12 @@ StartUp() {
                /sbin/mdev -s                                           # have mdev populate /dev
 
                #// Create standard (non-mdev) devices
-               if [ ! -f /dev/md0 ]
+               if [ ! -e /dev/md0 ]
                then
                        makedevs        /dev/md         b 9 0 0 7
                fi
 
-               if [ ! -f /dev/tty0 ]
+               if [ ! -e /dev/tty0 ]
                then
                        makedevs        /dev/tty        c 4 0 0 12
                fi
@@ -93,16 +93,19 @@ StartUp() {
                #// Hostname
                hostname netboot
 
-               #// Setup dropbear (sshd)
-               echo -e ""
-               mkdir /etc/dropbear
-               echo -e ">>> Generating RSA hostkey ..."
-               dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
-               echo -e ""
-               echo -e ">>> Generating DSS hostkey ..."
-               dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
-               echo -e ""
-               dropbear
+               if [ -n "`which dropbear 2>/dev/null`" ]
+               then
+                       # Setup dropbear (sshd)
+                       echo -e ""
+                       mkdir /etc/dropbear
+                       echo -e ">>> Generating RSA hostkey ..."
+                       dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
+                       echo -e ""
+                       echo -e ">>> Generating DSS hostkey ..."
+                       dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
+                       echo -e ""
+                       dropbear
+               fi
 
                #// Misc tasks
                chmod +x /bin/net-setup