summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-28 23:16:37 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-28 23:16:37 -0200
commit2b2ddafc439311be2743e38481d7bdd05e0d5006 (patch)
tree7d03997aceb00bf50c8716116991e62c0d8184b5 /share
parent453afd4dbebfa23f4ecd9fadf751d7474b5aec50 (diff)
downloadhydra-2b2ddafc439311be2743e38481d7bdd05e0d5006.tar.gz
hydra-2b2ddafc439311be2743e38481d7bdd05e0d5006.tar.bz2
Just one question for swap
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydractl/provision11
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