aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/hydractl/provision74
1 files changed, 43 insertions, 31 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision
index 9bd8aac..3e2ee11 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -94,14 +94,19 @@ function hydra_provision_config {
hydra_user_config interactive y "Interactive mode? (y/n)"
hydra_user_config device /dev/sdb "Destination device"
- hydra_user_config root_size 20G "Size of root partition"
- hydra_user_config swap_size 2000 "Swap size (in MB, 0 to not create it)"
- hydra_user_config home_size 20G "Size of home partition (0 to not create it, -1 for all free space)"
- hydra_user_config var_size 20G "Size of var partition (0 to not create it, -1 for all free space)"
+ hydra_user_config lvm y "Use LVM (y/n)"
+
+ if [ "$lvm" == "y" ]; then
+ hydra_user_config disable_zeroing n "Disable zeroing of LVM volumes? (y/n)"
+ hydra_user_config root_size 20G "Size of root partition"
+ hydra_user_config swap_size 2000 "Swap size (in MB, 0 to not create it)"
+ hydra_user_config home_size 20G "Size of home partition (0 to not create it, -1 for all free space)"
+ hydra_user_config var_size 20G "Size of var partition (0 to not create it, -1 for all free space)"
+ fi
+
hydra_user_config encrypt y "Encrypt volumes? (y/n)"
hydra_user_config garbage y "Pre-fill volumes with garbage? (y/n)"
hydra_user_config random_swap y "Random swap? (y/n)"
- hydra_user_config disable_zeroing n "Disable zeroing of LVM volumes? (y/n)"
hydra_user_config hostname machine "Hostname"
hydra_user_config domain example.org "Domain"
hydra_user_config arch $base_arch "System arch"
@@ -145,49 +150,56 @@ hydra_safe_run parted -s -- $device unit MB mkpart ext2 3 200
hydra_safe_run parted -s -- $device unit MB mkpart ext2 200 -1
hydra_safe_run parted -s -- $device set 1 bios_grub on
hydra_safe_run parted -s -- $device set 2 boot on
-hydra_safe_run parted -s -- $device set 3 lvm on
# Use absolute paths for devices.
boot_device="$device"2
syst_device="$device"3
-# Create volumes.
-echo "Creating the needed disk volumes..."
+# LVM
+if [ "$lvm" == "y" ]; then
+ hydra_safe_run parted -s -- $device set 3 lvm on
-if ! pvdisplay $syst_device &> /dev/null; then
- echo "Creating physical volume..."
- hydra_safe_run pvcreate $syst_device
-fi
+ echo "Creating the needed disk volumes..."
-if ! vgdisplay $vg &> /dev/null; then
- echo "Creating volume group..."
- hydra_safe_run vgcreate $vg $syst_device
-fi
+ if ! pvdisplay $syst_device &> /dev/null; then
+ echo "Creating physical volume..."
+ hydra_safe_run pvcreate $syst_device
+ fi
-# Create root partition.
-hydra_safe_run vgchange -a y $vg
-hydra_provision_lvcreate root $root_size
+ if ! vgdisplay $vg &> /dev/null; then
+ echo "Creating volume group..."
+ hydra_safe_run vgcreate $vg $syst_device
+ fi
-# Create swap partition
-if [ "$swap_size" != "0" ]; then
- hydra_provision_lvcreate swap $swap_size
-fi
+ # Create root partition.
+ hydra_safe_run vgchange -a y $vg
+ hydra_provision_lvcreate root $root_size
-# Create home partition.
-if [ "$home_size" != "0" ]; then
- hydra_provision_lvcreate home $home_size
-fi
+ # Create swap partition
+ if [ "$swap_size" != "0" ]; then
+ hydra_provision_lvcreate swap $swap_size
+ fi
-# Create var partition.
-if [ "$var_size" != "0" ]; then
- hydra_provision_lvcreate var $var_size
+ # Create home partition.
+ if [ "$home_size" != "0" ]; then
+ hydra_provision_lvcreate home $home_size
+ fi
+
+ # Create var partition.
+ if [ "$var_size" != "0" ]; then
+ hydra_provision_lvcreate var $var_size
+ fi
fi
# Garbage.
if [ "$garbage" == "y" ]; then
echo "Filling volumes with garbage..."
- dd if=/dev/urandom of=/dev/mapper/$vg-root
+ if [ "$lvm" == "y" ] && [ -b "/dev/mapper/$vg-root" ]; then
+ dd if=/dev/urandom of=/dev/mapper/$vg-root
+ else
+ dd if=/dev/urandom of=$syst_device
+ fi
if [ -b "/dev/mapper/$vg-home" ]; then
dd if=/dev/urandom of=/dev/mapper/$vg-home