diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-01-28 23:11:46 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-01-28 23:11:46 -0200 |
commit | 453afd4dbebfa23f4ecd9fadf751d7474b5aec50 (patch) | |
tree | 495816fde500cd7818345c9326c144be86c721c4 | |
parent | cef156b94eb885c553d75a82d6bfd12186fff3b3 (diff) | |
download | hydra-453afd4dbebfa23f4ecd9fadf751d7474b5aec50.tar.gz hydra-453afd4dbebfa23f4ecd9fadf751d7474b5aec50.tar.bz2 |
Size of swap partition; option to create lv with all available space
-rwxr-xr-x | share/hydractl/provision | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision index 51ed478..8ef4319 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -24,6 +24,7 @@ hydra_config_load function hydra_lvcreate { local volume="$1" local size="$2" + local space if [ -z "$volume" ] || [ "$size" == "0" ]; then return @@ -34,7 +35,14 @@ function hydra_lvcreate { # See http://forums.funtoo.org/viewtopic.php?id=1206 # https://bbs.archlinux.org/viewtopic.php?id=124615 #hydra_safe_run lvcreate -Z n -L$size -n $volume $vg - hydra_safe_run lvcreate -L$size -n $volume $vg + + if [ "$size" == "-1" ]; then + space="-l %FREE" + else + space="-L $size" + fi + + hydra_safe_run lvcreate $space -n $volume $vg fi } @@ -69,8 +77,8 @@ function hydra_create_volume { 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 home_size 0 "Size of home partition (0 to not create it)" -hydra_user_input var_size 0 "Size of var partition (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)" hydra_user_input garbage y "Pre-fill volumes with garbage? (y/n)" hydra_user_input hostname $HOSTNAME "Hostname" @@ -95,10 +103,12 @@ read answer # Disk partitioning. if [ "$swap" == "y" ]; then + hydra_user_input swap_size 2000 "Swap size (MB)" + 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 2000 - hydra_safe_run parted -s -- $device unit MB mkpart primary ext2 2000 2200 - hydra_safe_run parted -s -- $device unit MB mkpart primary ext2 2200 -1 + hydra_safe_run parted -s -- $device unit MB mkpart primary linux-swap 2 $swap_size + hydra_safe_run parted -s -- $device unit MB mkpart primary ext2 $swap_size $boot_end + hydra_safe_run parted -s -- $device unit MB mkpart primary ext2 $boot_end -1 hydra_safe_run parted -s -- $device set 2 boot on hydra_safe_run parted -s -- $device set 3 lvm on |