aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/hydra/config11
-rw-r--r--lib/hydra/misc11
-rw-r--r--share/config/provision/nas.conf2
-rw-r--r--share/config/provision/router.conf2
-rw-r--r--share/config/provision/stick.conf18
-rw-r--r--share/config/provision/tpc.conf2
-rwxr-xr-xshare/hydra/provision6
-rwxr-xr-xshare/hydractl/provision17
8 files changed, 49 insertions, 20 deletions
diff --git a/lib/hydra/config b/lib/hydra/config
index 5390159..da49ec7 100644
--- a/lib/hydra/config
+++ b/lib/hydra/config
@@ -83,3 +83,14 @@ function hydra_bootstrap_config {
make config
)
}
+
+# Get a configuration parameter if not previously defined by a sourced file
+function hydra_user_config {
+ local param="$1"
+ local default="$2"
+ shift 2
+
+ if [ -z "`eval echo '$'$param`" ]; then
+ hydra_user_input $param $default $*
+ fi
+}
diff --git a/lib/hydra/misc b/lib/hydra/misc
index 2c5789b..6081107 100644
--- a/lib/hydra/misc
+++ b/lib/hydra/misc
@@ -49,17 +49,6 @@ function hydra_user_input {
fi
}
-# Get a configuration parameter if not previously defined by a sourced file
-function hydra_user_config {
- local param="$1"
- local default="$2"
- shift 2
-
- if [ -z "`eval echo '$'$param`" ]; then
- hydra_user_input $param $default $*
- fi
-}
-
# Install a package
function hydra_install_package {
if [ -z "$1" ]; then
diff --git a/share/config/provision/nas.conf b/share/config/provision/nas.conf
index 5916383..a48e3d6 100644
--- a/share/config/provision/nas.conf
+++ b/share/config/provision/nas.conf
@@ -9,6 +9,6 @@ garbage="y" # Pre-fill volumes with garbage?
disable_zeroing="n" # Disable zeroing of lvm volumes?
random_swap="y" # Random swap?
arch="amd64" # System arch
-version="wheezy" # Distro version
+version="stretch" # Distro version
grub="n" # Setup GRUB?
mirror="http://http.debian.net/debian/" # Debian mirror
diff --git a/share/config/provision/router.conf b/share/config/provision/router.conf
index f3b763a..14d2597 100644
--- a/share/config/provision/router.conf
+++ b/share/config/provision/router.conf
@@ -9,6 +9,6 @@ garbage="n" # Pre-fill volumes with garbage?
disable_zeroing="n" # Disable zeroing of lvm volumes?
random_swap="n" # Random swap?
arch="amd64" # System arch
-version="wheezy" # Distro version
+version="stretch" # Distro version
grub="y" # Setup GRUB?
mirror="http://http.debian.net/debian/" # Debian mirror
diff --git a/share/config/provision/stick.conf b/share/config/provision/stick.conf
new file mode 100644
index 0000000..b47f38b
--- /dev/null
+++ b/share/config/provision/stick.conf
@@ -0,0 +1,18 @@
+#
+# Sample configuration for provisioning a machine in a USB stick.
+# The machine's disk is unencrypted.
+#
+
+interactive="n" # Interactive mode?
+swap_size="0" # Swap size
+root_size="-1" # Root size
+encrypt="n" # Encrypt volumes?
+disable_zeroing="n" # Disable zeroing of lvm volumes?
+domain="example.org" # Domain
+hostname="debian" # Hostname
+arch="amd64" # System arch
+version="stretch" # Distro version
+grub="y" # Setup GRUB?
+mirror="http://http.debian.net/debian/" # Debian mirror
+vg="debian" # Install vg
+ssh="n" # Install openssh-server?
diff --git a/share/config/provision/tpc.conf b/share/config/provision/tpc.conf
index 5c209a0..89faa5e 100644
--- a/share/config/provision/tpc.conf
+++ b/share/config/provision/tpc.conf
@@ -13,7 +13,7 @@ garbage="n" # Pre-fill volumes with garbage?
disable_zeroing="n" # Disable zeroing of lvm volumes?
random_swap="n" # Random swap?
arch="amd64" # System arch
-version="jessie" # Distro version
+version="stretch" # Distro version
grub="y" # Setup GRUB?
mirror="http://http.debian.net/debian/" # Debian mirror
ssh="n" # Install openssh-server?
diff --git a/share/hydra/provision b/share/hydra/provision
index 4c59b3d..a025a8e 100755
--- a/share/hydra/provision
+++ b/share/hydra/provision
@@ -34,5 +34,9 @@ if [ -z "$NODE" ]; then
( cd $CONFIG && tree )
exit 1
else
- hydractl $BASENAME $NODE
+ if [ -e "$CONFIG/$NODE.conf" ]; then
+ hydractl $BASENAME $CONFIG/$NODE.conf
+ elif [ -e "$APP_BASE/share/config/provision/$NODE.conf" ]; then
+ hydractl $BASENAME $APP_BASE/share/config/provision/$NODE.conf
+ fi
fi
diff --git a/share/hydractl/provision b/share/hydractl/provision
index e7877c3..96784c5 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -98,13 +98,13 @@ function hydra_provision_config {
hydra_user_config root_size 20G "Size of root partition (-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)"
+ 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)"
+ 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
@@ -112,11 +112,11 @@ function hydra_provision_config {
hydra_user_config encrypt y "Encrypt volumes? (if RAID, then encryption is default) (y/n)"
if [ "$encrypt" == "y" ]; then
- hydra_user_config garbage y "Pre-fill volumes with garbage? (y/n)"
+ 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)"
+ hydra_user_config random_swap y "Random swap? (y/n)"
fi
hydra_user_config disable_zeroing n "Disable zeroing of LVM volumes? (y/n)"
@@ -484,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/"' \
+ hydra_sudo_run 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
@@ -499,6 +499,8 @@ if [ "$grub" == "y" ]; then
# Fix menu entry
hydra_sudo_run sed -i -e "s|root=/dev/mapper/provision-root|root=/dev/mapper/root|g" $WORK/boot/grub/grub.cfg
hydra_sudo_run sed -i -e "s|root=/dev/mapper/$hostname-unlocked|root=/dev/mapper/root|g" $WORK/boot/grub/grub.cfg
+ else
+ hydra_sudo_run chroot $WORK/ grub-install --recheck --force $device
fi
fi
@@ -531,6 +533,11 @@ if [ "$ssh" == "y" ]; then
fi
echo "Umounting installation device..."
+
+if [ "$grub" == "y" ] && [ "$encrypt" != "y" ]; then
+ hydra_sudo_run umount $WORK/boot
+fi
+
hydra_sudo_run umount $WORK/sys $WORK/proc $WORK/dev $WORK
if [ "$swap_size" != "0" ]; then