diff options
-rwxr-xr-x | share/hydractl/provision | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision index 8ef4319..86a1bd8 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -76,7 +76,7 @@ function hydra_create_volume { # Setup. hydra_user_input device /dev/sdb "Destination device" hydra_user_input root_size 20G "Size of root partition" -hydra_user_input swap y "Use swap? (y/n)" +hydra_user_input swap_size 0 "Swap size (in MB, 0 to not create it)" hydra_user_input home_size 0 "Size of home partition (0 to not create it, -1 for all free space)" hydra_user_input var_size 0 "Size of var partition (0 to not create it, -1 for all free space)" hydra_user_input encrypt y "Encrypt volumes? (y/n)" @@ -102,8 +102,7 @@ EOF read answer # Disk partitioning. -if [ "$swap" == "y" ]; then - hydra_user_input swap_size 2000 "Swap size (MB)" +if [ "$swap" != "0" ]; then boot_end=$(($swap_size + 200)) hydra_safe_run parted -s -- $device mklabel msdos hydra_safe_run parted -s -- $device unit MB mkpart primary linux-swap 2 $swap_size @@ -160,7 +159,7 @@ if [ "$garbage" == "y" ]; then dd if=/dev/urandom of=/dev/mapper/$vg-var fi - if [ "$swap" == "y" ]; then + if [ "$swap" != "0" ]; then dd if=/dev/urandom of=$swap_device fi fi @@ -254,7 +253,7 @@ var /dev/mapper/vg-var none luks,cipher=aes-cbc-ess EOF fi -if [ "$swap" == "y" ]; then +if [ "$swap" != "0" ]; then cat >> /tmp/debootstrap/etc/crypttab <<-EOF cswap $swap_device /dev/random swap,cipher=aes-cbc-essiv:sha256 EOF @@ -263,7 +262,7 @@ fi # Fstab. echo "Configuring fstab..." echo "" > /tmp/debootstrap/etc/fstab -if [ "$swap" == "y" ]; then +if [ "$swap" != "0" ]; then cat >> /tmp/debootstrap/etc/fstab <<-EOF /dev/mapper/cswap none swap sw 0 0 EOF |