]> gitweb.fluxo.info Git - hydra.git/commitdiff
Provision fixes
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 3 Jul 2018 03:36:12 +0000 (00:36 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 3 Jul 2018 03:36:12 +0000 (00:36 -0300)
lib/hydra/provision
share/hydractl/provision

index 850230b91d88d513c91d5d656a9c24454538ce7a..a2ebefe0fcc132ab567049149e845596bce4693b 100644 (file)
@@ -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
index 938b28e00646a9a4367660b63865ce145a57bed6..e7877c3caef8634fa8ec658dfb2f57af77675432 100755 (executable)
@@ -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