# 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)"
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
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
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
# 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