[25706] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r25185 - trunk/debathena/scripts/installer/pxe/natty/debathena

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Wed Jun 29 12:27:37 2011

Date: Wed, 29 Jun 2011 12:27:31 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201106291627.p5TGRVVJ017134@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2011-06-29 12:27:30 -0400 (Wed, 29 Jun 2011)
New Revision: 25185

Added:
   trunk/debathena/scripts/installer/pxe/natty/debathena/check-disks.sh
Modified:
   trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.autoinstall
Log:
* Installer now checks for sufficient disk space (Trac: #224)
* Pick the first disk, bypassing a prompt if there's more than one
  disk in the machine (say, a flash drive was left plugged in)


Added: trunk/debathena/scripts/installer/pxe/natty/debathena/check-disks.sh
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/check-disks.sh	                        (rev 0)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/check-disks.sh	2011-06-29 16:27:30 UTC (rev 25185)
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# This is run by d-i before the partman step (e.g. d-i partman/early_command)
+
+MIN_DISK_SIZE=20000000
+
+youlose() {
+  chvt 5
+  # Steal STDIN and STDOUT back from the installer
+  exec < /dev/tty5 > /dev/tty5 2>&1
+  echo ""
+  echo "****************************"
+  echo "ERROR: $@"
+  echo "Installation cannot proceed. Press any key to reboot."
+  read foo
+  echo "Rebooting, please wait..."
+  reboot
+}
+
+first_disk=`list-devices disk | head -n1`
+if ! echo "$first_disk" | grep -q ^/dev; then
+  youlose "No disks found."
+fi
+if [ "$(sfdisk -s "$first_disk")" -lt $MIN_DISK_SIZE ]; then
+  youlose "Your disk is too small ($(( $MIN_DISK_SIZE / 1000000)) GB required)."
+fi
+# Tell partman which disk to use
+debconf-set partman-auto/disk "$first_disk"
+exit 0

Modified: trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.autoinstall
===================================================================
--- trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.autoinstall	2011-06-29 12:45:56 UTC (rev 25184)
+++ trunk/debathena/scripts/installer/pxe/natty/debathena/preseed.autoinstall	2011-06-29 16:27:30 UTC (rev 25185)
@@ -31,6 +31,11 @@
 
 ### Partitioning
 # Use the whole disk.  Any disk.
+# No, use the first disk (via a shell script that also does sanity checking
+d-i partman/early_command string sh /debathena/check-disks.sh
+# We could also do this to just pick the first disk
+#d-i partman/early_command string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
+
 # The presently available methods are: "regular", "lvm" and "crypto"
 d-i partman-auto/method string lvm
 


home help back first fref pref prev next nref lref last post