--- a/pkvlm-create Wed Feb 01 15:53:27 2012 +0200
+++ b/pkvlm-create Thu Feb 02 13:50:57 2012 +0200
@@ -176,6 +176,9 @@
# OS variant (for virt-install)
GUEST_OS_VARIANT=$opt_os
+# I/O
+GUEST_DISK_BUS=$opt_disk_bus
+
## Disk
# Size of LV to create
DISK_SIZE=$opt_disk_size
@@ -188,7 +191,6 @@
# Path to disk block device
DISK_PATH=/dev/mapper/${DISK_VG}-${DISK_NAME}
-GUEST_DISK_BUS=$opt_disk_bus
## Serial
# Serial console?
@@ -196,12 +198,10 @@
case x"$opt_serial_console" in
# xtty*) SERIAL_CONSOLE="$opt_serial_console" ;;
x) SERIAL_CONSOLE= ;;
- x*) SERIAL_CONSOLE="ttyS0" ;;
+ x*) SERIAL_CONSOLE="ttyS0" ;;
esac
### Preseed content
-GUEST_DISK=$opt_guest_disk
-
## Network
# Network configuration, for /etc/network/interfaces
NET_DOMAIN=${DOMAIN}
@@ -329,7 +329,41 @@
[ -d ${STAGE_DIR} ] && cmd rm -r ${STAGE_DIR}
cmd mkdir ${STAGE_DIR}
-## preseed.cfg contents
+function stage_file () {
+ local src=$1
+ local name=$2
+
+ local tgt=${STAGE_DIR}/$name
+
+ log_debug "stage: file: $name"
+ cmd cp $src $tgt
+}
+
+### preseed.cfg contents
+
+## Disk
+# Disk to install to
+PARTMAN_DISK=$opt_guest_disk
+
+# regular/lvm/crypto
+PARTMAN_METHOD=regular
+
+# Recipe to use
+PARTMAN_RECIPE='Trvial'
+
+# recipe file
+PARTMAN_RECIPE_FILE_NAME="partman.recipe"
+PRESEED_PARTMAN_RECIPE_FILE="${PRESEED_DIR}/${PARTMAN_RECIPE_FILE_NAME}"
+INSTALL_PARTMAN_RECIPE_FILE_NAME="${PARTMAN_RECIPE_FILE_NAME}"
+INSTALLER_PARTMAN_RECIPE_FILE="${INSTALLER_PRESEED_DIR}/${PARTMAN_RECIPE_FILE_NAME}"
+
+# deploy
+stage_file ${PRESEED_PARTMAN_RECIPE_FILE} ${INSTALL_PARTMAN_RECIPE_FILE_NAME}
+
+# path for d-i to find it
+PARTMAN_RECIPE_FILE="${INSTALLER_PARTMAN_RECIPE_FILE}"
+
+## Misc
# List of additional packages to install
PRESEED_PACKAGES=( sudo screen vim )
@@ -570,8 +604,6 @@
RAM: $GUEST_RAM
OS: $GUEST_OS_VARIANT
- Disk: $GUEST_DISK
-
Boot:
Serial console: $SERIAL_CONSOLE
Grub terminal: $BOOT_GRUB_TERMINAL
@@ -586,6 +618,8 @@
Path: $DISK_PATH
Bus: $GUEST_DISK_BUS
+
+ Name: $PARTMAN_DISK
Net:
Hostname: $NET_HOSTNAME
@@ -690,10 +724,6 @@
cmd expand_tree $tree ${INSTALL_PRESEED_FILES_DIR}
done
-# Staged files
-# PRESEED_FILES_DIR must be the same name as INSTALL_PRESEED_FILES_DIR
-cmd cp -rv ${STAGE_PRESEED_FILES_DIR}/ ${INSTALL_PRESEED_DIR}/
-
# debug?
[ $LOG_DEBUG ] && tree ${INSTALL_PRESEED_FILES_DIR}
@@ -701,8 +731,13 @@
## Copy preseed scripts
log_info "Copy preseed-scripts..."
-# Staged scripts
-cmd cp -rv "$STAGE_PRESEED_SCRIPTS_DIR" "$INSTALL_PRESEED_SCRIPTS_DIR"
+
+## Staged files
+log_info "Copy staged preseed files..."
+
+# STAGE_PRESEED_*_DIR must be the same name as INSTALL_PRESEED_*_DIR
+cmd cp -rv ${STAGE_DIR}/* ${INSTALL_PRESEED_DIR}/
+
### Create .iso
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/preseed/partman.recipe Thu Feb 02 13:50:57 2012 +0200
@@ -0,0 +1,14 @@
+"Trivial" ::
+ 64 512 300% linux-swap
+ $primary{ }
+ method{ swap }
+ format{ }
+ .
+
+ 500 10000 1000000000 ext4
+ $primary{ } $bootable{ }
+ method{ format } format{ }
+ use_filesystem{ } filesystem{ ext4 }
+ mountpoint{ / }
+ .
+
--- a/preseed/preseed.cfg Wed Feb 01 15:53:27 2012 +0200
+++ b/preseed/preseed.cfg Thu Feb 02 13:50:57 2012 +0200
@@ -132,6 +132,7 @@
### Partitioning
#
# http://ftp.dc.volia.com/pub/debian/preseed/partman-auto-recipe.txt
+# apt-get source debian-installer && less debian-installer-*/doc/devel/partman-auto-recipe.txt
## Partitioning example
# Use free space
@@ -141,15 +142,14 @@
# one disk the installer will default to using that, but otherwise the device
# name must be given in traditional, non-devfs format (so e.g. /dev/hda or
# /dev/sda, and not e.g. /dev/discs/disc0/disc).
-# For example, to use the first SCSI/SATA hard disk:
-#d-i partman-auto/disk string {GUEST_DISK}
+#d-i partman-auto/disk string {PARTMAN_DISK}
# In addition, you'll need to specify the method to use.
# The presently available methods are:
# - regular: use the usual partition types for your architecture
# - lvm: use LVM to partition the disk
# - crypto: use LVM within an encrypted partition
-d-i partman-auto/method string regular
+d-i partman-auto/method string {PARTMAN_METHOD}
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
@@ -158,18 +158,17 @@
# The same applies to pre-existing software RAID array:
#d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
-d-i partman-lvm/confirm boolean true
+d-i partman-lvm/confirm boolean true
# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home: separate /home partition
# - multi: separate /home, /usr, /var, and /tmp partitions
-d-i partman-auto/choose_recipe select atomic
+d-i partman-auto/choose_recipe select {PARTMAN_RECIPE}
-# Or provide a recipe of your own...
-# If you have a way to get a recipe file into the d-i environment, you can
-# just point at it.
-#d-i partman-auto/expert_recipe_file string /hd-media/recipe
+## Custom partitioning recipe
+# from partman.recipe (via staging)
+d-i partman-auto/expert_recipe_file string {PARTMAN_RECIPE_FILE}
# If not, you can put an entire recipe into the preconfiguration file in one
# (logical) line. This example creates a small /boot partition, suitable