aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl
diff options
context:
space:
mode:
Diffstat (limited to 'share/hydractl')
-rwxr-xr-xshare/hydractl/provision56
1 files changed, 23 insertions, 33 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision
index 95e67b9..31ea7d3 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -139,33 +139,17 @@ if [ "$interactive" == "y" ]; then
fi
# Disk partitioning.
-if [ "$swap" != "0" ]; then
- hydra_safe_run parted -s -- $device mklabel gpt
- hydra_safe_run parted -s -- $device unit MB mkpart non-fs 2 3
- hydra_safe_run parted -s -- $device unit MB mkpart ext2 3 200
- hydra_safe_run parted -s -- $device unit MB mkpart linux-swap 200 $swap_size
- hydra_safe_run parted -s -- $device unit MB mkpart ext2 $swap_size -1
- hydra_safe_run parted -s -- $device set 1 bios_grub on
- hydra_safe_run parted -s -- $device set 3 boot on
- hydra_safe_run parted -s -- $device set 4 lvm on
-
- # Change devices to absolute path names.
- boot_device="$device"2
- swap_device="$device"3
- syst_device="$device"4
-else
- hydra_safe_run parted -s -- $device mklabel gpt
- hydra_safe_run parted -s -- $device unit MB mkpart non-fs 2 3
- 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
-
- # Change devices to absolute path names.
- boot_device="$device"2
- syst_device="$device"3
-fi
+hydra_safe_run parted -s -- $device mklabel gpt
+hydra_safe_run parted -s -- $device unit MB mkpart non-fs 2 3
+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..."
@@ -184,6 +168,11 @@ fi
hydra_safe_run vgchange -a y $vg
hydra_provision_lvcreate root $root_size
+# Create swap partition
+if [ "$swap" != "0" ]; then
+ hydra_provision_lvcreate swap $swap_size
+fi
+
# Create home partition.
if [ "$home_size" != "0" ]; then
hydra_provision_lvcreate home $home_size
@@ -209,7 +198,7 @@ if [ "$garbage" == "y" ]; then
fi
if [ "$swap" != "0" ]; then
- dd if=/dev/urandom of=$swap_device
+ dd if=/dev/urandom of=/dev/mapper/$vg-swap
fi
fi
@@ -222,8 +211,9 @@ done
# Create swap fs.
if [ "$swap" != "0" ] && [ "$random_swap" != "y" ]; then
- hydra_cryptsetup $swap_device
- hydra_safe_run mkswap $swap_device
+ hydra_cryptsetup /dev/mapper/$vg-swap
+ hydra_safe_run cryptsetup luksOpen /dev/mapper/$vg-swap provision-swap
+ hydra_safe_run mkswap /dev/mapper/provision-swap
fi
# Create root fs
@@ -318,13 +308,13 @@ fi
if [ "$swap" != "0" ] && [ "$random_swap" == "y" ]; then
cat >> /tmp/debootstrap/etc/crypttab <<-EOF
-cswap $swap_device none luks,swap
+swap /dev/mapper/$vg-swap none luks,swap
EOF
fi
if [ "$swap" != "0" ] && [ "$random_swap" != "y" ]; then
cat >> /tmp/debootstrap/etc/crypttab <<-EOF
-cswap $swap_device /dev/random swap,cipher=aes-xts-plain64:sha256
+swap /dev/mapper/$vg-swap /dev/random swap,cipher=aes-xts-plain64:sha256
EOF
fi
@@ -333,7 +323,7 @@ echo "Configuring fstab..."
echo "" > /tmp/debootstrap/etc/fstab
if [ "$swap" != "0" ]; then
cat >> /tmp/debootstrap/etc/fstab <<-EOF
-/dev/mapper/cswap none swap sw 0 0
+/dev/mapper/swap none swap sw 0 0
EOF
fi