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
+}
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
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
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
--- /dev/null
+#
+# 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?
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?
( 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
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
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)"
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
# 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
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