[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Full installs via SSH



network-console allows to install via SSH but in order to use it you
first have to configure your language and choose a password.  I'd like
to use d-i fully via SSH, partly because some old Cobalt machines
don't have a serial console and partly because that would be one way
to install access points and other embedded devices.

I'd appreciate it if someone could review the patch below.  Quite
frankly, I think the default should be that network-console has a very
low menu-item value but I kept compatibility with waldi's approach in
this patch.  On Cobalt, network-console could simply generate a
password for you and display it on the LCD; for APs, you could just
specify one via debconf.


Index: debian/control
===================================================================
--- debian/control	(revision 30231)
+++ debian/control	(working copy)
@@ -9,8 +9,8 @@
 Package: network-console
 XC-Package-Type: udeb
 Architecture: any
-Depends: configured-network, openssh-server-udeb
-XB-Installer-Menu-Item: 21
+Depends: ${depends}, openssh-server-udeb
+XB-Installer-Menu-Item: ${menuitemnum}
 Description: Continue installation remotely using SSH
 
 Package: network-console-config
Index: debian/rules
===================================================================
--- debian/rules	(revision 30231)
+++ debian/rules	(working copy)
@@ -3,6 +3,18 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
+
+MENUITEMNUM=21
+DEPENDS=configured-network
+# Do we want to boot immediately into SSH?
+# FIXME: handle subarches
+ifeq ($(ARCH),mipsel)
+MENUITEMNUM=9
+#DEPENDS=pwgen
+DEPENDS=
+endif
+
 build: build-stamp
 build-stamp:
 	dh_testdir
@@ -61,7 +73,7 @@
 	dh_compress -s
 	dh_fixperms -s
 	dh_installdeb -s
-	dh_gencontrol -s
+	dh_gencontrol -s -- -Vmenuitemnum=$(MENUITEMNUM) -Vdepends=$(DEPENDS)
 	dh_builddeb -s
 
 binary: binary-indep binary-arch
Index: debian/network-console.postinst
===================================================================
--- debian/network-console.postinst	(revision 30231)
+++ debian/network-console.postinst	(working copy)
@@ -3,6 +3,8 @@
 
 . /usr/share/debconf/confmodule
 
+SUBARCH="$(archdetect)"
+
 TEMPLATE_ROOT=network-console
 
 KEY_FILE=/etc/ssh/ssh_host_rsa_key
@@ -13,6 +15,21 @@
   db_progress STOP
 fi
 
+db_get $TEMPLATE_ROOT/password
+PASSWORD="$RET"
+
+case "$SUBARCH" in
+  mipsel/cobalt)
+    NONINTERACTIVE=1
+  ;;
+esac
+
+if [ $NONINTERACTIVE -eq 1 ]; then
+      dhclient
+      #[ -z "$PASSWORD" ] && PASSWORD=$(pwgen -1) # needs a pwgen udeb
+      [ -z "$PASSWORD" ] && PASSWORD=test
+fi
+
 while [ -z "$PASSWORD" ]; do
 
   db_input critical $TEMPLATE_ROOT/password || true
@@ -49,6 +66,21 @@
 # Queue installation of network-console-config
 apt-install network-console-config || true
 
-db_subst $TEMPLATE_ROOT/start fingerprint $KEY_FINGERPRINT
-db_input critical $TEMPLATE_ROOT/start || true
-db_go
+IPADDR=$(ifconfig | grep 'inet addr:' | head -1 | \
+  sed 's/.*inet addr:\([0-9.]*\).*/\1/')
+case "$SUBARCH" in
+  mipsel/cobalt)
+    putlcd "SSH to installer" "@$IPADDR"
+    sleep 2
+    putlcd "The password is:" "$PASSWORD"
+    sleep 2
+    putlcd $(echo $KEY_FINGERPRINT | cut -d ":" -f 1-8 | sed 's/://g') \
+      $(echo $KEY_FINGERPRINT | cut -d ":" -f 9-16 | sed 's/://g')
+  ;;
+  *)
+    db_subst $TEMPLATE_ROOT/start fingerprint $KEY_FINGERPRINT
+    db_input critical $TEMPLATE_ROOT/start || true
+    db_go
+  ;;
+esac
+
Index: network-console
===================================================================
--- network-console	(revision 30231)
+++ network-console	(working copy)
@@ -1,6 +1,14 @@
 #!/bin/sh
 set -e
 
+SUBARCH="$(archdetect)"
+
+case "$SUBARCH" in
+  mipsel/cobalt)
+    putlcd "Welcome!"
+  ;;
+esac
+
 export TERM=linux
 export TERM_TYPE=network
 exec /sbin/debian-installer /bin/network-console-menu


-- 
Martin Michlmayr
http://www.cyrius.com/



Reply to: