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