diff --git a/scripts/functions.sh b/scripts/functions.sh index fb895bb..6b52a33 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -49,8 +49,8 @@ check_config() { IS_EFI=false fi - if [[ $INSTALL_ANSIBLE == true ]]; then - [[ $INSTALL_SSHD == true ]] \ + if [[ $INSTALL_ANSIBLE == "true" ]]; then + [[ $INSTALL_SSHD == "true" ]] \ || die "You must enable INSTALL_SSHD for ansible" [[ -n $ANSIBLE_SSH_AUTHORIZED_KEYS ]] \ || die "Missing pubkey for ansible user" @@ -76,9 +76,9 @@ prepare_installation_environment() { check_has_program uuidgen check_has_program wget - [[ $USED_RAID == true ]] \ + [[ $USED_RAID == "true" ]] \ && check_has_program mdadm - [[ $USED_LUKS == true ]] \ + [[ $USED_LUKS == "true" ]] \ && check_has_program cryptsetup sync_time @@ -118,7 +118,7 @@ summary_color_args() { disk_create_gpt() { local new_id="${arguments[new_id]}" - if [[ $disk_action_summarize_only == true ]]; then + if [[ $disk_action_summarize_only == "true" ]]; then if [[ -v arguments[id] ]]; then add_summary_entry "${arguments[id]}" "$new_id" "gpt" "" "" else @@ -151,7 +151,7 @@ disk_create_partition() { local id="${arguments[id]}" local size="${arguments[size]}" local type="${arguments[type]}" - if [[ $disk_action_summarize_only == true ]]; then + if [[ $disk_action_summarize_only == "true" ]]; then add_summary_entry "$id" "$new_id" "part" "($type)" "$(summary_color_args size)" return 0 fi @@ -189,7 +189,7 @@ disk_create_raid() { local level="${arguments[level]}" local name="${arguments[name]}" local ids="${arguments[ids]}" - if [[ $disk_action_summarize_only == true ]]; then + if [[ $disk_action_summarize_only == "true" ]]; then local id # Splitting is intentional here # shellcheck disable=SC2086 @@ -233,7 +233,7 @@ disk_create_raid() { disk_create_luks() { local new_id="${arguments[new_id]}" local id="${arguments[id]}" - if [[ $disk_action_summarize_only == true ]]; then + if [[ $disk_action_summarize_only == "true" ]]; then add_summary_entry "$id" "$new_id" "luks" "" "" return 0 fi @@ -277,7 +277,7 @@ disk_format() { local id="${arguments[id]}" local type="${arguments[type]}" local label="${arguments[label]}" - if [[ $disk_action_summarize_only == true ]]; then + if [[ $disk_action_summarize_only == "true" ]]; then add_summary_entry "${arguments[id]}" "__fs__${arguments[id]}" "${arguments[type]}" "(fs)" "$(summary_color_args label)" return 0 fi @@ -335,7 +335,7 @@ print_summary_tree_entry() { local d="1" local maxd="$((depth - 1))" while [[ $d -lt $maxd ]]; do - if [[ ${summary_depth_continues[$d]} == true ]]; then + if [[ ${summary_depth_continues[$d]} == "true" ]]; then indent_chars+='│ ' else indent_chars+=' ' @@ -344,7 +344,7 @@ print_summary_tree_entry() { d="$((d + 1))" done if [[ $maxd -gt 0 ]]; then - if [[ ${summary_depth_continues[$maxd]} == true ]]; then + if [[ ${summary_depth_continues[$maxd]} == "true" ]]; then indent_chars+='├─' else indent_chars+='└─' @@ -393,7 +393,7 @@ print_summary_tree() { print_summary_tree_entry "$root" fi - if [[ $has_children == true ]]; then + if [[ $has_children == "true" ]]; then local count="$(tr ';' '\n' <<< "$children" | grep -c '\S')" local idx=0 # Splitting is intentional here @@ -404,7 +404,7 @@ print_summary_tree() { && summary_depth_continues[$depth]=false print_summary_tree "$id" # separate blocks by newline - [[ ${summary_depth_continues[0]} == true ]] && [[ $depth == 1 ]] && [[ $idx == "$count" ]] \ + [[ ${summary_depth_continues[0]} == "true" ]] && [[ $depth == 1 ]] && [[ $idx == "$count" ]] \ && elog done fi @@ -632,7 +632,7 @@ gentoo_chroot() { gentoo_chroot /bin/bash --init-file <(echo 'init_bash') fi - [[ $EXECUTED_IN_CHROOT != true ]] \ + [[ $EXECUTED_IN_CHROOT != "true" ]] \ || die "Already in chroot" gentoo_umount diff --git a/scripts/main.sh b/scripts/main.sh index 24044a9..c0730b0 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -28,7 +28,7 @@ source "$GENTOO_INSTALL_REPO_DIR/scripts/utils.sh" source "$GENTOO_INSTALL_REPO_DIR/scripts/config.sh" source "$GENTOO_INSTALL_REPO_DIR/scripts/functions.sh" -[[ $I_HAVE_READ_AND_EDITED_THE_CONFIG_PROPERLY == true ]] \ +[[ $I_HAVE_READ_AND_EDITED_THE_CONFIG_PROPERLY == "true" ]] \ || die "You have not properly read the config. Set I_HAVE_READ_AND_EDITED_THE_CONFIG_PROPERLY=true to continue." preprocess_config @@ -236,6 +236,12 @@ main_install_gentoo_in_chroot() { einfo "Installing git" try emerge --verbose dev-vcs/git + # Install mdadm if we used raid (needed for uuid resolving) + if [[ $USED_RAID == "true" ]]; then + einfo "Installing mdadm" + try emerge --verbose sys-fs/mdadm + fi + # Install kernel and initramfs install_kernel @@ -247,7 +253,7 @@ main_install_gentoo_in_chroot() { try emerge --verbose app-portage/gentoolkit # Install and enable sshd - if [[ $INSTALL_SSHD == true ]]; then + if [[ $INSTALL_SSHD == "true" ]]; then install_sshd fi @@ -258,7 +264,7 @@ main_install_gentoo_in_chroot() { || die "Could not add dhcpcd to default services" # Install ansible - if [[ $INSTALL_ANSIBLE == true ]]; then + if [[ $INSTALL_ANSIBLE == "true" ]]; then install_ansible fi diff --git a/scripts/protection.sh b/scripts/protection.sh index 780f988..c1436bd 100644 --- a/scripts/protection.sh +++ b/scripts/protection.sh @@ -1,4 +1,4 @@ -if [[ "$GENTOO_INSTALL_REPO_SCRIPT_ACTIVE" != true ]]; then +if [[ "$GENTOO_INSTALL_REPO_SCRIPT_ACTIVE" != "true" ]]; then echo " * ERROR: This script must not be executed directly!" >&2 exit 1 fi diff --git a/scripts/utils.sh b/scripts/utils.sh index 1929d44..095380f 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -281,7 +281,7 @@ parse_arguments() { fi done - [[ $has_opt == true ]] \ + [[ $has_opt == "true" ]] \ || die_trace 2 "Missing mandatory argument $m=..." ;;