Right, after battling with shell I have managed to get preseeded RAIDed
installs in a way which I hope is general enough that you will apply/let
me apply to mainline d-i.

The basic idea is to:
        - make partman-auto able to partition two disks according to a
          recipe (normally supplied as an expert recipe).
        - slip a couple more scripts into /lib/partman/init.d/ to deal
          with bringing the RAID devices up, restarting partman and then
          telling partman what filesystems/mountpoints should be on
          them.
        - let partman do its job and format as it would otherwise.
        - enhance grub-installer to let it install onto more than one
          disk.

It appears to work for me.

Known bugs:
        - partman's percentages get mucked up.  I haven't looked at
          fixing this as it's cosmetic - I guess it's trivial but I'm
          not quite sure what needs to happen.
        - it does error out very well if you break the recipes but then
          neither do other bits of partman.
        - I wrote the shell scripts.  I don't write good shell :)

Untested paths:
        - anything other than RAID 1
        - any other filesystem other than ext3/swap
        - actually testing it against the etch installer and not the
          sarge one + backports.
They should be trivial to test though.

I'd be greatful for any comments at all on this code, ways to improve it
or fixes for the percentage bar bug.

Simon.

-- 
 -+//                  'Une pause s'impose' -- Gianny                  \\+-
-+<<                                                                    >>+-
 -+\\                                                                  //+-
        Colocate your server with http://www.blackcatnetworks.co.uk
diff -urN grub-installer-1.14/debian/changelog 
grub-installer-1.15/debian/changelog
--- grub-installer-1.14/debian/changelog        2006-01-28 16:14:03.000000000 
+0000
+++ grub-installer-1.15/debian/changelog        2006-03-08 12:55:52.000000000 
+0000
@@ -1,3 +1,9 @@
+grub-installer (1.15) unstable; urgency=low
+
+  * Allow installation to multiple devices.
+
+ -- Simon Huggins <[EMAIL PROTECTED]>  Wed, 08 Mar 2006 12:55:49 +0000
+
 grub-installer (1.14) unstable; urgency=low
 
   * Make sure no .svn directories get included in the package.
diff -urN grub-installer-1.14/grub-installer grub-installer-1.15/grub-installer
--- grub-installer-1.14/grub-installer  2006-01-16 23:04:04.000000000 +0000
+++ grub-installer-1.15/grub-installer  2006-03-12 12:57:22.000000000 +0000
@@ -337,26 +337,39 @@
 
 update_mtab
 
-if ! is_floppy "$bootdev"; then
-       if $chroot $ROOT /sbin/grub-install -h 2>&1 | grep -q no-floppy; then
-               info "grub-install supports --no-floppy"
-               floppyparam="--no-floppy"
-       else
-               info "grub-install does not support --no-floppy"
+# Install grub on each comma separated disk
+bootdevs="$bootdev"
+while [ -n "$bootdevs" ]; do
+       tmp=$bootdevs
+       bootdevs=`echo $tmp|sed -e 's/^[^,]*,\(.*\)$/\1/'`;
+       bootdev=`echo $tmp|sed -e 's/^\([^,]*\),.*$/\1/'`;
+
+       if [ "$bootdev" = "$bootdevs" ]; then
+               bootdevs=''
        fi
-fi
 
-info "Running $chroot $ROOT /sbin/grub-install --recheck $floppyparam 
\"$bootdev\""
-if log-output -t grub-installer $chroot $ROOT /sbin/grub-install --recheck 
$floppyparam "$bootdev"; then
-       info "grub-install ran successfully"
-else
-       error "Running 'grub-install --recheck $floppyparam \"$bootdev\"' 
failed."
-       db_subst grub-installer/grub-install-failed BOOTDEV "$bootdev"
-       db_input critical grub-installer/grub-install-failed || [ $? -eq 30 ]
-       db_go || true
-       db_progress STOP
-       exit 1
-fi
+
+       if ! is_floppy "$bootdev"; then
+               if $chroot $ROOT /sbin/grub-install -h 2>&1 | grep -q 
no-floppy; then
+                       info "grub-install supports --no-floppy"
+                       floppyparam="--no-floppy"
+               else
+                       info "grub-install does not support --no-floppy"
+               fi
+       fi
+
+       info "Running $chroot $ROOT /sbin/grub-install --recheck $floppyparam 
\"$bootdev\""
+       if log-output -t grub-installer $chroot $ROOT /sbin/grub-install 
--recheck $floppyparam "$bootdev"; then
+               info "grub-install ran successfully"
+       else
+               error "Running 'grub-install --recheck $floppyparam 
\"$bootdev\"' failed."
+               db_subst grub-installer/grub-install-failed BOOTDEV "$bootdev"
+               db_input critical grub-installer/grub-install-failed || [ $? 
-eq 30 ]
+               db_go || true
+               db_progress STOP
+               exit 1
+       fi
+done
 
 db_progress STEP 1
 db_progress INFO grub-installer/progress/step_config_loader

Attachment: partman-auto-raid-1.tar.gz
Description: Binary data

diff -urN partman-md-23/debian/changelog partman-md-24/debian/changelog
--- partman-md-23/debian/changelog      2006-01-24 21:11:14.000000000 +0000
+++ partman-md-24/debian/changelog      2006-03-12 13:32:11.000000000 +0000
@@ -1,3 +1,10 @@
+partman-md (24) unstable; urgency=low
+
+  * Exit in md-devices if the device already exists for compatibility with
+    partman-auto-raid.
+
+ -- Simon Huggins <[EMAIL PROTECTED]>  Sun, 12 Mar 2006 13:32:05 +0000
+
 partman-md (23) unstable; urgency=low
 
   [ Colin Watson ]
diff -urN partman-md-23/init.d/md-devices partman-md-24/init.d/md-devices
--- partman-md-23/init.d/md-devices     2005-11-15 19:13:44.000000000 +0000
+++ partman-md-24/init.d/md-devices     2006-03-07 17:05:55.000000000 +0000
@@ -21,6 +21,10 @@
 for i in `grep ^md /proc/mdstat|grep -v inactive|sed -e 's/^\(md.*\) : active 
\([[:alnum:]]*\).*/\1/'`; do
        NUMBER=`echo ${i}|sed -e "s/^md//"`
        DEVICE="/var/lib/partman/devices/=dev=md=${NUMBER}"
+       if [ -d ${DEVICE} ]; then
+               # Already created (probably by partman-auto-raid)
+               exit 0
+       fi
        mkdir ${DEVICE}
        cd ${DEVICE}
        echo "/dev/md/${NUMBER}" > ${DEVICE}/device
diff --exclude='*.po' -urN partman-auto-49/debian/changelog 
partman-auto-50/debian/changelog
--- partman-auto-49/debian/changelog    2006-02-13 11:38:38.000000000 +0000
+++ partman-auto-50/debian/changelog    2006-03-12 13:58:22.000000000 +0000
@@ -1,3 +1,11 @@
+partman-auto (50) unstable; urgency=low
+
+  * Add support for multiple disks.
+  * Move initial_auto to priority 96 to allow partman-auto-raid to squeeze in
+    after.
+
+ -- Simon Huggins <[EMAIL PROTECTED]>  Tue, 28 Feb 2006 15:17:46 +0000
+
 partman-auto (49) unstable; urgency=low
 
   * Enable auto-lvm in partitioning schemes for Sparc.
diff --exclude='*.po' -urN partman-auto-49/init.d/initial_auto 
partman-auto-50/init.d/initial_auto
--- partman-auto-49/init.d/initial_auto 2005-11-15 19:13:53.000000000 +0000
+++ partman-auto-50/init.d/initial_auto 2006-03-12 13:55:31.000000000 +0000
@@ -31,11 +31,26 @@
 # See if a disk to autopartition has been set.
 db_get partman-auto/disk
 if [ -n "$RET" ]; then
-       disk="$RET"
+       disks=$RET
+       
+       # disks can be a comma separated list and we process each in turn
+       while [ -n "$disks" ]; do
+               tmp=$disks
+               disks=`echo $tmp|sed -e 's/^[^,]*,\(.*\)$/\1/'`;
+               disk=`echo $tmp|sed -e 's/^\([^,]*\),.*$/\1/'`;
 
-       id=$(dev_to_partman "$disk") || true
-       if [ -n "$id" ]; then
-               autopartition "$id"
+               if [ "$disk" = "$disks" ]; then
+                       disks=''
+               fi
+
+               id=$(dev_to_partman "$disk") || true
+               if [ -n "$id" ]; then
+                       autopartition "$id"
+                       did_partition="yes"
+               fi
+       done
+
+       if [ -n "$did_partition" ]; then
                exit 0
        fi
 fi
diff --exclude='*.po' -urN partman-auto-49/init.d/_numbers 
partman-auto-50/init.d/_numbers
--- partman-auto-49/init.d/_numbers     2005-11-15 19:13:53.000000000 +0000
+++ partman-auto-50/init.d/_numbers     2006-03-02 13:06:07.000000000 +0000
@@ -1 +1 @@
-99 initial_auto
+96 initial_auto

Reply via email to