]> gitweb.fluxo.info Git - hydra.git/commitdiff
Just one question for swap
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 29 Jan 2013 01:16:37 +0000 (23:16 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 29 Jan 2013 01:16:37 +0000 (23:16 -0200)
share/hydractl/provision

index 8ef4319a362b1e63888b102752daa021d3824beb..86a1bd8ad338e62b51e4d46cb48d5119fe2d8f6f 100755 (executable)
@@ -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