Commit b530b6a4 authored by Dennis Baurichter's avatar Dennis Baurichter
Browse files

bootstrap: Add --disk option

Previously the --vm option, which got replaced in commit bf88ce21, would
change the install disk from /dev/sda to /dev/vda (intended for our
previous libvirt setup).  This more generalized form has no current use
case in our production environment, but may be used e.g. for testing
with local VMs or other situations.
parent a2fe1d38
......@@ -4,11 +4,13 @@ set -eo pipefail
readonly ansible='https://git.cs.uni-paderborn.de/rbfsmi/rbfsmi-ansible.git'
readonly ansible_raw='https://git.cs.uni-paderborn.de/rbfsmi/rbfsmi-ansible/-/raw/master/'
readonly default_dev='/dev/sda'
packages="base base-devel linux btrfs-progs git ansible"
## argparse
devices=('/dev/sda')
dev=
devices=()
# partition prefixes: /dev/sda, /dev/loop1p, /dev/mmcblk1p etc.
devices_pp=()
domain=uni-paderborn.de
......@@ -48,6 +50,8 @@ while [[ $# -gt 0 ]]; do
echo " --allow-disk-wipe"
echo " Allow the script to wipe the disk and proceed with the installation."
echo " Without this option the user will be asked interactively for confirmation."
echo " --disk DEVICE"
echo " Install to disk DEVICE instead of $default_dev."
echo " --kernel-param PARAMETER"
echo " Add PARAMETER to EFI kernel command line."
echo " --bios"
......@@ -99,6 +103,10 @@ while [[ $# -gt 0 ]]; do
domain="$2"
shift
;;
--disk)
dev="$2"
shift
;;
--kernel-param)
kparam+=("$2")
shift
......@@ -130,7 +138,6 @@ while [[ $# -gt 0 ]]; do
exit 1
esac
shift
devices=("$@")
break
;;
--set-root-pw)
......@@ -157,6 +164,22 @@ if [ 21 -le "$(wc -c <<< "$hostname")" ]; then
exit 1
fi
if [ -z "$dev" ]; then
if [ -z "$raid_action" ]; then
# no --disk, no --raid
devices=("$default_dev")
else
devices=("$@")
fi
else
if [ -z "$raid_action" ]; then
devices=("$dev")
else
>&2 echo "Error: --disk and --raid are mutually exclusive"
exit 1
fi
fi
if [ -n "$raid_action" -a "${#devices[@]}" -lt 4 ]; then
>&2 echo "Error: RAID 6 requires at least 4 drives, but only ${#devices[@]} were given"
exit 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment