From df332569de1162bd9a4deeb4c2c5271cbfdee6ad Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 3 Jul 2018 00:36:12 -0300 Subject: Provision fixes --- lib/hydra/provision | 2 +- share/hydractl/provision | 32 +++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/lib/hydra/provision b/lib/hydra/provision index 850230b..a2ebefe 100644 --- a/lib/hydra/provision +++ b/lib/hydra/provision @@ -45,7 +45,7 @@ EOF function hydra_provision_fingerprints { echo "OpenSSH fingerprints:" - hydra_sudo_run chroot $WORK ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub + #hydra_sudo_run chroot $WORK ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub hydra_sudo_run chroot $WORK ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub hydra_sudo_run chroot $WORK ssh-keygen -l -f /etc/ssh/ssh_host_ecdsa_key.pub hydra_sudo_run chroot $WORK ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub diff --git a/share/hydractl/provision b/share/hydractl/provision index 938b28e..e7877c3 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -96,11 +96,29 @@ function hydra_provision_config { hydra_user_config device /dev/sdb "Physical device(s) (more than one auto sets RAID mode)" hydra_user_config swap_size 2000 "Swap size (in MB, 0 to not create it)" hydra_user_config root_size 20G "Size of root partition (-1 for all free space)" - 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)" + + if [ "$root_size" != "-1" ]; then + hydra_user_config home_size 20G "Size of home partition (0 to not create it, -1 for all free space)" + else + home_size="0" + fi + + if [ "$root_size" != "-1" ] && [ "$home_size" != "-1" ]; then + hydra_user_config var_size 20G "Size of var partition (0 to not create it, -1 for all free space)" + else + var_size="0" + fi + hydra_user_config encrypt y "Encrypt volumes? (if RAID, then encryption is default) (y/n)" - hydra_user_config garbage y "Pre-fill volumes with garbage? (y/n)" - hydra_user_config random_swap y "Random swap? (y/n)" + + if [ "$encrypt" == "y" ]; then + hydra_user_config garbage y "Pre-fill volumes with garbage? (y/n)" + fi + + if [ "$swap_size" != "0" ]; then + hydra_user_config random_swap y "Random swap? (y/n)" + fi + 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" @@ -336,8 +354,8 @@ hydra_sudo_run mv $WORK/etc/hosts.new $WORK/etc/hosts # Apt if [ "$version" != "sid" ]; then - echo "deb http://security.debian.org/ $version/updates main contrib non-free" | $SUDO tee $WORK/etc/apt/sources.list - echo "deb-src http://security.debian.org/ $version/updates main contrib non-free" | $SUDO tee $WORK/etc/apt/sources.list + echo "deb http://security.debian.org/ $version/updates main contrib non-free" | $SUDO tee -a $WORK/etc/apt/sources.list + echo "deb-src http://security.debian.org/ $version/updates main contrib non-free" | $SUDO tee -a $WORK/etc/apt/sources.list fi # Initial upgrade. @@ -466,7 +484,7 @@ if [ "$grub" == "y" ]; then echo "Setting up GRUB..." $APT_INSTALL grub-pc -y - sed -i -e 's/^GRUB_CMDLINE_LINUX_DEFAULT="quiet"$/GRUB_CMDLINE_LINUX_DEFAULT="quiet apparmor=1 security=apparmor"' \ + sed -i -e 's/^GRUB_CMDLINE_LINUX_DEFAULT="quiet"$/GRUB_CMDLINE_LINUX_DEFAULT="quiet apparmor=1 security=apparmor/"' \ $WORK/etc/default/grub hydra_sudo_run chroot $WORK/ update-grub -- cgit v1.2.3