diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-09-20 21:09:19 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-09-20 21:09:19 -0300 |
commit | c2e978e454c7534409996c83ed40ac60d6fe7894 (patch) | |
tree | 92cfe868e00d881857d60ed4644eaf353e85d590 /share/hydractl/provision | |
parent | 7f0bf86913cea7929931b6b276e88cc55311d167 (diff) | |
download | hydra-feature/nolvm.tar.gz hydra-feature/nolvm.tar.bz2 |
Initial code for provisioning without LVM, needs more codingfeature/nolvm
Diffstat (limited to 'share/hydractl/provision')
-rwxr-xr-x | share/hydractl/provision | 74 |
1 files changed, 43 insertions, 31 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision index 9bd8aac..3e2ee11 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -94,14 +94,19 @@ function hydra_provision_config { hydra_user_config interactive y "Interactive mode? (y/n)" hydra_user_config device /dev/sdb "Destination device" - hydra_user_config root_size 20G "Size of root partition" - hydra_user_config swap_size 2000 "Swap size (in MB, 0 to not create it)" - hydra_user_config home_size 20G "Size of home partition (0 to not create it, -1 for all free space)" - hydra_user_config var_size 20G "Size of var partition (0 to not create it, -1 for all free space)" + hydra_user_config lvm y "Use LVM (y/n)" + + if [ "$lvm" == "y" ]; then + hydra_user_config disable_zeroing n "Disable zeroing of LVM volumes? (y/n)" + hydra_user_config root_size 20G "Size of root partition" + hydra_user_config swap_size 2000 "Swap size (in MB, 0 to not create it)" + hydra_user_config home_size 20G "Size of home partition (0 to not create it, -1 for all free space)" + hydra_user_config var_size 20G "Size of var partition (0 to not create it, -1 for all free space)" + fi + hydra_user_config encrypt y "Encrypt volumes? (y/n)" hydra_user_config garbage y "Pre-fill volumes with garbage? (y/n)" hydra_user_config random_swap y "Random swap? (y/n)" - hydra_user_config disable_zeroing n "Disable zeroing of LVM volumes? (y/n)" hydra_user_config hostname machine "Hostname" hydra_user_config domain example.org "Domain" hydra_user_config arch $base_arch "System arch" @@ -145,49 +150,56 @@ hydra_safe_run parted -s -- $device unit MB mkpart ext2 3 200 hydra_safe_run parted -s -- $device unit MB mkpart ext2 200 -1 hydra_safe_run parted -s -- $device set 1 bios_grub on hydra_safe_run parted -s -- $device set 2 boot on -hydra_safe_run parted -s -- $device set 3 lvm on # Use absolute paths for devices. boot_device="$device"2 syst_device="$device"3 -# Create volumes. -echo "Creating the needed disk volumes..." +# LVM +if [ "$lvm" == "y" ]; then + hydra_safe_run parted -s -- $device set 3 lvm on -if ! pvdisplay $syst_device &> /dev/null; then - echo "Creating physical volume..." - hydra_safe_run pvcreate $syst_device -fi + echo "Creating the needed disk volumes..." -if ! vgdisplay $vg &> /dev/null; then - echo "Creating volume group..." - hydra_safe_run vgcreate $vg $syst_device -fi + if ! pvdisplay $syst_device &> /dev/null; then + echo "Creating physical volume..." + hydra_safe_run pvcreate $syst_device + fi -# Create root partition. -hydra_safe_run vgchange -a y $vg -hydra_provision_lvcreate root $root_size + if ! vgdisplay $vg &> /dev/null; then + echo "Creating volume group..." + hydra_safe_run vgcreate $vg $syst_device + fi -# Create swap partition -if [ "$swap_size" != "0" ]; then - hydra_provision_lvcreate swap $swap_size -fi + # Create root partition. + hydra_safe_run vgchange -a y $vg + hydra_provision_lvcreate root $root_size -# Create home partition. -if [ "$home_size" != "0" ]; then - hydra_provision_lvcreate home $home_size -fi + # Create swap partition + if [ "$swap_size" != "0" ]; then + hydra_provision_lvcreate swap $swap_size + fi -# Create var partition. -if [ "$var_size" != "0" ]; then - hydra_provision_lvcreate var $var_size + # Create home partition. + if [ "$home_size" != "0" ]; then + hydra_provision_lvcreate home $home_size + fi + + # Create var partition. + if [ "$var_size" != "0" ]; then + hydra_provision_lvcreate var $var_size + fi fi # Garbage. if [ "$garbage" == "y" ]; then echo "Filling volumes with garbage..." - dd if=/dev/urandom of=/dev/mapper/$vg-root + if [ "$lvm" == "y" ] && [ -b "/dev/mapper/$vg-root" ]; then + dd if=/dev/urandom of=/dev/mapper/$vg-root + else + dd if=/dev/urandom of=$syst_device + fi if [ -b "/dev/mapper/$vg-home" ]; then dd if=/dev/urandom of=/dev/mapper/$vg-home |