V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 39s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 39s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
if [[ ${HANDLER_BRA} = 1 ]]; then
|
if [[ ${HANDLER_BRA} = 1 ]]; then
|
||||||
|
|
||||||
do_log "info" "true" "Branch 'testing' confirmed: '${BRANCH_SELECTION}'."
|
do_log "info" "file_only" "Branch 'testing' confirmed: '${BRANCH_SELECTION}'."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
do_log "info" "false" "Live environment DHCP information collection: timeout='${network_timeout_dhcp}' seconds. Please wait."
|
do_log "info" "file_only" "Live environment DHCP information collection: timeout='${network_timeout_dhcp}' seconds. Please wait."
|
||||||
|
|
||||||
dhclient -v -1 "${var_auto_nic}" 2>&1 | timeout "${network_timeout_dhcp}" dhcpdump -i "${var_auto_nic}" >> "${LOG_NIC}" || true
|
dhclient -v -1 "${var_auto_nic}" 2>&1 | timeout "${network_timeout_dhcp}" dhcpdump -i "${var_auto_nic}" >> "${LOG_NIC}" || true
|
||||||
awk 'BEGIN {RS="---------------------------------------------------------------------------"; \
|
awk 'BEGIN {RS="---------------------------------------------------------------------------"; \
|
||||||
ORS="---------------------------------------------------------------------------"} \
|
ORS="---------------------------------------------------------------------------"} \
|
||||||
NF {last=$0} END {print last}' "${LOG_NIC}" > "${LOG_NIC}".tmp && mv "${LOG_NIC}".tmp "${LOG_NIC}"
|
NF {last=$0} END {print last}' "${LOG_NIC}" > "${LOG_NIC}".tmp && mv "${LOG_NIC}".tmp "${LOG_NIC}"
|
||||||
|
|
||||||
do_log "info" "false" "Live environment DHCP information collection: collection completed."
|
do_log "info" "file_only" "Live environment DHCP information collection: collection completed."
|
||||||
|
|
||||||
### Extract 'FQDN' from '${LOG_NIC}'
|
### Extract 'FQDN' from '${LOG_NIC}'
|
||||||
var_auto_fqdn=$(awk -F 'Host name' '/Host name/ {print $2}' "${LOG_NIC}" | xargs)
|
var_auto_fqdn=$(awk -F 'Host name' '/Host name/ {print $2}' "${LOG_NIC}" | xargs)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ guard_sourcing
|
|||||||
# 0: on success
|
# 0: on success
|
||||||
#######################################
|
#######################################
|
||||||
check_nic() {
|
check_nic() {
|
||||||
|
# shellcheck disable=SC2312
|
||||||
ip -o link show | awk -F': ' '{print $2}' | sed 's!lo!!' | sed '/^$/d' | awk '{$1=$1};1' >| "${DIR_TMP}nic.tmp"
|
ip -o link show | awk -F': ' '{print $2}' | sed 's!lo!!' | sed '/^$/d' | awk '{$1=$1};1' >| "${DIR_TMP}nic.tmp"
|
||||||
declare var_counter=1
|
declare var_counter=1
|
||||||
declare var_line=""
|
declare var_line=""
|
||||||
@@ -37,7 +38,7 @@ check_nic() {
|
|||||||
var_nic=$(dialog --ascii-lines --clear --backtitle "Specify the NIC for setup" --radiolist "NIC available" 0 0 ${var_counter} ${var_radiolist} 3>&1 1>&2 2>&3)
|
var_nic=$(dialog --ascii-lines --clear --backtitle "Specify the NIC for setup" --radiolist "NIC available" 0 0 ${var_counter} ${var_radiolist} 3>&1 1>&2 2>&3)
|
||||||
clear
|
clear
|
||||||
|
|
||||||
do_log "info" "true" "You have selected: '${var_nic}' - proceeding with setup."
|
do_log "info" "file_only" "You have selected: '${var_nic}' - proceeding with setup."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ do_in_target() {
|
|||||||
declare -a ary_chroot_command=("$@")
|
declare -a ary_chroot_command=("$@")
|
||||||
|
|
||||||
if (( ${#ary_chroot_command[@]} == 0 )); then
|
if (( ${#ary_chroot_command[@]} == 0 )); then
|
||||||
do_log "emergency" "true" "Empty command passed to 'do_in_target()'."
|
do_log "emergency" "file_only" "Empty command passed to 'do_in_target()'."
|
||||||
return "${ERR_CHRT_COMMAND}"
|
return "${ERR_CHRT_COMMAND}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -49,10 +49,10 @@ do_in_target() {
|
|||||||
LC_ALL=C.UTF-8 \
|
LC_ALL=C.UTF-8 \
|
||||||
"${ary_chroot_command[@]}"
|
"${ary_chroot_command[@]}"
|
||||||
then
|
then
|
||||||
do_log "info" "true" "Success: chroot '${var_chroot_target}': '${ary_chroot_command[*]}'."
|
do_log "info" "file_only" "Success: chroot '${var_chroot_target}': '${ary_chroot_command[*]}'."
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
do_log "emergency" "true" "Failed: chroot '${var_chroot_target}': '${ary_chroot_command[*]}'."
|
do_log "emergency" "file_only" "Failed: chroot '${var_chroot_target}': '${ary_chroot_command[*]}'."
|
||||||
return "${ERR_CHRT_COMMAND}"
|
return "${ERR_CHRT_COMMAND}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -77,11 +77,11 @@ do_in_target_script() {
|
|||||||
declare var_chroot_script="$1"
|
declare var_chroot_script="$1"
|
||||||
|
|
||||||
if [[ -z "${var_chroot_script}" ]]; then
|
if [[ -z "${var_chroot_script}" ]]; then
|
||||||
do_log "emergency" "true" "Empty command passed to 'do_in_target_script()'."
|
do_log "emergency" "file_only" "Empty command passed to 'do_in_target_script()'."
|
||||||
return "${ERR_CHRT_COMMAND}"
|
return "${ERR_CHRT_COMMAND}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_log "debug" "true" "Evaluating chroot script in '${var_chroot_target}': '${var_chroot_script}'."
|
# do_log "debug" "file_only" "Evaluating chroot script in '${var_chroot_target}': '${var_chroot_script}'."
|
||||||
|
|
||||||
if chroot "${var_chroot_target}" /usr/bin/env -i \
|
if chroot "${var_chroot_target}" /usr/bin/env -i \
|
||||||
HOME=/root \
|
HOME=/root \
|
||||||
@@ -93,14 +93,14 @@ do_in_target_script() {
|
|||||||
|
|
||||||
then
|
then
|
||||||
|
|
||||||
do_log "info" "true" "Success: chroot '${var_chroot_target}': '${var_chroot_script}'."
|
do_log "info" "file_only" "Success: chroot '${var_chroot_target}': '${var_chroot_script}'."
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
declare -i var_chroot_rc="${?}"
|
declare -i var_chroot_rc="${?}"
|
||||||
do_log "emergency" "true" "Failure: chroot '${var_chroot_target}': '${var_chroot_script}'."
|
do_log "emergency" "file_only" "Failure: chroot '${var_chroot_target}': '${var_chroot_script}'."
|
||||||
do_log "debug" "true" "Return code: '${var_chroot_rc}'."
|
do_log "debug" "file_only" "Return code: '${var_chroot_rc}'."
|
||||||
|
|
||||||
# TODO: Test with Dialog Wrapper in interactive mode.
|
# TODO: Test with Dialog Wrapper in interactive mode.
|
||||||
#if [[ "${DEBUG_INTERACTIVE}" == "true" ]]; then
|
#if [[ "${DEBUG_INTERACTIVE}" == "true" ]]; then
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ do_print_fold() {
|
|||||||
declare var_color="$1"; shift
|
declare var_color="$1"; shift
|
||||||
declare var_msg_string="$*"
|
declare var_msg_string="$*"
|
||||||
declare var_formatted_string="${var_color}${var_msg_string}${RES}"
|
declare var_formatted_string="${var_color}${var_msg_string}${RES}"
|
||||||
|
# shellcheck disable=SC2312
|
||||||
printf "%b\n" "${var_formatted_string}" | fold -s -w 76 | sed '1! s/^/ /'
|
printf "%b\n" "${var_formatted_string}" | fold -s -w 76 | sed '1! s/^/ /'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ validation_ipv4() {
|
|||||||
declare var_ip="$1"
|
declare var_ip="$1"
|
||||||
### Single-pass check: 4 octets, each 0-255, no leading zeros (unless the octet is exactly "0")
|
### Single-pass check: 4 octets, each 0-255, no leading zeros (unless the octet is exactly "0")
|
||||||
if [[ "${var_ip}" =~ ^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$ ]]; then
|
if [[ "${var_ip}" =~ ^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$ ]]; then
|
||||||
do_log "info" "true" "'${var_ip}' seems to be a valid IPv4."
|
do_log "info" "file_only" "'${var_ip}' seems to be a valid IPv4."
|
||||||
else
|
else
|
||||||
return "${ERR_INVALID_IPV4}"
|
return "${ERR_INVALID_IPV4}"
|
||||||
fi
|
fi
|
||||||
@@ -86,7 +86,7 @@ validation_ipv6() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### Success
|
### Success
|
||||||
do_log "info" "true" "'${var_ip}' seems to be a valid IPv6."
|
do_log "info" "file_only" "'${var_ip}' seems to be a valid IPv6."
|
||||||
}
|
}
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
@@ -101,9 +101,9 @@ validation_ipv6() {
|
|||||||
validation_port() {
|
validation_port() {
|
||||||
declare var_port="$1"
|
declare var_port="$1"
|
||||||
if [[ "${var_port}" =~ ^[0-9]+$ ]] && (( var_port >= 1 && var_port <= 65535 )); then
|
if [[ "${var_port}" =~ ^[0-9]+$ ]] && (( var_port >= 1 && var_port <= 65535 )); then
|
||||||
do_log "info" "true" "'${var_port}' seems to be a valid port."
|
do_log "info" "file_only" "'${var_port}' seems to be a valid port."
|
||||||
else
|
else
|
||||||
do_log "error" "false" "'${var_port}' seems to be NOT a valid port."
|
do_log "error" "file_only" "'${var_port}' seems to be NOT a valid port."
|
||||||
return "${ERR_INVALID_PORT}"
|
return "${ERR_INVALID_PORT}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ validation_preseed() {
|
|||||||
if [[ -n "${value}" ]]; then
|
if [[ -n "${value}" ]]; then
|
||||||
validation_ipv4 "${value}"
|
validation_ipv4 "${value}"
|
||||||
else
|
else
|
||||||
do_log "info" "true" "'${var}' is not set."
|
do_log "info" "file_only" "'${var}' is not set."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ validation_preseed() {
|
|||||||
if [[ -n "${value}" ]]; then
|
if [[ -n "${value}" ]]; then
|
||||||
validation_ipv6 "${value}"
|
validation_ipv6 "${value}"
|
||||||
else
|
else
|
||||||
do_log "info" "false" "'${var}' is not set."
|
do_log "info" "file_only" "'${var}' is not set."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ yaml_reader() {
|
|||||||
done < "${var_if}"
|
done < "${var_if}"
|
||||||
|
|
||||||
if [[ -n "${VAR_RECIPE_STRING}" ]]; then
|
if [[ -n "${VAR_RECIPE_STRING}" ]]; then
|
||||||
do_log "info" "true" "Found active recipe string: '${VAR_RECIPE_STRING}'."
|
do_log "info" "file_only" "Found active recipe string: '${VAR_RECIPE_STRING}'."
|
||||||
else
|
else
|
||||||
do_log "fatal" "true" "Found NO active recipe string: '${VAR_RECIPE_STRING}'." >&2
|
do_log "fatal" "file_only" "Found NO active recipe string: '${VAR_RECIPE_STRING}'." >&2
|
||||||
exit "${ERR_NO_VALID_RECIPE}"
|
exit "${ERR_NO_VALID_RECIPE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -80,9 +80,9 @@ END { print max }
|
|||||||
declare -gx VAR_RECIPE_DEV_COUNTER="${var_highest_dev}"
|
declare -gx VAR_RECIPE_DEV_COUNTER="${var_highest_dev}"
|
||||||
|
|
||||||
if [[ -n "${VAR_RECIPE_DEV_COUNTER}" ]]; then
|
if [[ -n "${VAR_RECIPE_DEV_COUNTER}" ]]; then
|
||||||
do_log "info" "true" "Found highest recipe device: '${VAR_RECIPE_DEV_COUNTER}'."
|
do_log "info" "file_only" "Found highest recipe device: '${VAR_RECIPE_DEV_COUNTER}'."
|
||||||
else
|
else
|
||||||
do_log "fatal" "true" "Found NO highest recipe device: '${VAR_RECIPE_DEV_COUNTER}'." >&2
|
do_log "fatal" "file_only" "Found NO highest recipe device: '${VAR_RECIPE_DEV_COUNTER}'." >&2
|
||||||
exit "${ERR_NO_VALID_RECIPE}"
|
exit "${ERR_NO_VALID_RECIPE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ END { print max }
|
|||||||
done < <(grep -E "^recipe_${VAR_RECIPE_STRING}_dev_" "${var_if}")
|
done < <(grep -E "^recipe_${VAR_RECIPE_STRING}_dev_" "${var_if}")
|
||||||
|
|
||||||
for var_device in "${!HMP_RECIPE_DEV_PARTITIONS[@]}"; do
|
for var_device in "${!HMP_RECIPE_DEV_PARTITIONS[@]}"; do
|
||||||
do_log "info" "false" "Highest number of partitions for ${var_device}: ${HMP_RECIPE_DEV_PARTITIONS[${var_device}]}"
|
do_log "info" "file_only" "Highest number of partitions for ${var_device}: ${HMP_RECIPE_DEV_PARTITIONS[${var_device}]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
### Extract architecture
|
### Extract architecture
|
||||||
@@ -134,19 +134,19 @@ END { print max }
|
|||||||
|
|
||||||
if [[ "${VAR_RECIPE_TABLE,,}" == "gpt" && "${VAR_RECIPE_FIRMWARE,,}" == "uefi" ]]; then
|
if [[ "${VAR_RECIPE_TABLE,,}" == "gpt" && "${VAR_RECIPE_FIRMWARE,,}" == "uefi" ]]; then
|
||||||
|
|
||||||
do_log "info" "true" "Partition table: '${VAR_RECIPE_TABLE}' and firmware: '${VAR_RECIPE_FIRMWARE}' > ESP 'EF00' necessary."
|
do_log "info" "file_only" "Partition table: '${VAR_RECIPE_TABLE}' and firmware: '${VAR_RECIPE_FIRMWARE}' > ESP 'EF00' necessary."
|
||||||
|
|
||||||
elif [[ "${VAR_RECIPE_TABLE,,}" == "gpt" && "${VAR_RECIPE_FIRMWARE,,}" == "bios" ]]; then
|
elif [[ "${VAR_RECIPE_TABLE,,}" == "gpt" && "${VAR_RECIPE_FIRMWARE,,}" == "bios" ]]; then
|
||||||
|
|
||||||
do_log "info" "true" "Partition table: '${VAR_RECIPE_TABLE}' and firmware: '${VAR_RECIPE_FIRMWARE}' > BIOS Boot Partition 'EF02' necessary."
|
do_log "info" "file_only" "Partition table: '${VAR_RECIPE_TABLE}' and firmware: '${VAR_RECIPE_FIRMWARE}' > BIOS Boot Partition 'EF02' necessary."
|
||||||
|
|
||||||
elif [[ "${VAR_RECIPE_TABLE,,}" == "msdos" && "${VAR_RECIPE_FIRMWARE,,}" == "uefi" ]]; then
|
elif [[ "${VAR_RECIPE_TABLE,,}" == "msdos" && "${VAR_RECIPE_FIRMWARE,,}" == "uefi" ]]; then
|
||||||
|
|
||||||
do_log "info" "true" "Partition table: '${VAR_RECIPE_TABLE}' and firmware: '${VAR_RECIPE_FIRMWARE}' > ESP on MBR needs partition type '0xEF'."
|
do_log "info" "file_only" "Partition table: '${VAR_RECIPE_TABLE}' and firmware: '${VAR_RECIPE_FIRMWARE}' > ESP on MBR needs partition type '0xEF'."
|
||||||
|
|
||||||
elif [[ "${VAR_RECIPE_TABLE,,}" == "msdos" && "${VAR_RECIPE_FIRMWARE,,}" == "bios" ]]; then
|
elif [[ "${VAR_RECIPE_TABLE,,}" == "msdos" && "${VAR_RECIPE_FIRMWARE,,}" == "bios" ]]; then
|
||||||
|
|
||||||
do_log "info" "true" "Partition table: '${VAR_RECIPE_TABLE}' and firmware: '${VAR_RECIPE_FIRMWARE}' > No special firmware partition necessary."
|
do_log "info" "file_only" "Partition table: '${VAR_RECIPE_TABLE}' and firmware: '${VAR_RECIPE_FIRMWARE}' > No special firmware partition necessary."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ partitioning() {
|
|||||||
|
|
||||||
### All current data for the respective device will be deleted.
|
### All current data for the respective device will be deleted.
|
||||||
if ! blkdiscard "/dev/${var_dev}"; then
|
if ! blkdiscard "/dev/${var_dev}"; then
|
||||||
do_log "fatal" "false" "Partition table deletion '/dev/${var_dev}' failed."
|
do_log "fatal" "file_only" "Partition table deletion '/dev/${var_dev}' failed."
|
||||||
return "${ERR_TABLE_DELETE}"
|
return "${ERR_TABLE_DELETE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_log "info" "false" "Partition table of '/dev/${var_dev}' discarded."
|
do_log "info" "file_only" "Partition table of '/dev/${var_dev}' discarded."
|
||||||
|
|
||||||
case "${VAR_RECIPE_TABLE,,}" in
|
case "${VAR_RECIPE_TABLE,,}" in
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ partitioning() {
|
|||||||
do_log "fatal" "false" "Partition table creation '/dev/${var_dev}' failed."
|
do_log "fatal" "false" "Partition table creation '/dev/${var_dev}' failed."
|
||||||
return "${ERR_TABLE_CREATE}"
|
return "${ERR_TABLE_CREATE}"
|
||||||
fi
|
fi
|
||||||
do_log "info" "false" "Partition table '${VAR_RECIPE_TABLE}' of '/dev/${var_dev}' generated."
|
do_log "info" "file_only" "Partition table '${VAR_RECIPE_TABLE}' of '/dev/${var_dev}' generated."
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
do_log "fatal" "false" "No valid partition table chosen. String was '${VAR_RECIPE_TABLE}'."
|
do_log "fatal" "file_only" "No valid partition table chosen. String was '${VAR_RECIPE_TABLE}'."
|
||||||
return "${ERR_PARTITIONTBL}"
|
return "${ERR_PARTITIONTBL}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -85,22 +85,22 @@ partitioning() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! parted -s "/dev/${var_dev}" mkpart "${var_pri}" "${var_fs}" "${var_begin}" "${var_end_arg}"; then
|
if ! parted -s "/dev/${var_dev}" mkpart "${var_pri}" "${var_fs}" "${var_begin}" "${var_end_arg}"; then
|
||||||
do_log "fatal" "false" "Partition creation '/dev/${var_dev}${var_part}' failed."
|
do_log "fatal" "file_only" "Partition creation '/dev/${var_dev}${var_part}' failed."
|
||||||
return "${ERR_PART_CREATE}"
|
return "${ERR_PART_CREATE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_log "info" "false" "Partition generated: '${var_part}' | on device '/dev/${var_dev}' | begin: '${var_begin}' | end: '${var_end_arg}'."
|
do_log "info" "file_only" "Partition generated: '${var_part}' | on device '/dev/${var_dev}' | begin: '${var_begin}' | end: '${var_end_arg}'."
|
||||||
|
|
||||||
### Set the bootable flag if necessary.
|
### Set the bootable flag if necessary.
|
||||||
if [[ "${var_boot,,}" == "true" ]]; then
|
if [[ "${var_boot,,}" == "true" ]]; then
|
||||||
parted -s "/dev/${var_dev}" set "${var_part}" boot on
|
parted -s "/dev/${var_dev}" set "${var_part}" boot on
|
||||||
do_log "info" "false" "Partition: '/dev/${var_dev}${var_part}' marked as bootable."
|
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' marked as bootable."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Store UUID of the partition.
|
### Store UUID of the partition.
|
||||||
var_uuid=$(blkid -s UUID -o value "/dev/${var_dev}${var_part}")
|
var_uuid=$(blkid -s UUID -o value "/dev/${var_dev}${var_part}")
|
||||||
if [[ -z "${var_uuid}" ]]; then
|
if [[ -z "${var_uuid}" ]]; then
|
||||||
do_log "fatal" "false" "WARNING: could not read UUID for '/dev/${var_dev}${var_part}'."
|
do_log "fatal" "file_only" "WARNING: could not read UUID for '/dev/${var_dev}${var_part}'."
|
||||||
return "${ERR_PART_READ}"
|
return "${ERR_PART_READ}"
|
||||||
else
|
else
|
||||||
HMP_PATH_PARTUUID["UUID_${var_mount_path}"]="${var_uuid}"
|
HMP_PATH_PARTUUID["UUID_${var_mount_path}"]="${var_uuid}"
|
||||||
|
|||||||
@@ -96,18 +96,18 @@ partition_encryption() {
|
|||||||
SWAP|/tmp)
|
SWAP|/tmp)
|
||||||
|
|
||||||
mkfs.ext4 -L "${var_filesystem_label}" "/dev/${var_dev}${var_part}" 1M
|
mkfs.ext4 -L "${var_filesystem_label}" "/dev/${var_dev}${var_part}" 1M
|
||||||
do_log "info" "true" "Ephemeral: '${var_mount_path}' prepared on: '/dev/${var_dev}${var_part}'."
|
do_log "info" "file_only" "Ephemeral: '${var_mount_path}' prepared on: '/dev/${var_dev}${var_part}'."
|
||||||
|
|
||||||
HMP_EPHEMERAL_DEV["${var_mount_path}"]="/dev/${var_dev}${var_part}"
|
HMP_EPHEMERAL_DEV["${var_mount_path}"]="/dev/${var_dev}${var_part}"
|
||||||
HMP_EPHEMERAL_ENCLABEL["${var_mount_path}"]="${var_encryption_label}"
|
HMP_EPHEMERAL_ENCLABEL["${var_mount_path}"]="${var_encryption_label}"
|
||||||
HMP_EPHEMERAL_FS_LABEL["${var_mount_path}"]="${var_filesystem_label}"
|
HMP_EPHEMERAL_FS_LABEL["${var_mount_path}"]="${var_filesystem_label}"
|
||||||
do_log "info" "true" "Stored in HashMap [HMP_EPHEMERAL_DEV] : '${var_mount_path}' -> '${HMP_EPHEMERAL_DEV["${var_mount_path}"]}'"
|
do_log "info" "file_only" "Stored in HashMap [HMP_EPHEMERAL_DEV] : '${var_mount_path}' -> '${HMP_EPHEMERAL_DEV["${var_mount_path}"]}'"
|
||||||
do_log "info" "true" "Stored in HashMap [HMP_EPHEMERAL_ENCLABEL]: '${var_mount_path}' -> '${HMP_EPHEMERAL_ENCLABEL["${var_mount_path}"]}'"
|
do_log "info" "file_only" "Stored in HashMap [HMP_EPHEMERAL_ENCLABEL]: '${var_mount_path}' -> '${HMP_EPHEMERAL_ENCLABEL["${var_mount_path}"]}'"
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
do_log "error" "true" "Invalid mount path: '${var_mount_path}' for partition: '/dev/${var_dev}${var_part}'."
|
do_log "error" "file_only" "Invalid mount path: '${var_mount_path}' for partition: '/dev/${var_dev}${var_part}'."
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -119,16 +119,16 @@ partition_encryption() {
|
|||||||
|
|
||||||
if [[ "${var_encryption_integrity,,}" == "true" ]]; then
|
if [[ "${var_encryption_integrity,,}" == "true" ]]; then
|
||||||
|
|
||||||
do_log "info" "true" "Partition: '/dev/${var_dev}${var_part}' dm-integrity encrypted."
|
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' dm-integrity encrypted."
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
do_log "info" "true" "Partition: '/dev/${var_dev}${var_part}' encrypted."
|
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' encrypted."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cryptsetup luksHeaderBackup --header-backup-file="${DIR_BAK}/luks_header_${var_dev}${var_part}.bak" "/dev/${var_dev}${var_part}"
|
cryptsetup luksHeaderBackup --header-backup-file="${DIR_BAK}/luks_header_${var_dev}${var_part}.bak" "/dev/${var_dev}${var_part}"
|
||||||
do_log "info" "true" "Partition: '/dev/${var_dev}${var_part}' LUKS Header saved: '${DIR_BAK}/luks_header_${var_dev}${var_part}.bak'."
|
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' LUKS Header saved: '${DIR_BAK}/luks_header_${var_dev}${var_part}.bak'."
|
||||||
|
|
||||||
### Opening encrypted container.
|
### Opening encrypted container.
|
||||||
if [[ "${var_mount_path,,}" == "/boot" ]]; then
|
if [[ "${var_mount_path,,}" == "/boot" ]]; then
|
||||||
@@ -140,7 +140,7 @@ partition_encryption() {
|
|||||||
--key-file="${DIR_CNF}/password_luks_common.txt" \
|
--key-file="${DIR_CNF}/password_luks_common.txt" \
|
||||||
"${var_encryption_label}"
|
"${var_encryption_label}"
|
||||||
fi
|
fi
|
||||||
do_log "info" "true" "Partition: '/dev/${var_dev}${var_part}' opened as '/dev/mapper/${var_encryption_label}'."
|
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' opened as '/dev/mapper/${var_encryption_label}'."
|
||||||
|
|
||||||
### Store UUID of the LUKS container.
|
### Store UUID of the LUKS container.
|
||||||
var_uuid=$(blkid -s UUID -o value "/dev/mapper/${var_encryption_label}")
|
var_uuid=$(blkid -s UUID -o value "/dev/mapper/${var_encryption_label}")
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ partition_formatting() {
|
|||||||
case "${var_mount_path,,}" in
|
case "${var_mount_path,,}" in
|
||||||
swap|/tmp)
|
swap|/tmp)
|
||||||
mkfs.ext4 -L "${var_fs_label}" "/dev/${var_dev}${var_part}" 1M
|
mkfs.ext4 -L "${var_fs_label}" "/dev/${var_dev}${var_part}" 1M
|
||||||
do_log "info" "false" "Partition: '/dev/${var_dev}${var_part}' ephemeral encryption prepared for: '${var_mount_path}'."
|
do_log "info" "file_only" "Partition: '/dev/${var_dev}${var_part}' ephemeral encryption prepared for: '${var_mount_path}'."
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -77,7 +77,7 @@ partition_formatting() {
|
|||||||
ary_opts=( -L "${var_fs_label}" -f --csum "${var_fs_btrfs_checksum}" -O compress="${var_fs_btrfs_compress}" )
|
ary_opts=( -L "${var_fs_label}" -f --csum "${var_fs_btrfs_checksum}" -O compress="${var_fs_btrfs_compress}" )
|
||||||
[[ "${var_fs_btrfs_dedup,,}" == "true" ]] && ary_opts+=( -m dup )
|
[[ "${var_fs_btrfs_dedup,,}" == "true" ]] && ary_opts+=( -m dup )
|
||||||
mkfs.btrfs "${ary_opts[@]}" "${var_node}"
|
mkfs.btrfs "${ary_opts[@]}" "${var_node}"
|
||||||
do_log "info" "false" "Partition: '${var_node}' formatted: btrfs."
|
do_log "info" "file_only" "Partition: '${var_node}' formatted: btrfs."
|
||||||
echo "Partition: '${var_node}':" >> "${DIR_LOG}/btrfs.log"
|
echo "Partition: '${var_node}':" >> "${DIR_LOG}/btrfs.log"
|
||||||
btrfs filesystem show "${var_node}" >> "${DIR_LOG}/btrfs.log"
|
btrfs filesystem show "${var_node}" >> "${DIR_LOG}/btrfs.log"
|
||||||
var_fs_uuid=$(blkid -s UUID -o value "${var_node}")
|
var_fs_uuid=$(blkid -s UUID -o value "${var_node}")
|
||||||
@@ -87,7 +87,7 @@ partition_formatting() {
|
|||||||
ext4)
|
ext4)
|
||||||
read -r -a ary_fmt_opts <<< "${var_fs_options}"
|
read -r -a ary_fmt_opts <<< "${var_fs_options}"
|
||||||
mkfs.ext4 -L "${var_fs_label}" "${ary_fmt_opts[@]}" "${var_node}"
|
mkfs.ext4 -L "${var_fs_label}" "${ary_fmt_opts[@]}" "${var_node}"
|
||||||
do_log "info" "false" "Partition: '${var_node}' formatted: ext4."
|
do_log "info" "file_only" "Partition: '${var_node}' formatted: ext4."
|
||||||
echo "Partition: '${var_node}':" >> "${DIR_LOG}/ext4.log"
|
echo "Partition: '${var_node}':" >> "${DIR_LOG}/ext4.log"
|
||||||
tune2fs -l "${var_node}" >> "${DIR_LOG}/ext4.log"
|
tune2fs -l "${var_node}" >> "${DIR_LOG}/ext4.log"
|
||||||
var_fs_uuid=$(blkid -s UUID -o value "${var_node}")
|
var_fs_uuid=$(blkid -s UUID -o value "${var_node}")
|
||||||
@@ -96,13 +96,13 @@ partition_formatting() {
|
|||||||
|
|
||||||
fat32)
|
fat32)
|
||||||
mkfs.fat -F 32 -n "${var_fs_label}" "${var_node}"
|
mkfs.fat -F 32 -n "${var_fs_label}" "${var_node}"
|
||||||
do_log "info" "false" "Partition: '${var_node}' formatted: FAT32."
|
do_log "info" "file_only" "Partition: '${var_node}' formatted: FAT32."
|
||||||
var_fs_uuid=$(blkid -s UUID -o value "${var_node}")
|
var_fs_uuid=$(blkid -s UUID -o value "${var_node}")
|
||||||
HMP_PATH_FSUUID["UUID_${var_mount_path}"]="${var_fs_uuid}"
|
HMP_PATH_FSUUID["UUID_${var_mount_path}"]="${var_fs_uuid}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
do_log "error" "false" "Unsupported filesystem format: '${var_fs_version}'."
|
do_log "error" "file_only" "Unsupported filesystem format: '${var_fs_version}'."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -61,13 +61,13 @@ setup_filesystem() {
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
do_log "error" "false" "Invalid value for encryption_enable: '${var_encryption_enable}', should be true or false."
|
do_log "error" "file_only" "Invalid value for encryption_enable: '${var_encryption_enable}', should be true or false."
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
HMP_MOUNTPATH_DEV["${var_mount_path}"]="${var_node}"
|
HMP_MOUNTPATH_DEV["${var_mount_path}"]="${var_node}"
|
||||||
do_log "info" "false" "Saved in HashMap HMP_MOUNTPATH_DEV: '${var_mount_path}' -> '${HMP_MOUNTPATH_DEV["${var_mount_path}"]}'"
|
do_log "info" "file_only" "Saved in HashMap HMP_MOUNTPATH_DEV: '${var_mount_path}' -> '${HMP_MOUNTPATH_DEV["${var_mount_path}"]}'"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ mount_with_dir() {
|
|||||||
ary_cmd+=("${var_mount_device}" "${TARGET}${var_mount_path}")
|
ary_cmd+=("${var_mount_device}" "${TARGET}${var_mount_path}")
|
||||||
|
|
||||||
safe_exec "${ary_cmd[@]}" "${ERR_MOUNTING_DEV}" || return
|
safe_exec "${ary_cmd[@]}" "${ERR_MOUNTING_DEV}" || return
|
||||||
do_log "info" "false" "Mounted: '${var_mount_device}' on: '${TARGET}${var_mount_path}' (Options='${var_mount_options}')."
|
do_log "info" "file_only" "Mounted: '${var_mount_device}' on: '${TARGET}${var_mount_path}' (Options='${var_mount_options}')."
|
||||||
}
|
}
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
@@ -81,7 +81,7 @@ validate_btrfs_compression() {
|
|||||||
declare var_algo="$1" var_level="$2"
|
declare var_algo="$1" var_level="$2"
|
||||||
case "${var_algo}:${var_level}" in
|
case "${var_algo}:${var_level}" in
|
||||||
zstd:|zstd:[0-9]|zstd:1[0-9]|zstd:2[0-2]|lzo:) return 0 ;;
|
zstd:|zstd:[0-9]|zstd:1[0-9]|zstd:2[0-2]|lzo:) return 0 ;;
|
||||||
*) do_log "error" "false" "Invalid btrfs compression '${var_algo}:${var_level}'"; return "${ERR_BTRFS_OPTION}" ;;
|
*) do_log "error" "file_only" "Invalid btrfs compression '${var_algo}:${var_level}'"; return "${ERR_BTRFS_OPTION}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ mount_partition() {
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
do_log "error" "false" "Root-filesystem '${var_mount_path_root}' not found in Hashmap."
|
do_log "error" "file_only" "Root-filesystem '${var_mount_path_root}' not found in Hashmap."
|
||||||
return "${ERR_MOUNTING_ROOT}"
|
return "${ERR_MOUNTING_ROOT}"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -129,7 +129,7 @@ mount_partition() {
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
do_log "info" "false" "Entry '${var_path}' not found in Hashmap."
|
do_log "info" "file_only" "Entry '${var_path}' not found in Hashmap."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ mount_partition() {
|
|||||||
--sector-size 4096 "/dev/disk/by-label/${var_fs_label}" "${var_encryption_label}"
|
--sector-size 4096 "/dev/disk/by-label/${var_fs_label}" "${var_encryption_label}"
|
||||||
mkswap "/dev/mapper/${var_encryption_label}"
|
mkswap "/dev/mapper/${var_encryption_label}"
|
||||||
swapon "/dev/mapper/${var_encryption_label}"
|
swapon "/dev/mapper/${var_encryption_label}"
|
||||||
do_log "info" "false" "Mounted: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
do_log "info" "file_only" "Mounted: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif [[ "${var_mount_path}" == "/tmp" ]]; then
|
elif [[ "${var_mount_path}" == "/tmp" ]]; then
|
||||||
@@ -192,7 +192,7 @@ mount_partition() {
|
|||||||
ary_cmd2+=("/dev/mapper/${var_encryption_label}" "${TARGET}${var_mount_path}")
|
ary_cmd2+=("/dev/mapper/${var_encryption_label}" "${TARGET}${var_mount_path}")
|
||||||
|
|
||||||
safe_exec "${ary_cmd2[@]}" "${ERR_MOUNTING_DEV}" || return "${ERR_MOUNTING_DEV}"
|
safe_exec "${ary_cmd2[@]}" "${ERR_MOUNTING_DEV}" || return "${ERR_MOUNTING_DEV}"
|
||||||
do_log "info" "false" "Mounted: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
do_log "info" "file_only" "Mounted: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -230,7 +230,7 @@ mount_partition() {
|
|||||||
ext4:*)
|
ext4:*)
|
||||||
mount_with_dir "${var_mount_path}" "${var_resolved_dev}" "${var_mount_options}" || return "${ERR_MOUNTING_DEV}"
|
mount_with_dir "${var_mount_path}" "${var_resolved_dev}" "${var_mount_options}" || return "${ERR_MOUNTING_DEV}"
|
||||||
;;
|
;;
|
||||||
*) do_log "error" "false" "Unsupported fs/encryption combination."
|
*) do_log "error" "file_only" "Unsupported fs/encryption combination."
|
||||||
return "${ERR_MOUNTING_DEV}" ;;
|
return "${ERR_MOUNTING_DEV}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
# SPDX-PackageName: CISS.2025.hardened.installer
|
# SPDX-PackageName: CISS.2025.hardened.installer
|
||||||
# SPDX-Security-Contact: security@coresecret.eu
|
# SPDX-Security-Contact: security@coresecret.eu
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
# 3.8.9. Functions - installation - wrapper recovery #
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
# Wrapper to check if recovery partition is selected and if so, proceed with setup of recovery OS.
|
# Wrapper to check if recovery partition is selected and if so, proceed with setup of recovery OS.
|
||||||
# Globals:
|
# Globals:
|
||||||
@@ -23,10 +19,7 @@
|
|||||||
# Arguments:
|
# Arguments:
|
||||||
# None
|
# None
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
3_8_9_functions_installation_wrapper_recovery() {
|
wrapper_recovery() {
|
||||||
declare -g -x MODULE_ERR="3_8_9_functions_installation_wrapper_recovery"
|
|
||||||
declare -g -x MODULE_TXT="Wrapper recovery partition"
|
|
||||||
do_show_header "${MODULE_TXT}"
|
|
||||||
|
|
||||||
declare FOUND="false"
|
declare FOUND="false"
|
||||||
declare MOUNT_PATH=""
|
declare MOUNT_PATH=""
|
||||||
@@ -44,7 +37,5 @@
|
|||||||
3_9_0_functions_installation_setup_recovery
|
3_9_0_functions_installation_setup_recovery
|
||||||
3_9_1_functions_installation_generate_files_recovery
|
3_9_1_functions_installation_generate_files_recovery
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_show_footer "${MODULE_TXT}"
|
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh:
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
# SPDX-PackageName: CISS.2025.hardened.installer
|
# SPDX-PackageName: CISS.2025.hardened.installer
|
||||||
# SPDX-Security-Contact: security@coresecret.eu
|
# SPDX-Security-Contact: security@coresecret.eu
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
# 3.9.0. Functions - installation - setup recovery #
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
# Mounting '/dev/mapper/crypt_rescue', debootstrap recovery partition, preparing chroot.
|
# Mounting '/dev/mapper/crypt_rescue', debootstrap recovery partition, preparing chroot.
|
||||||
# Globals:
|
# Globals:
|
||||||
@@ -26,10 +22,7 @@
|
|||||||
# Arguments:
|
# Arguments:
|
||||||
# None
|
# None
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
3_9_0_functions_installation_setup_recovery() {
|
setup_recovery() {
|
||||||
declare -g -x MODULE_ERR="3_9_0_functions_installation_setup_recovery"
|
|
||||||
declare -g -x MODULE_TXT="Setup recovery partition"
|
|
||||||
do_show_header "${MODULE_TXT}"
|
|
||||||
|
|
||||||
# The '/dev/mapper/crypt_rescue' partition is not mounted by the installation script by default,
|
# The '/dev/mapper/crypt_rescue' partition is not mounted by the installation script by default,
|
||||||
# as it is not required to be automatically mounted by the production system via '/etc/crypttab' and '/etc/fstab'.
|
# as it is not required to be automatically mounted by the production system via '/etc/crypttab' and '/etc/fstab'.
|
||||||
@@ -37,9 +30,9 @@
|
|||||||
|
|
||||||
# Debootstrap for a minimalistic Debian OS.
|
# Debootstrap for a minimalistic Debian OS.
|
||||||
if debootstrap --arch amd64 bookworm "${RECOVERY}" https://deb.debian.org/debian; then
|
if debootstrap --arch amd64 bookworm "${RECOVERY}" https://deb.debian.org/debian; then
|
||||||
do_log "info" "false" "Executing 'debootstrap --arch amd64 bookworm '${RECOVERY}' https://deb.debian.org/debian' successful."
|
do_log "info" "file_only" "Executing 'debootstrap --arch amd64 bookworm '${RECOVERY}' https://deb.debian.org/debian' successful."
|
||||||
else
|
else
|
||||||
do_log "emergency" "false" "Executing 'debootstrap --arch amd64 bookworm '${RECOVERY}' https://deb.debian.org/debian' NOT successful."
|
do_log "emergency" "file_only" "Executing 'debootstrap --arch amd64 bookworm '${RECOVERY}' https://deb.debian.org/debian' NOT successful."
|
||||||
exit "${ERR_DE_BOOT_STRAP}"
|
exit "${ERR_DE_BOOT_STRAP}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -52,37 +45,37 @@
|
|||||||
|
|
||||||
# Prepare the freshly installed Debian OS recovery system for further setup.
|
# Prepare the freshly installed Debian OS recovery system for further setup.
|
||||||
if mount --make-rslave --rbind /proc "${RECOVERY}"/proc; then
|
if mount --make-rslave --rbind /proc "${RECOVERY}"/proc; then
|
||||||
do_log "info" "true" "'mount --make-rslave --rbind /proc ${RECOVERY}/proc'."
|
do_log "info" "file_only" "'mount --make-rslave --rbind /proc ${RECOVERY}/proc'."
|
||||||
else
|
else
|
||||||
do_log "emergency" "true" "Failed: 'mount --make-rslave --rbind /proc ${RECOVERY}/proc'."
|
do_log "emergency" "file_only" "Failed: 'mount --make-rslave --rbind /proc ${RECOVERY}/proc'."
|
||||||
exit "${ERR_CHROOT_MOUNTS}"
|
exit "${ERR_CHROOT_MOUNTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if mount --make-rslave --rbind /sys "${RECOVERY}"/sys; then
|
if mount --make-rslave --rbind /sys "${RECOVERY}"/sys; then
|
||||||
do_log "info" "true" "'mount --make-rslave --rbind /sys ${RECOVERY}/sys'."
|
do_log "info" "file_only" "'mount --make-rslave --rbind /sys ${RECOVERY}/sys'."
|
||||||
else
|
else
|
||||||
do_log "emergency" "true" "Failed: 'mount --make-rslave --rbind /sys ${RECOVERY}/sys'."
|
do_log "emergency" "file_only" "Failed: 'mount --make-rslave --rbind /sys ${RECOVERY}/sys'."
|
||||||
exit "${ERR_CHROOT_MOUNTS}"
|
exit "${ERR_CHROOT_MOUNTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if mount --make-rslave --rbind /dev "${RECOVERY}"/dev; then
|
if mount --make-rslave --rbind /dev "${RECOVERY}"/dev; then
|
||||||
do_log "info" "true" "'mount --make-rslave --rbind /dev ${RECOVERY}/dev'."
|
do_log "info" "file_only" "'mount --make-rslave --rbind /dev ${RECOVERY}/dev'."
|
||||||
else
|
else
|
||||||
do_log "emergency" "true" "Failed: 'mount --make-rslave --rbind /dev ${RECOVERY}/dev'."
|
do_log "emergency" "file_only" "Failed: 'mount --make-rslave --rbind /dev ${RECOVERY}/dev'."
|
||||||
exit "${ERR_CHROOT_MOUNTS}"
|
exit "${ERR_CHROOT_MOUNTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if mount --make-rslave --rbind /run "${RECOVERY}"/run; then
|
if mount --make-rslave --rbind /run "${RECOVERY}"/run; then
|
||||||
do_log "info" "true" "'mount --make-rslave --rbind /run ${RECOVERY}/run'."
|
do_log "info" "file_only" "'mount --make-rslave --rbind /run ${RECOVERY}/run'."
|
||||||
else
|
else
|
||||||
do_log "emergency" "true" "Failed: 'mount --make-rslave --rbind /run ${RECOVERY}/run'."
|
do_log "emergency" "file_only" "Failed: 'mount --make-rslave --rbind /run ${RECOVERY}/run'."
|
||||||
exit "${ERR_CHROOT_MOUNTS}"
|
exit "${ERR_CHROOT_MOUNTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if do_in_target "${TARGET}" mkdir -p /etc/systemd/system/multi-user.target.wants; then
|
if do_in_target "${TARGET}" mkdir -p /etc/systemd/system/multi-user.target.wants; then
|
||||||
do_log "info" "true" "Command: 'mkdir -p /etc/systemd/system/multi-user.target.wants' executed in: '${RECOVERY}'."
|
do_log "info" "file_only" "Command: 'mkdir -p /etc/systemd/system/multi-user.target.wants' executed in: '${RECOVERY}'."
|
||||||
else
|
else
|
||||||
do_log "emergency" "true" "Failed: Command: 'mkdir -p /etc/systemd/system/multi-user.target.wants' executed in: '${RECOVERY}'."
|
do_log "emergency" "file_only" "Failed: Command: 'mkdir -p /etc/systemd/system/multi-user.target.wants' executed in: '${RECOVERY}'."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_show_footer "${MODULE_TXT}"
|
do_show_footer "${MODULE_TXT}"
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
# SPDX-PackageName: CISS.2025.hardened.installer
|
# SPDX-PackageName: CISS.2025.hardened.installer
|
||||||
# SPDX-Security-Contact: security@coresecret.eu
|
# SPDX-Security-Contact: security@coresecret.eu
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
# 3.9.1. Functions - installation - generate files recovery #
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
# Generates '${RECOVERY}/etc/crypttab' and '${RECOVERY}/etc/fstab' files for recovery partition.
|
# Generates '${RECOVERY}/etc/crypttab' and '${RECOVERY}/etc/fstab' files for recovery partition.
|
||||||
# Globals:
|
# Globals:
|
||||||
@@ -21,10 +17,7 @@
|
|||||||
# Arguments:
|
# Arguments:
|
||||||
# None
|
# None
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
3_9_1_functions_installation_generate_files_recovery() {
|
generate_files_recovery() {
|
||||||
declare -g -x MODULE_ERR="3_9_1_functions_installation_generate_files_recovery"
|
|
||||||
declare -g -x MODULE_TXT="Generate 'fstab' and 'crypttab' for recovery partition"
|
|
||||||
do_show_header "${MODULE_TXT}"
|
|
||||||
|
|
||||||
### BLOCK '${RECOVERY}/etc/crypttab'
|
### BLOCK '${RECOVERY}/etc/crypttab'
|
||||||
|
|
||||||
@@ -62,7 +55,7 @@ EOF
|
|||||||
echo "# ${KEY} was on /dev/mapper/${MAP_PATH_CRYPT["${KEY}"]} during installation" >> "${RECOVERY}"/etc/crypttab
|
echo "# ${KEY} was on /dev/mapper/${MAP_PATH_CRYPT["${KEY}"]} during installation" >> "${RECOVERY}"/etc/crypttab
|
||||||
echo "${MAP_PATH_CRYPT["${KEY}"]} UUID=${MAP_UUID_CRYPT["${ENCRYPTION_LABEL}"]} none luks,discard" >> "${RECOVERY}"/etc/crypttab
|
echo "${MAP_PATH_CRYPT["${KEY}"]} UUID=${MAP_UUID_CRYPT["${ENCRYPTION_LABEL}"]} none luks,discard" >> "${RECOVERY}"/etc/crypttab
|
||||||
echo "" >> "${RECOVERY}"/etc/crypttab
|
echo "" >> "${RECOVERY}"/etc/crypttab
|
||||||
do_log "info" "false" "crypttab entry generated: '${MAP_PATH_CRYPT["${KEY}"]} UUID=${MAP_UUID_CRYPT["${ENCRYPTION_LABEL}"]} none luks,discard'."
|
do_log "info" "file_only" "crypttab entry generated: '${MAP_PATH_CRYPT["${KEY}"]} UUID=${MAP_UUID_CRYPT["${ENCRYPTION_LABEL}"]} none luks,discard'."
|
||||||
|
|
||||||
# TODO: Update loop to iterate thru dynamic number of ephemeral drives.
|
# TODO: Update loop to iterate thru dynamic number of ephemeral drives.
|
||||||
# Generate '${RECOVERY}/etc/crypttab' special ephemeral entries.
|
# Generate '${RECOVERY}/etc/crypttab' special ephemeral entries.
|
||||||
@@ -80,7 +73,7 @@ EOF
|
|||||||
# TODO: Change static 'LABEL=' to dynamic extraction of partitioning.yaml 'recipe_..._filesystem_label' recipe string.
|
# TODO: Change static 'LABEL=' to dynamic extraction of partitioning.yaml 'recipe_..._filesystem_label' recipe string.
|
||||||
echo "${MAP_EPHEMERAL_ENCLABEL[${KEY}]} LABEL=SWAP /dev/random swap,offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096" >> "${RECOVERY}"/etc/crypttab
|
echo "${MAP_EPHEMERAL_ENCLABEL[${KEY}]} LABEL=SWAP /dev/random swap,offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096" >> "${RECOVERY}"/etc/crypttab
|
||||||
echo "" >> "${RECOVERY}"/etc/crypttab
|
echo "" >> "${RECOVERY}"/etc/crypttab
|
||||||
do_log "info" "false" "'${RECOVERY}/etc/crypttab' entry generated: '${MAP_EPHEMERAL_ENCLABEL[${KEY}]} LABEL=SWAP /dev/random swap,offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096'."
|
do_log "info" "file_only" "'${RECOVERY}/etc/crypttab' entry generated: '${MAP_EPHEMERAL_ENCLABEL[${KEY}]} LABEL=SWAP /dev/random swap,offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096'."
|
||||||
|
|
||||||
elif [[ ${KEY} == "/tmp" ]]; then
|
elif [[ ${KEY} == "/tmp" ]]; then
|
||||||
|
|
||||||
@@ -89,11 +82,11 @@ EOF
|
|||||||
# TODO: Change static 'LABEL=' to dynamic extraction of partitioning.yaml 'recipe_..._filesystem_label' recipe string.
|
# TODO: Change static 'LABEL=' to dynamic extraction of partitioning.yaml 'recipe_..._filesystem_label' recipe string.
|
||||||
echo "${MAP_EPHEMERAL_ENCLABEL[${KEY}]} LABEL=ext4_tmp /dev/random offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096,tmp=ext4" >> "${RECOVERY}"/etc/crypttab
|
echo "${MAP_EPHEMERAL_ENCLABEL[${KEY}]} LABEL=ext4_tmp /dev/random offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096,tmp=ext4" >> "${RECOVERY}"/etc/crypttab
|
||||||
echo "" >> "${RECOVERY}"/etc/crypttab
|
echo "" >> "${RECOVERY}"/etc/crypttab
|
||||||
do_log "info" "false" "'${RECOVERY}/etc/crypttab' entry generated: '${MAP_EPHEMERAL_ENCLABEL[${KEY}]} LABEL=ext4_tmp /dev/random offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096,tmp=ext4'."
|
do_log "info" "file_only" "'${RECOVERY}/etc/crypttab' entry generated: '${MAP_EPHEMERAL_ENCLABEL[${KEY}]} LABEL=ext4_tmp /dev/random offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096,tmp=ext4'."
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
do_log "info" "true" "${RECOVERY}/etc/crypttab (This message should never get printed.)"
|
do_log "info" "file_only" "${RECOVERY}/etc/crypttab (This message should never get printed.)"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -203,7 +196,7 @@ EOF
|
|||||||
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
||||||
echo "${MAP_MOUNTPATH_DEV[${KEY}]} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 1" >> "${TARGET}"/etc/fstab
|
echo "${MAP_MOUNTPATH_DEV[${KEY}]} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 1" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: '${MAP_MOUNTPATH_DEV[${KEY}]} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 1'."
|
do_log "info" "file_only" "fstab entry generated: '${MAP_MOUNTPATH_DEV[${KEY}]} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 1'."
|
||||||
|
|
||||||
elif [[ ${FILESYSTEM_VERSION} == "ext4" ]]; then
|
elif [[ ${FILESYSTEM_VERSION} == "ext4" ]]; then
|
||||||
|
|
||||||
@@ -212,7 +205,7 @@ EOF
|
|||||||
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
||||||
echo "${MAP_MOUNTPATH_DEV[${KEY}]} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 1" >> "${TARGET}"/etc/fstab
|
echo "${MAP_MOUNTPATH_DEV[${KEY}]} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 1" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: '${MAP_MOUNTPATH_DEV[${KEY}]} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 1'."
|
do_log "info" "file_only" "fstab entry generated: '${MAP_MOUNTPATH_DEV[${KEY}]} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 1'."
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -230,7 +223,7 @@ EOF
|
|||||||
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
||||||
echo "UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 2" >> "${TARGET}"/etc/fstab
|
echo "UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 2" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 2'."
|
do_log "info" "file_only" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 2'."
|
||||||
|
|
||||||
elif [[ ${FILESYSTEM_VERSION} == "ext4" ]]; then
|
elif [[ ${FILESYSTEM_VERSION} == "ext4" ]]; then
|
||||||
|
|
||||||
@@ -239,7 +232,7 @@ EOF
|
|||||||
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
||||||
echo "UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 2" >> "${TARGET}"/etc/fstab
|
echo "UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 2" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 2'."
|
do_log "info" "file_only" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 2'."
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -256,7 +249,7 @@ EOF
|
|||||||
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
||||||
echo "UUID=${DEVICE_UUID} ${KEY} vfat umask=0077 0 2" >> "${TARGET}"/etc/fstab
|
echo "UUID=${DEVICE_UUID} ${KEY} vfat umask=0077 0 2" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} vfat umask=0077 0 2'."
|
do_log "info" "file_only" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} vfat umask=0077 0 2'."
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -339,7 +332,7 @@ EOF
|
|||||||
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
||||||
echo "UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 2" >> "${TARGET}"/etc/fstab
|
echo "UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 2" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 2'."
|
do_log "info" "file_only" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS},${BTRFS_OPTIONS},subvol=${MOUNT_SUBVOLUME} 0 2'."
|
||||||
|
|
||||||
elif [[ ${FILESYSTEM_VERSION} == "ext4" ]]; then
|
elif [[ ${FILESYSTEM_VERSION} == "ext4" ]]; then
|
||||||
|
|
||||||
@@ -348,7 +341,7 @@ EOF
|
|||||||
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
echo "# ${KEY} was on ${DEVICE_UUID} during installation" >> "${TARGET}"/etc/fstab
|
||||||
echo "UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 2" >> "${TARGET}"/etc/fstab
|
echo "UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 2" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 2'."
|
do_log "info" "file_only" "fstab entry generated: 'UUID=${DEVICE_UUID} ${KEY} ${FILESYSTEM_VERSION} ${MOUNT_OPTIONS} 0 2'."
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -364,7 +357,7 @@ EOF
|
|||||||
echo "# /media/cdrom0 was on /dev/sr0 during installation" >> "${TARGET}"/etc/fstab
|
echo "# /media/cdrom0 was on /dev/sr0 during installation" >> "${TARGET}"/etc/fstab
|
||||||
echo "/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0" >> "${TARGET}"/etc/fstab
|
echo "/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: '/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0'."
|
do_log "info" "file_only" "fstab entry generated: '/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0'."
|
||||||
|
|
||||||
# Add entry for proc and tmpfs device
|
# Add entry for proc and tmpfs device
|
||||||
# shellcheck disable=2129
|
# shellcheck disable=2129
|
||||||
@@ -372,8 +365,8 @@ EOF
|
|||||||
echo "proc /proc proc nodev,nosuid,noexec,hidepid=2 0 0" >> "${TARGET}"/etc/fstab
|
echo "proc /proc proc nodev,nosuid,noexec,hidepid=2 0 0" >> "${TARGET}"/etc/fstab
|
||||||
echo "tmpfs /dev/shm tmpfs rw,nodev,nosuid,noexec,relatime,size=1G 0 0" >> "${TARGET}"/etc/fstab
|
echo "tmpfs /dev/shm tmpfs rw,nodev,nosuid,noexec,relatime,size=1G 0 0" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: 'proc /proc proc nodev,nosuid,noexec,hidepid=2 0 0'."
|
do_log "info" "file_only" "fstab entry generated: 'proc /proc proc nodev,nosuid,noexec,hidepid=2 0 0'."
|
||||||
do_log "info" "false" "fstab entry generated: 'tmpfs /dev/shm tmpfs rw,nodev,nosuid,noexec,relatime,size=1G 0 0'."
|
do_log "info" "file_only" "fstab entry generated: 'tmpfs /dev/shm tmpfs rw,nodev,nosuid,noexec,relatime,size=1G 0 0'."
|
||||||
|
|
||||||
# TODO: flexible 'SWAP' entry, not only ephemeral SWAP.
|
# TODO: flexible 'SWAP' entry, not only ephemeral SWAP.
|
||||||
# Add entry for SWAP device
|
# Add entry for SWAP device
|
||||||
@@ -382,7 +375,7 @@ EOF
|
|||||||
echo "##### Added by CISS.2025.debian.installer" >> "${TARGET}"/etc/fstab
|
echo "##### Added by CISS.2025.debian.installer" >> "${TARGET}"/etc/fstab
|
||||||
echo "${MAP_EPHEMERAL_ENCLABEL["${MOUNT_PATH}"]} none swap defaults 0 0" >> "${TARGET}"/etc/fstab
|
echo "${MAP_EPHEMERAL_ENCLABEL["${MOUNT_PATH}"]} none swap defaults 0 0" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: '${MAP_EPHEMERAL_ENCLABEL["${MOUNT_PATH}"]} none swap defaults 0 0'."
|
do_log "info" "file_only" "fstab entry generated: '${MAP_EPHEMERAL_ENCLABEL["${MOUNT_PATH}"]} none swap defaults 0 0'."
|
||||||
|
|
||||||
# TODO: flexible '/tmp' entry, not only ephemeral SWAP.
|
# TODO: flexible '/tmp' entry, not only ephemeral SWAP.
|
||||||
# Add entry for '/tmp' device
|
# Add entry for '/tmp' device
|
||||||
@@ -391,7 +384,7 @@ EOF
|
|||||||
echo "##### Added by CISS.2025.debian.installer" >> "${TARGET}"/etc/fstab
|
echo "##### Added by CISS.2025.debian.installer" >> "${TARGET}"/etc/fstab
|
||||||
echo "${MAP_EPHEMERAL_ENCLABEL["${MOUNT_PATH}"]} /tmp ext4 defaults,rw,nodev,nosuid,relatime 0 0" >> "${TARGET}"/etc/fstab
|
echo "${MAP_EPHEMERAL_ENCLABEL["${MOUNT_PATH}"]} /tmp ext4 defaults,rw,nodev,nosuid,relatime 0 0" >> "${TARGET}"/etc/fstab
|
||||||
echo "" >> "${TARGET}"/etc/fstab
|
echo "" >> "${TARGET}"/etc/fstab
|
||||||
do_log "info" "false" "fstab entry generated: '${MAP_EPHEMERAL_ENCLABEL["${MOUNT_PATH}"]} /tmp ext4 defaults,rw,nodev,nosuid,relatime 0 0'."
|
do_log "info" "file_only" "fstab entry generated: '${MAP_EPHEMERAL_ENCLABEL["${MOUNT_PATH}"]} /tmp ext4 defaults,rw,nodev,nosuid,relatime 0 0'."
|
||||||
|
|
||||||
# TODO: END: BLOCK "${RECOVERY}"/etc/fstab
|
# TODO: END: BLOCK "${RECOVERY}"/etc/fstab
|
||||||
# TODO: complete this block
|
# TODO: complete this block
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ guard_sourcing
|
|||||||
func_debootstrap() {
|
func_debootstrap() {
|
||||||
# shellcheck disable=SC2312
|
# shellcheck disable=SC2312
|
||||||
if debootstrap --arch="${architecture}" "${distribution}" "${TARGET}" https://deb.debian.org/debian | tee "${LOG_DBS}"; then
|
if debootstrap --arch="${architecture}" "${distribution}" "${TARGET}" https://deb.debian.org/debian | tee "${LOG_DBS}"; then
|
||||||
do_log "info" "false" "Executing 'debootstrap --arch=${architecture} ${distribution} '${TARGET}' https://deb.debian.org/debian' successful."
|
do_log "info" "file_only" "Executing 'debootstrap --arch=${architecture} ${distribution} '${TARGET}' https://deb.debian.org/debian' successful."
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
do_log "emergency" "false" "Executing 'debootstrap --arch=${architecture} ${distribution} '${TARGET}' https://deb.debian.org/debian' NOT successful."
|
do_log "emergency" "file_only" "Executing 'debootstrap --arch=${architecture} ${distribution} '${TARGET}' https://deb.debian.org/debian' NOT successful."
|
||||||
return "${ERR_DEBOOTSTRAP}"
|
return "${ERR_DEBOOTSTRAP}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ configure_system() {
|
|||||||
mkdir -p "${var_dst}"
|
mkdir -p "${var_dst}"
|
||||||
|
|
||||||
if ! mount --make-rslave --rbind "/${var_src}" "${var_dst}"; then
|
if ! mount --make-rslave --rbind "/${var_src}" "${var_dst}"; then
|
||||||
do_log "emergency" "false" "Failed: 'mount --make-rslave --rbind /${var_src} ${var_dst}'."
|
do_log "emergency" "file_only" "Failed: 'mount --make-rslave --rbind /${var_src} ${var_dst}'."
|
||||||
return "${ERR_CHRT_MOUNTS}"
|
return "${ERR_CHRT_MOUNTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_log "info" "true" "Success: 'mount --make-rslave --rbind /${var_src} ${var_dst}'."
|
do_log "info" "file_only" "Success: 'mount --make-rslave --rbind /${var_src} ${var_dst}'."
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ configure_system() {
|
|||||||
return "${ERR_CHRT_MOUNTS}"
|
return "${ERR_CHRT_MOUNTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_log "info" "true" "Command: 'mkdir -p /etc/systemd/system/multi-user.target.wants' executed in: '${TARGET}'."
|
do_log "info" "file_only" "Command: 'mkdir -p /etc/systemd/system/multi-user.target.wants' executed in: '${TARGET}'."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ guard_sourcing
|
|||||||
write_fstab() {
|
write_fstab() {
|
||||||
declare _uuid="$1" _path="$2" _fs="$3" _opts="$4" _pass="$5"
|
declare _uuid="$1" _path="$2" _fs="$3" _opts="$4" _pass="$5"
|
||||||
printf "UUID=%s %s %s %s 0 %s\n" "${_uuid}" "${_path}" "${_fs}" "${_opts}" "${_pass}" >> "${TARGET}/etc/fstab"
|
printf "UUID=%s %s %s %s 0 %s\n" "${_uuid}" "${_path}" "${_fs}" "${_opts}" "${_pass}" >> "${TARGET}/etc/fstab"
|
||||||
do_log "info" "true" "fstab entry generated: 'UUID=${_uuid} ${_path} ${_fs} ${_opts} 0 ${_pass}'."
|
do_log "info" "file_only" "fstab entry generated: 'UUID=${_uuid} ${_path} ${_fs} ${_opts} 0 ${_pass}'."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ EOF
|
|||||||
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
|
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
do_log "info" "true" "fstab entry generated: '/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0'."
|
do_log "info" "file_only" "fstab entry generated: '/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0'."
|
||||||
|
|
||||||
### Add entry for 'SWAP' device.
|
### Add entry for 'SWAP' device.
|
||||||
var_path="SWAP"
|
var_path="SWAP"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ guard_sourcing
|
|||||||
write_crypttab() {
|
write_crypttab() {
|
||||||
declare _label="$1" _device="$2" _key_file="$3" _opts="$4"
|
declare _label="$1" _device="$2" _key_file="$3" _opts="$4"
|
||||||
printf "%s %s %s %s\n" "${_label}" "${_device}" "${_key_file}" "${_opts}" >> "${TARGET}/etc/crypttab"
|
printf "%s %s %s %s\n" "${_label}" "${_device}" "${_key_file}" "${_opts}" >> "${TARGET}/etc/crypttab"
|
||||||
do_log "info" "true" "crypttab entry generated: '${_label} ${_device} ${_key_file} ${_opts}'."
|
do_log "info" "file_only" "crypttab entry generated: '${_label} ${_device} ${_key_file} ${_opts}'."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ EOF
|
|||||||
write_crypttab "${var_ephemeral_enclabel}" "LABEL=${var_ephemeral_fs_label}" "/dev/random" "offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096,tmp=ext4"
|
write_crypttab "${var_ephemeral_enclabel}" "LABEL=${var_ephemeral_fs_label}" "/dev/random" "offset=2048,cipher=aes-xts-plain64,size=512,sector-size=4096,tmp=ext4"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
do_log "error" "false" "Only 'SWAP' and '/tmp' are valid Partitions for Ephemeral Encryption. Given value was: '${var_key}'."
|
do_log "error" "file_only" "Only 'SWAP' and '/tmp' are valid Partitions for Ephemeral Encryption. Given value was: '${var_key}'."
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ generate_sources() {
|
|||||||
var_hostsecure="${apt_sec,,}"
|
var_hostsecure="${apt_sec,,}"
|
||||||
|
|
||||||
ary_components=(main)
|
ary_components=(main)
|
||||||
[[ "${apt_contrib,,}" == true ]] && ary_components+=(contrib)
|
[[ "${apt_contrib,,}" == "true" ]] && ary_components+=(contrib)
|
||||||
[[ "${apt_non_free,,}" == true ]] && ary_components+=(non-free)
|
[[ "${apt_non_free,,}" == "true" ]] && ary_components+=(non-free)
|
||||||
[[ "${apt_non_free_firmware,,}" == true ]] && ary_components+=(non-free-firmware)
|
[[ "${apt_non_free_firmware,,}" == "true" ]] && ary_components+=(non-free-firmware)
|
||||||
|
|
||||||
if [[ "${apt_mirror_protocol,,}" == "https" ]]; then
|
if [[ "${apt_mirror_protocol,,}" == "https" ]]; then
|
||||||
var_url="https://${var_hostname}${var_dir}"
|
var_url="https://${var_hostname}${var_dir}"
|
||||||
@@ -82,11 +82,11 @@ generate_sources() {
|
|||||||
#------------------------------------------------------------------------------------------------------------------------------#
|
#------------------------------------------------------------------------------------------------------------------------------#
|
||||||
deb ${var_url} ${var_codename} ${ary_components[*]}
|
deb ${var_url} ${var_codename} ${ary_components[*]}
|
||||||
EOF
|
EOF
|
||||||
do_log "info" "true" "${TARGET}/etc/apt/sources.list entry generated: 'deb ${var_url} ${var_codename} ${ary_components[*]}'."
|
do_log "info" "file_only" "${TARGET}/etc/apt/sources.list entry generated: 'deb ${var_url} ${var_codename} ${ary_components[*]}'."
|
||||||
|
|
||||||
if [[ "${var_deb_src}" == "true" ]]; then
|
if [[ "${var_deb_src}" == "true" ]]; then
|
||||||
echo "deb-src ${var_url} ${var_codename} ${ary_components[*]}" >> "${TARGET}/etc/apt/sources.list"
|
echo "deb-src ${var_url} ${var_codename} ${ary_components[*]}" >> "${TARGET}/etc/apt/sources.list"
|
||||||
do_log "info" "true" "${TARGET}/etc/apt/sources.list entry generated: 'deb-src ${var_url} ${var_codename} ${ary_components[*]}'."
|
do_log "info" "file_only" "${TARGET}/etc/apt/sources.list entry generated: 'deb-src ${var_url} ${var_codename} ${ary_components[*]}'."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Security Repository
|
### Security Repository
|
||||||
@@ -95,10 +95,10 @@ EOF
|
|||||||
|
|
||||||
deb ${var_surl} ${var_codename}-security ${ary_components[*]}
|
deb ${var_surl} ${var_codename}-security ${ary_components[*]}
|
||||||
EOF
|
EOF
|
||||||
do_log "info" "true" "${TARGET}/etc/apt/sources.list entry generated: 'deb ${var_surl} ${var_codename}-security ${ary_components[*]}'."
|
do_log "info" "file_only" "${TARGET}/etc/apt/sources.list entry generated: 'deb ${var_surl} ${var_codename}-security ${ary_components[*]}'."
|
||||||
if [[ "${var_deb_src}" == "true" ]]; then
|
if [[ "${var_deb_src}" == "true" ]]; then
|
||||||
echo "deb-src ${var_surl} ${var_codename}-security ${ary_components[*]}" >> "${TARGET}/etc/apt/sources.list"
|
echo "deb-src ${var_surl} ${var_codename}-security ${ary_components[*]}" >> "${TARGET}/etc/apt/sources.list"
|
||||||
do_log "info" "true" "${TARGET}/etc/apt/sources.list entry generated: 'deb-src ${var_surl} ${var_codename}-security ${ary_components[*]}'."
|
do_log "info" "file_only" "${TARGET}/etc/apt/sources.list entry generated: 'deb-src ${var_surl} ${var_codename}-security ${ary_components[*]}'."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -108,10 +108,10 @@ EOF
|
|||||||
|
|
||||||
deb ${var_url} ${var_codename}-updates ${ary_components[*]}
|
deb ${var_url} ${var_codename}-updates ${ary_components[*]}
|
||||||
EOF
|
EOF
|
||||||
do_log "info" "true" "${TARGET}/etc/apt/sources.list entry generated: 'deb ${var_url} ${var_codename}-updates ${ary_components[*]}'."
|
do_log "info" "file_only" "${TARGET}/etc/apt/sources.list entry generated: 'deb ${var_url} ${var_codename}-updates ${ary_components[*]}'."
|
||||||
if [[ "${var_deb_src}" == "true" ]]; then
|
if [[ "${var_deb_src}" == "true" ]]; then
|
||||||
echo "deb-src ${var_url} ${var_codename}-updates ${ary_components[*]}" >> "${TARGET}/etc/apt/sources.list"
|
echo "deb-src ${var_url} ${var_codename}-updates ${ary_components[*]}" >> "${TARGET}/etc/apt/sources.list"
|
||||||
do_log "info" "true" "${TARGET}/etc/apt/sources.list entry generated: 'deb-src ${var_url} ${var_codename}-updates ${ary_components[*]}'."
|
do_log "info" "file_only" "${TARGET}/etc/apt/sources.list entry generated: 'deb-src ${var_url} ${var_codename}-updates ${ary_components[*]}'."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -121,10 +121,10 @@ EOF
|
|||||||
|
|
||||||
deb ${var_url} ${var_codename}-backports ${ary_components[*]}
|
deb ${var_url} ${var_codename}-backports ${ary_components[*]}
|
||||||
EOF
|
EOF
|
||||||
do_log "info" "true" "${TARGET}/etc/apt/sources.list entry generated: 'deb ${var_url} ${var_codename}-backports ${ary_components[*]}'."
|
do_log "info" "file_only" "${TARGET}/etc/apt/sources.list entry generated: 'deb ${var_url} ${var_codename}-backports ${ary_components[*]}'."
|
||||||
if [[ "${var_deb_src,,}" == "true" ]]; then
|
if [[ "${var_deb_src,,}" == "true" ]]; then
|
||||||
echo "deb-src ${var_url} ${var_codename}-backports ${ary_components[*]}" >> "${TARGET}/etc/apt/sources.list"
|
echo "deb-src ${var_url} ${var_codename}-backports ${ary_components[*]}" >> "${TARGET}/etc/apt/sources.list"
|
||||||
do_log "info" "true" "${TARGET}/etc/apt/sources.list entry generated: 'deb-src ${var_url} ${var_codename}-backports ${ary_components[*]}'."
|
do_log "info" "file_only" "${TARGET}/etc/apt/sources.list entry generated: 'deb-src ${var_url} ${var_codename}-backports ${ary_components[*]}'."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ EOF
|
|||||||
if [[ "${apt_updates_policy,,}" == "unattended" ]]; then
|
if [[ "${apt_updates_policy,,}" == "unattended" ]]; then
|
||||||
|
|
||||||
do_in_target "${TARGET}" apt-get install -y unattended-upgrades
|
do_in_target "${TARGET}" apt-get install -y unattended-upgrades
|
||||||
do_log "info" "true" "The update policy was set at installation time to '${apt_updates_policy}'."
|
do_log "info" "file_only" "The update policy was set at installation time to '${apt_updates_policy}'."
|
||||||
|
|
||||||
elif [[ "${apt_updates_policy,,}" == "security" ]]; then
|
elif [[ "${apt_updates_policy,,}" == "security" ]]; then
|
||||||
|
|
||||||
@@ -150,15 +150,15 @@ EOF
|
|||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
sed -i 's/^[[:space:]]*"origin=Debian,codename=\${distro_codename},label=Debian";/\/\/ &/' "${TARGET}/etc/apt/apt.conf.d/50unattended-upgrades"
|
sed -i 's/^[[:space:]]*"origin=Debian,codename=\${distro_codename},label=Debian";/\/\/ &/' "${TARGET}/etc/apt/apt.conf.d/50unattended-upgrades"
|
||||||
do_log "info" "true" "The update policy was set at installation time to '${apt_updates_policy}'."
|
do_log "info" "file_only" "The update policy was set at installation time to '${apt_updates_policy}'."
|
||||||
|
|
||||||
elif [[ "${apt_updates_policy,,}" == "none" ]]; then
|
elif [[ "${apt_updates_policy,,}" == "none" ]]; then
|
||||||
|
|
||||||
do_log "info" "true" "The update policy was set at installation time to: '${apt_updates_policy}'."
|
do_log "info" "file_only" "The update policy was set at installation time to: '${apt_updates_policy}'."
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
do_log "warning" "true" "Update policy '${apt_updates_policy}': is not supported. Using 'none' as default."
|
do_log "warning" "file_only" "Update policy '${apt_updates_policy}': is not supported. Using 'none' as default."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -24,32 +24,33 @@ guard_sourcing
|
|||||||
minimal_toolset() {
|
minimal_toolset() {
|
||||||
declare var_bin
|
declare var_bin
|
||||||
|
|
||||||
|
### Define HashMap: command -> package
|
||||||
|
# shellcheck disable=SC2154
|
||||||
declare -A hmp_tool_pkg=(
|
declare -A hmp_tool_pkg=(
|
||||||
["awk"]="gawk"
|
[awk]="gawk"
|
||||||
["busybox"]="busybox"
|
[busybox]="busybox"
|
||||||
["cat"]="coreutils"
|
[cat]="coreutils"
|
||||||
["chmod"]="coreutils"
|
[chmod]="coreutils"
|
||||||
["chown"]="coreutils"
|
[chown]="coreutils"
|
||||||
["chpasswd"]="passwd"
|
[chpasswd]="passwd"
|
||||||
["chsh"]="passwd"
|
[chsh]="passwd"
|
||||||
["cp"]="coreutils"
|
[cp]="coreutils"
|
||||||
["cryptsetup"]="cryptsetup-initramfs"
|
[cryptsetup]="cryptsetup-initramfs"
|
||||||
["echo"]="coreutils"
|
[echo]="coreutils"
|
||||||
["grep"]="grep"
|
[grep]="grep"
|
||||||
["ip"]="iproute2"
|
[ip]="iproute2"
|
||||||
["ln"]="coreutils"
|
[ln]="coreutils"
|
||||||
["mkdir"]="coreutils"
|
[mkdir]="coreutils"
|
||||||
["ping"]="iputils-ping"
|
[ping]="iputils-ping"
|
||||||
["sed"]="sed"
|
[sed]="sed"
|
||||||
["sudo"]="sudo"
|
[sudo]="sudo"
|
||||||
["update-initramfs"]="initramfs-tools"
|
[update-initramfs]="initramfs-tools"
|
||||||
["zsh"]="zsh"
|
[zsh]="zsh"
|
||||||
)
|
)
|
||||||
|
|
||||||
for var_bin in "${!hmp_tool_pkg[@]}"; do
|
for var_bin in "${!hmp_tool_pkg[@]}"; do
|
||||||
if ! do_in_target_script "${TARGET}" "command -v ${var_bin} >/dev/null"; then
|
if ! do_in_target_script "${TARGET}" "command -v ${var_bin} >/dev/null"; then
|
||||||
do_in_target "${TARGET}" apt-get install -y "${hmp_tool_pkg[${var_bin}]}"
|
do_in_target "${TARGET}" apt-get install -y "${hmp_tool_pkg[${var_bin}]}"
|
||||||
do_log "debug" "true" "Tool '${var_bin}' missing, installing '${hmp_tool_pkg[${var_bin}]}'."
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ setup_skel() {
|
|||||||
# In order to be able to copy/paste from vim, one needs to create a '.vimrc' in every home directory with the following content:
|
# In order to be able to copy/paste from vim, one needs to create a '.vimrc' in every home directory with the following content:
|
||||||
echo 'set clipboard=unnamed' >| "${TARGET}/etc/skel/.vimrc"
|
echo 'set clipboard=unnamed' >| "${TARGET}/etc/skel/.vimrc"
|
||||||
chmod 0644 "${TARGET}/etc/skel/.vimrc"
|
chmod 0644 "${TARGET}/etc/skel/.vimrc"
|
||||||
do_log "info" "true" "Installed: '/etc/skel'-Files."
|
do_log "info" "file_only" "Installed: '/etc/skel'-Files."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ setup_locales() {
|
|||||||
|
|
||||||
### Set the keyboard layout for the system (for consoles)
|
### Set the keyboard layout for the system (for consoles)
|
||||||
sed -i "s/^KEYMAP=.*/KEYMAP=${locale_keyboard_layout}/" "${TARGET}/etc/default/keyboard"
|
sed -i "s/^KEYMAP=.*/KEYMAP=${locale_keyboard_layout}/" "${TARGET}/etc/default/keyboard"
|
||||||
do_log "info" "false" "Keyboard layout updated: 'KEYMAP=${locale_keyboard_layout}' -> '${TARGET}/etc/default/keyboard'."
|
do_log "info" "file_only" "Keyboard layout updated: 'KEYMAP=${locale_keyboard_layout}' -> '${TARGET}/etc/default/keyboard'."
|
||||||
|
|
||||||
### Set the X11 keyboard layout (for graphical environments)
|
### Set the X11 keyboard layout (for graphical environments)
|
||||||
do_in_target "${TARGET}" localectl set-x11-keymap "${locale_keyboard_xkb_keymap}"
|
do_in_target "${TARGET}" localectl set-x11-keymap "${locale_keyboard_xkb_keymap}"
|
||||||
|
|||||||
@@ -99,23 +99,23 @@ setup_network() {
|
|||||||
var_auto_fqdn=""
|
var_auto_fqdn=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_log "info" "false" "Live environment network check: Auto NIC ='${var_auto_nic}'."
|
do_log "info" "file_only" "Live environment network check: Auto NIC ='${var_auto_nic}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto IPv4 ='${var_auto_ipv4}'."
|
do_log "info" "file_only" "Live environment network check: Auto IPv4 ='${var_auto_ipv4}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto IPv4 CCIDR ='${var_auto_ipv4_ccidr}'."
|
do_log "info" "file_only" "Live environment network check: Auto IPv4 CCIDR ='${var_auto_ipv4_ccidr}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto IPv4 Subnet ='${var_auto_ipv4_subnet}'."
|
do_log "info" "file_only" "Live environment network check: Auto IPv4 Subnet ='${var_auto_ipv4_subnet}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto IPv4 Gateway ='${var_auto_ipv4_gw}'."
|
do_log "info" "file_only" "Live environment network check: Auto IPv4 Gateway ='${var_auto_ipv4_gw}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto IPv6 ='${var_auto_ipv6}'."
|
do_log "info" "file_only" "Live environment network check: Auto IPv6 ='${var_auto_ipv6}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto IPv6 CCIDR ='${var_auto_ipv6_ccidr}'."
|
do_log "info" "file_only" "Live environment network check: Auto IPv6 CCIDR ='${var_auto_ipv6_ccidr}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto IPv6 Gateway ='${var_auto_ipv6_gw}'."
|
do_log "info" "file_only" "Live environment network check: Auto IPv6 Gateway ='${var_auto_ipv6_gw}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto IPv4 Link ='${var_link_ipv4}'."
|
do_log "info" "file_only" "Live environment network check: Auto IPv4 Link ='${var_link_ipv4}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto IPv6 Link ='${var_link_ipv6}'."
|
do_log "info" "file_only" "Live environment network check: Auto IPv6 Link ='${var_link_ipv6}'."
|
||||||
do_log "info" "false" "Live environment network check: Auto FQDN ='${var_auto_fqdn}'."
|
do_log "info" "file_only" "Live environment network check: Auto FQDN ='${var_auto_fqdn}'."
|
||||||
|
|
||||||
### Create network configuration file header.
|
### Create network configuration file header.
|
||||||
if [[ -f "${TARGET}/etc/network/interfaces" ]]; then
|
if [[ -f "${TARGET}/etc/network/interfaces" ]]; then
|
||||||
mkdir -p "${DIR_BAK}/etc/network"
|
mkdir -p "${DIR_BAK}/etc/network"
|
||||||
mv "${TARGET}/etc/network/interfaces" "${DIR_BAK}/etc/network/interfaces.bak"
|
mv "${TARGET}/etc/network/interfaces" "${DIR_BAK}/etc/network/interfaces.bak"
|
||||||
do_log "info" "false" "Existing '${TARGET}/etc/network/interfaces' moved."
|
do_log "info" "file_only" "Existing '${TARGET}/etc/network/interfaces' moved."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat << EOF >| "${TARGET}/etc/network/interfaces"
|
cat << EOF >| "${TARGET}/etc/network/interfaces"
|
||||||
@@ -142,7 +142,7 @@ iface lo inet loopback
|
|||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/etc/network/interfaces"
|
chmod 0644 "${TARGET}/etc/network/interfaces"
|
||||||
do_log "info" "false" "Header '${TARGET}/etc/network/interfaces' created."
|
do_log "info" "file_only" "Header '${TARGET}/etc/network/interfaces' created."
|
||||||
|
|
||||||
### Configure network interfaces based on 'preseed.yaml' and create network configuration files for IPv4.
|
### Configure network interfaces based on 'preseed.yaml' and create network configuration files for IPv4.
|
||||||
if [[ "${network_autoconfig_enable,,}" == "true" && "${network_choose_interface_auto,,}" == "true" ]]; then
|
if [[ "${network_autoconfig_enable,,}" == "true" && "${network_choose_interface_auto,,}" == "true" ]]; then
|
||||||
@@ -174,7 +174,7 @@ iface ${var_auto_nic} inet dhcp
|
|||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv4-dhcp"
|
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv4-dhcp"
|
||||||
do_log "info" "false" "IPv4 on the primary NIC: '${var_auto_nic}' configured with DHCP."
|
do_log "info" "file_only" "IPv4 on the primary NIC: '${var_auto_nic}' configured with DHCP."
|
||||||
|
|
||||||
elif [[ "${network_autoconfig_enable,,}" == "true" && "${network_choose_interface_auto,,}" == "false" ]]; then
|
elif [[ "${network_autoconfig_enable,,}" == "true" && "${network_choose_interface_auto,,}" == "false" ]]; then
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ iface ${network_choose_interface_static} inet dhcp
|
|||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv4-dhcp"
|
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv4-dhcp"
|
||||||
do_log "info" "false" "IPv4 on the primary NIC: '${network_choose_interface_static}' configured with DHCP."
|
do_log "info" "file_only" "IPv4 on the primary NIC: '${network_choose_interface_static}' configured with DHCP."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ iface ${network_choose_interface_static} inet static
|
|||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv4-static"
|
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv4-static"
|
||||||
do_log "info" "false" "IPv4 on the primary NIC: '${network_choose_interface_static}' configured statically."
|
do_log "info" "file_only" "IPv4 on the primary NIC: '${network_choose_interface_static}' configured statically."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ iface ${var_auto_nic} inet6 dhcp
|
|||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv6-dhcp"
|
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv6-dhcp"
|
||||||
do_log "info" "false" "IPv6 on the primary NIC: '${var_auto_nic}' configured with DHCP."
|
do_log "info" "file_only" "IPv6 on the primary NIC: '${var_auto_nic}' configured with DHCP."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -280,14 +280,14 @@ iface ${network_choose_interface_static} inet6 static
|
|||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv6-static"
|
chmod 0644 "${TARGET}/etc/network/interfaces/interfaces.d/10-ipv6-static"
|
||||||
do_log "info" "false" "IPv6 on the primary NIC: '${network_choose_interface_static}' configured statically."
|
do_log "info" "file_only" "IPv6 on the primary NIC: '${network_choose_interface_static}' configured statically."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "${TARGET}/etc/resolv.conf" ]]; then
|
if [[ -f "${TARGET}/etc/resolv.conf" ]]; then
|
||||||
mkdir -p "${DIR_BAK}/etc"
|
mkdir -p "${DIR_BAK}/etc"
|
||||||
mv "${TARGET}/etc/resolv.conf" "${DIR_BAK}/etc/resolv.conf.bak"
|
mv "${TARGET}/etc/resolv.conf" "${DIR_BAK}/etc/resolv.conf.bak"
|
||||||
do_log "info" "false" "Existing '${TARGET}/etc/resolv.conf' moved."
|
do_log "info" "file_only" "Existing '${TARGET}/etc/resolv.conf' moved."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch "${TARGET}/etc/resolv.conf"
|
touch "${TARGET}/etc/resolv.conf"
|
||||||
@@ -315,7 +315,7 @@ EOF
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "" >> "${TARGET}/etc/resolv.conf"
|
echo "" >> "${TARGET}/etc/resolv.conf"
|
||||||
do_log "info" "false" "IPv4 nameserver at: '${TARGET}/etc/resolv.conf' configured manually."
|
do_log "info" "file_only" "IPv4 nameserver at: '${TARGET}/etc/resolv.conf' configured manually."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ EOF
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "" >> "${TARGET}/etc/resolv.conf"
|
echo "" >> "${TARGET}/etc/resolv.conf"
|
||||||
do_log "info" "false" "IPv6 nameserver at: '${TARGET}/etc/resolv.conf' configured manually."
|
do_log "info" "file_only" "IPv6 nameserver at: '${TARGET}/etc/resolv.conf' configured manually."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ EOF
|
|||||||
if [[ -f "${TARGET}/etc/dhcp/dhclient.conf" ]]; then
|
if [[ -f "${TARGET}/etc/dhcp/dhclient.conf" ]]; then
|
||||||
mkdir -p "${DIR_BAK}/etc/dhcp"
|
mkdir -p "${DIR_BAK}/etc/dhcp"
|
||||||
cp "${TARGET}/etc/dhcp/dhclient.conf" "${DIR_BAK}/etc/dhcp/dhclient.conf.bak"
|
cp "${TARGET}/etc/dhcp/dhclient.conf" "${DIR_BAK}/etc/dhcp/dhclient.conf.bak"
|
||||||
do_log "info" "false" "Existing '${TARGET}/etc/dhcp/dhclient.conf' saved."
|
do_log "info" "file_only" "Existing '${TARGET}/etc/dhcp/dhclient.conf' saved."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${network_autoconfig_enable,,}" == "true" && -n "${network_static_ipv4nameserver_0}" ]]; then
|
if [[ "${network_autoconfig_enable,,}" == "true" && -n "${network_static_ipv4nameserver_0}" ]]; then
|
||||||
@@ -356,7 +356,7 @@ EOF
|
|||||||
var_supersede="${var_supersede%, }"
|
var_supersede="${var_supersede%, }"
|
||||||
echo "supersede domain-name-servers ${var_supersede};" >> "${TARGET}/etc/dhcp/dhclient.conf"
|
echo "supersede domain-name-servers ${var_supersede};" >> "${TARGET}/etc/dhcp/dhclient.conf"
|
||||||
|
|
||||||
do_log "info" "false" "DHCP client configuration for IPv4: '${TARGET}/etc/dhcp/dhclient.conf' configured."
|
do_log "info" "file_only" "DHCP client configuration for IPv4: '${TARGET}/etc/dhcp/dhclient.conf' configured."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ EOF
|
|||||||
var_supersede_ipv6="${var_supersede_ipv6%, }"
|
var_supersede_ipv6="${var_supersede_ipv6%, }"
|
||||||
echo "supersede domain-name-servers ${var_supersede_ipv6};" >> "${TARGET}/etc/dhcp/dhclient.conf"
|
echo "supersede domain-name-servers ${var_supersede_ipv6};" >> "${TARGET}/etc/dhcp/dhclient.conf"
|
||||||
|
|
||||||
do_log "info" "false" "DHCP client configuration for IPv6: '${TARGET}/etc/dhcp/dhclient.conf' configured."
|
do_log "info" "file_only" "DHCP client configuration for IPv6: '${TARGET}/etc/dhcp/dhclient.conf' configured."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ setup_hostname() {
|
|||||||
${VAR_FINAL_FQDN}
|
${VAR_FINAL_FQDN}
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/etc/hostname"
|
chmod 0644 "${TARGET}/etc/hostname"
|
||||||
do_log "info" "true" "File generated: '${TARGET}/etc/hostname' | hostname '${VAR_FINAL_FQDN}'."
|
do_log "info" "file_only" "File generated: '${TARGET}/etc/hostname' | hostname '${VAR_FINAL_FQDN}'."
|
||||||
|
|
||||||
### Create '${TARGET}/etc/mailname' file.
|
### Create '${TARGET}/etc/mailname' file.
|
||||||
cat << EOF >| "${TARGET}/etc/mailname"
|
cat << EOF >| "${TARGET}/etc/mailname"
|
||||||
${VAR_FINAL_FQDN}
|
${VAR_FINAL_FQDN}
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/etc/mailname"
|
chmod 0644 "${TARGET}/etc/mailname"
|
||||||
do_log "info" "true" "File generated: '${TARGET}/etc/mailname' | mailname '${VAR_FINAL_FQDN}'."
|
do_log "info" "file_only" "File generated: '${TARGET}/etc/mailname' | mailname '${VAR_FINAL_FQDN}'."
|
||||||
|
|
||||||
### Generate '${TARGET}/etc/hosts' basic IPv4 entries
|
### Generate '${TARGET}/etc/hosts' basic IPv4 entries
|
||||||
cat << EOF >| "${TARGET}/etc/hosts"
|
cat << EOF >| "${TARGET}/etc/hosts"
|
||||||
@@ -48,7 +48,7 @@ ${VAR_FINAL_IPV4} ${VAR_FINAL_FQDN}
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/etc/hosts"
|
chmod 0644 "${TARGET}/etc/hosts"
|
||||||
do_log "info" "true" "File generated: '${TARGET}/etc/hosts' with basic IPv4 entries."
|
do_log "info" "file_only" "File generated: '${TARGET}/etc/hosts' with basic IPv4 entries."
|
||||||
|
|
||||||
### Generate '${TARGET}/etc/hosts' basic IPv6 entries
|
### Generate '${TARGET}/etc/hosts' basic IPv6 entries
|
||||||
if [[ "${VAR_LINK_IPV6,,}" == "true" || "${network_ipv6,,}" == "true" ]]; then
|
if [[ "${VAR_LINK_IPV6,,}" == "true" || "${network_ipv6,,}" == "true" ]]; then
|
||||||
@@ -65,7 +65,7 @@ ${VAR_FINAL_IPV6} ${VAR_FINAL_FQDN}
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
do_log "info" "true" "File updated: '${TARGET}/etc/hosts' with basic IPv6 entries."
|
do_log "info" "file_only" "File updated: '${TARGET}/etc/hosts' with basic IPv6 entries."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ setup_machineid() {
|
|||||||
fi
|
fi
|
||||||
install -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/machine-id" "${TARGET}/etc/machine-id"
|
install -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/machine-id" "${TARGET}/etc/machine-id"
|
||||||
|
|
||||||
|
do_log "info" "file_only" "Machine ID updated: 'machine-id' to 'whonix id'."
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ setup_grub() {
|
|||||||
amd64) do_in_target "${TARGET}" apt-get install -y -t bookworm-backports grub2 grub2-common grub-efi-amd64 ;;
|
amd64) do_in_target "${TARGET}" apt-get install -y -t bookworm-backports grub2 grub2-common grub-efi-amd64 ;;
|
||||||
arm64) do_in_target "${TARGET}" apt-get install -y -t bookworm-backports grub2 grub2-common grub-efi-arm64 ;;
|
arm64) do_in_target "${TARGET}" apt-get install -y -t bookworm-backports grub2 grub2-common grub-efi-arm64 ;;
|
||||||
i386) do_in_target "${TARGET}" apt-get install -y -t bookworm-backports grub2 grub2-common grub-efi-ia32 ;;
|
i386) do_in_target "${TARGET}" apt-get install -y -t bookworm-backports grub2 grub2-common grub-efi-ia32 ;;
|
||||||
*) do_log "emergency" "true" "Unsupported UEFI architecture: ${VAR_ARCHITECTURE}"; return "${ERR_GRUB_ARCHITECTURE}" ;;
|
*) do_log "emergency" "file_only" "Unsupported UEFI architecture: ${VAR_ARCHITECTURE}"; return "${ERR_GRUB_ARCHITECTURE}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -70,7 +70,7 @@ setup_grub() {
|
|||||||
amd64) do_in_target "${TARGET}" apt-get install -y grub2 grub2-common grub-efi-amd64 ;;
|
amd64) do_in_target "${TARGET}" apt-get install -y grub2 grub2-common grub-efi-amd64 ;;
|
||||||
arm64) do_in_target "${TARGET}" apt-get install -y grub2 grub2-common grub-efi-arm64 ;;
|
arm64) do_in_target "${TARGET}" apt-get install -y grub2 grub2-common grub-efi-arm64 ;;
|
||||||
i386) do_in_target "${TARGET}" apt-get install -y grub2 grub2-common grub-efi-ia32 ;;
|
i386) do_in_target "${TARGET}" apt-get install -y grub2 grub2-common grub-efi-ia32 ;;
|
||||||
*) do_log "emergency" "true" "Unsupported UEFI architecture: ${VAR_ARCHITECTURE}"; return "${ERR_GRUB_ARCHITECTURE}" ;;
|
*) do_log "emergency" "file_only" "Unsupported UEFI architecture: ${VAR_ARCHITECTURE}"; return "${ERR_GRUB_ARCHITECTURE}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -103,7 +103,7 @@ setup_grub() {
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
do_log "emergency" "true" "Unsupported combination of partition table: '${VAR_RECIPE_TABLE,,}' and setting: grub_force_efi '${grub_force_efi,,}'."
|
do_log "emergency" "file_only" "Unsupported combination of partition table: '${VAR_RECIPE_TABLE,,}' and setting: grub_force_efi '${grub_force_efi,,}'."
|
||||||
return "${ERR_GRUB_EFI_FORCE}"
|
return "${ERR_GRUB_EFI_FORCE}"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -176,7 +176,7 @@ EOF
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
do_log "info" "true" "GRUB2 setup skipped."
|
do_log "info" "file_only" "GRUB2 setup skipped."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ get_all_boot_devs() {
|
|||||||
done < <(lsblk -dn -o NAME | grep -E '^mmcblk[0-9]+$')
|
done < <(lsblk -dn -o NAME | grep -E '^mmcblk[0-9]+$')
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
do_log "warning" "true" "Unrecognized boot device prefix: ${dev_prefix}"
|
do_log "warning" "file_only" "Unrecognized boot device prefix: ${dev_prefix}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ install_grub_bios_all() {
|
|||||||
case "${VAR_RECIPE_TABLE,,}" in
|
case "${VAR_RECIPE_TABLE,,}" in
|
||||||
gpt) partmod="part_gpt" ;;
|
gpt) partmod="part_gpt" ;;
|
||||||
msdos|mbr) partmod="part_msdos" ;;
|
msdos|mbr) partmod="part_msdos" ;;
|
||||||
*) do_log "emergency" "true" "Unknown partition table type: '${VAR_RECIPE_TABLE}'."; return "${ERR_PARTITIONTBL}" ;;
|
*) do_log "emergency" "file_only" "Unknown partition table type: '${VAR_RECIPE_TABLE}'."; return "${ERR_PARTITIONTBL}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
declare var_modules="btrfs cryptodisk luks2 gcry_rijndael gcry_sha256 gcry_sha512 ${partmod}"
|
declare var_modules="btrfs cryptodisk luks2 gcry_rijndael gcry_sha256 gcry_sha512 ${partmod}"
|
||||||
@@ -268,7 +268,7 @@ install_grub_bios_all() {
|
|||||||
|
|
||||||
for dev in "${ary_bootdev_all[@]}"; do
|
for dev in "${ary_bootdev_all[@]}"; do
|
||||||
do_in_target "${TARGET}" grub-install "${args[@]}" "${dev}"
|
do_in_target "${TARGET}" grub-install "${args[@]}" "${dev}"
|
||||||
do_log "info" "true" "Installed: GRUB on Device: '${dev}' (BIOS)."
|
do_log "info" "file_only" "Installed: GRUB on Device: '${dev}' (BIOS)."
|
||||||
var_update_grub_required="true"
|
var_update_grub_required="true"
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ install_grub_uefi_all() {
|
|||||||
case "${VAR_RECIPE_TABLE,,}" in
|
case "${VAR_RECIPE_TABLE,,}" in
|
||||||
gpt) partmod="part_gpt" ;;
|
gpt) partmod="part_gpt" ;;
|
||||||
msdos|mbr) partmod="part_msdos" ;;
|
msdos|mbr) partmod="part_msdos" ;;
|
||||||
*) do_log "emergency" "true" "Unknown partition table type: '${VAR_RECIPE_TABLE}'."; return "${ERR_PARTITIONTBL}" ;;
|
*) do_log "emergency" "file_only" "Unknown partition table type: '${VAR_RECIPE_TABLE}'."; return "${ERR_PARTITIONTBL}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
declare var_modules="btrfs cryptodisk luks2 gcry_rijndael gcry_sha256 gcry_sha512 ${partmod}"
|
declare var_modules="btrfs cryptodisk luks2 gcry_rijndael gcry_sha256 gcry_sha512 ${partmod}"
|
||||||
@@ -302,7 +302,7 @@ install_grub_uefi_all() {
|
|||||||
|
|
||||||
for dev in "${ary_bootdev_all[@]}"; do
|
for dev in "${ary_bootdev_all[@]}"; do
|
||||||
do_in_target "${TARGET}" grub-install "${args[@]}"
|
do_in_target "${TARGET}" grub-install "${args[@]}"
|
||||||
do_log "info" "true" "Installed: GRUB on Device: '${dev}' (UEFI)."
|
do_log "info" "file_only" "Installed: GRUB on Device: '${dev}' (UEFI)."
|
||||||
var_update_grub_required="true"
|
var_update_grub_required="true"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,6 @@
|
|||||||
|
|
||||||
guard_sourcing
|
guard_sourcing
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Append GRUB superuser block to 40_custom.
|
|
||||||
# Arguments:
|
|
||||||
# 1: Username
|
|
||||||
# 2: Password
|
|
||||||
#######################################
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Append GRUB superuser block to '/etc/grub.d/40_custom'.
|
# Append GRUB superuser block to '/etc/grub.d/40_custom'.
|
||||||
# Globals:
|
# Globals:
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ setup_grub_bootparameter() {
|
|||||||
for var_param in "${ARY_BOOTPARAM[@]}"; do
|
for var_param in "${ARY_BOOTPARAM[@]}"; do
|
||||||
|
|
||||||
if [[ -z "${var_param}" ]]; then
|
if [[ -z "${var_param}" ]]; then
|
||||||
do_log "warn" "true" "Empty GRUB parameter detected and skipped."
|
do_log "warn" "file_only" "Empty GRUB parameter detected and skipped."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q --word-regexp "${var_param%%=*}" <<< "${VAR_GRUB_CMDLINE_LINUX_DEFAULT}"; then
|
if grep -q --word-regexp "${var_param%%=*}" <<< "${VAR_GRUB_CMDLINE_LINUX_DEFAULT}"; then
|
||||||
do_log "info" "true" "Skipping duplicate kernel parameter: '${var_param}'."
|
do_log "info" "file_only" "Skipping duplicate kernel parameter: '${var_param}'."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ setup_grub_bootparameter() {
|
|||||||
|
|
||||||
do_in_target "${TARGET}" update-grub
|
do_in_target "${TARGET}" update-grub
|
||||||
|
|
||||||
do_log "info" "true" "Setting GRUB kernel parameters: ${VAR_GRUB_CMDLINE_LINUX_DEFAULT}"
|
do_log "info" "file_only" "Setting GRUB kernel parameters: ${VAR_GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ setup_kernel_modules() {
|
|||||||
jitterentropy_rng
|
jitterentropy_rng
|
||||||
EOF
|
EOF
|
||||||
chmod 0644 "${TARGET}/usr/lib/modules-load.d/30_security-misc.conf"
|
chmod 0644 "${TARGET}/usr/lib/modules-load.d/30_security-misc.conf"
|
||||||
do_log "info" "true" "Installed: '/usr/lib/modules-load.d/30_security-misc.conf'."
|
do_log "info" "file_only" "Installed: '/usr/lib/modules-load.d/30_security-misc.conf'."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ EOF
|
|||||||
setup_modprobe() {
|
setup_modprobe() {
|
||||||
install -D -m 0755 -o root -g root "${VAR_SETUP_PATH}/includes/etc/modprobe.d/0000_ciss_debian_installer.cnf" \
|
install -D -m 0755 -o root -g root "${VAR_SETUP_PATH}/includes/etc/modprobe.d/0000_ciss_debian_installer.cnf" \
|
||||||
"${TARGET}/etc/modprobe.d/0000_ciss_debian_installer.conf"
|
"${TARGET}/etc/modprobe.d/0000_ciss_debian_installer.conf"
|
||||||
do_log "info" "true" "Installed: '/etc/modprobe.d/0000_ciss_debian_installer.conf'."
|
do_log "info" "file_only" "Installed: '/etc/modprobe.d/0000_ciss_debian_installer.conf'."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ guard_sourcing
|
|||||||
setup_kernel_sysctl() {
|
setup_kernel_sysctl() {
|
||||||
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/sysctl.d/99_local.hardened.ini" \
|
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/sysctl.d/99_local.hardened.ini" \
|
||||||
"${TARGET}/etc/sysctl.d/99_local.hardened"
|
"${TARGET}/etc/sysctl.d/99_local.hardened"
|
||||||
do_log "info" "true" "Installed: '/etc/sysctl.d/99_local.hardened'."
|
do_log "info" "file_only" "Installed: '/etc/sysctl.d/99_local.hardened'."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ installation_microcode() {
|
|||||||
case "${var_cpu_vendor}" in
|
case "${var_cpu_vendor}" in
|
||||||
*AuthenticAMD*) var_microcode_pkgs="amd64-microcode" ;;
|
*AuthenticAMD*) var_microcode_pkgs="amd64-microcode" ;;
|
||||||
*GenuineIntel*) var_microcode_pkgs="intel-microcode" ;;
|
*GenuineIntel*) var_microcode_pkgs="intel-microcode" ;;
|
||||||
""|*ARM*|*arm*|*) var_microcode_pkgs=""; do_log "info" "true" "ARM or unknown CPU detected, skipping microcode installation." ;;
|
""|*ARM*|*arm*|*) var_microcode_pkgs=""; do_log "info" "file_only" "ARM or unknown CPU detected, skipping microcode installation." ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
@@ -50,7 +50,7 @@ installation_microcode() {
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
do_log "info" "true" "Skipping microcode install (${var_whereiam}, ${var_microcode_pkgs:-none})"
|
do_log "info" "file_only" "Skipping microcode install (${var_whereiam}, ${var_microcode_pkgs:-none})"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ setup_ssh() {
|
|||||||
|
|
||||||
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/banner" "${TARGET}/etc/"
|
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/banner" "${TARGET}/etc/"
|
||||||
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/motd" "${TARGET}/etc/"
|
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/motd" "${TARGET}/etc/"
|
||||||
do_log "info" "true" "Installed SSH banner and motd to '${TARGET}/etc/'."
|
do_log "info" "file_only" "Installed SSH banner and motd to '${TARGET}/etc/'."
|
||||||
|
|
||||||
### Only process those for which both *_name and *_authentication_access_ssh are set.
|
### Only process those for which both *_name and *_authentication_access_ssh are set.
|
||||||
for ((i = 0; i <= VAR_USER_MAX; i++)); do
|
for ((i = 0; i <= VAR_USER_MAX; i++)); do
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ build_dropbear() {
|
|||||||
# shellcheck disable=2312
|
# shellcheck disable=2312
|
||||||
make -j"$(nproc)"
|
make -j"$(nproc)"
|
||||||
|
|
||||||
do_log "info" "true" "Ultra Hardened dropbear-2025.88 build successfully from sources."
|
do_log "info" "file_only" "Ultra Hardened dropbear-2025.88 build successfully from sources."
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ DROPBEAR_OPTIONS="-b /etc/dropbear/banner -c /usr/local/bin/unlock_wrapper.sh -E
|
|||||||
#DROPBEAR_SHUTDOWN_TIMEOUT=60
|
#DROPBEAR_SHUTDOWN_TIMEOUT=60
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
do_log "info" "true" "Written: '${TARGET}/etc/dropbear/initramfs/dropbear.conf'."
|
do_log "info" "file_only" "Written: '${TARGET}/etc/dropbear/initramfs/dropbear.conf'."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ setup_accounts() {
|
|||||||
if [[ -x "${TARGET}${user_root_shell}" ]]; then
|
if [[ -x "${TARGET}${user_root_shell}" ]]; then
|
||||||
do_in_target "${TARGET}" chsh -s "${user_root_shell}" root
|
do_in_target "${TARGET}" chsh -s "${user_root_shell}" root
|
||||||
else
|
else
|
||||||
do_log "warn" "true" "Shell: '${user_root_shell}' not found for: 'root'. Using '/bin/bash' instead."
|
do_log "warn" "file_only" "Shell: '${user_root_shell}' not found for: 'root'. Using '/bin/bash' instead."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
var_chpasswd="root:${user_root_password}"
|
var_chpasswd="root:${user_root_password}"
|
||||||
@@ -84,7 +84,7 @@ setup_accounts() {
|
|||||||
echo 'set clipboard=unnamed' >| "${TARGET}/root/.vimrc"
|
echo 'set clipboard=unnamed' >| "${TARGET}/root/.vimrc"
|
||||||
chmod 0600 "${TARGET}/root/.vimrc"
|
chmod 0600 "${TARGET}/root/.vimrc"
|
||||||
|
|
||||||
do_log "info" "true" "User: 'root' updated."
|
do_log "info" "file_only" "User: 'root' updated."
|
||||||
|
|
||||||
### Install all user accounts.
|
### Install all user accounts.
|
||||||
for ((i = 0; i <= VAR_USER_MAX; i++)); do
|
for ((i = 0; i <= VAR_USER_MAX; i++)); do
|
||||||
@@ -155,7 +155,7 @@ setup_accounts() {
|
|||||||
printf "%s\n" "${var_sshpubkey}" >> "${var_sshdir}/authorized_keys"
|
printf "%s\n" "${var_sshpubkey}" >> "${var_sshdir}/authorized_keys"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_log "info" "true" "Created user: [${var_username}] UID: [${var_uid}], GID: [${var_gid}]"
|
do_log "info" "file_only" "Created user: [${var_username}] UID: [${var_uid}], GID: [${var_gid}]"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ setup_chrony() {
|
|||||||
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/chrony/chrony.cnf" "${TARGET}/etc/chrony/chrony.conf"
|
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/etc/chrony/chrony.cnf" "${TARGET}/etc/chrony/chrony.conf"
|
||||||
cat "${var_of}" >> "${TARGET}/etc/chrony/chrony.conf"
|
cat "${var_of}" >> "${TARGET}/etc/chrony/chrony.conf"
|
||||||
|
|
||||||
do_log "info" "false" "Chrony NTPsec client installed."
|
do_log "info" "file_only" "Chrony NTPsec client installed."
|
||||||
|
|
||||||
rm -f "${var_of}"
|
rm -f "${var_of}"
|
||||||
unset var_of
|
unset var_of
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ guard_sourcing
|
|||||||
#######################################
|
#######################################
|
||||||
exiting_chroot() {
|
exiting_chroot() {
|
||||||
umount -lf "${TARGET}/proc"
|
umount -lf "${TARGET}/proc"
|
||||||
do_log "info" "true" "'umount -lf ${TARGET}/proc'."
|
do_log "info" "file_only" "'umount -lf ${TARGET}/proc'."
|
||||||
umount -lf "${TARGET}/sys"
|
umount -lf "${TARGET}/sys"
|
||||||
do_log "info" "true" "'umount -lf ${TARGET}/sys'."
|
do_log "info" "file_only" "'umount -lf ${TARGET}/sys'."
|
||||||
umount -lf "${TARGET}/dev"
|
umount -lf "${TARGET}/dev"
|
||||||
do_log "info" "true" "'umount -lf ${TARGET}/dev'."
|
do_log "info" "file_only" "'umount -lf ${TARGET}/dev'."
|
||||||
umount -lf "${TARGET}/run"
|
umount -lf "${TARGET}/run"
|
||||||
do_log "info" "true" "'umount -lf ${TARGET}/run'."
|
do_log "info" "file_only" "'umount -lf ${TARGET}/run'."
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,12 +89,12 @@ do_log() {
|
|||||||
declare var_log_entry=("${var_ts} [${var_log_level}]: ${ary_message[*]}")
|
declare var_log_entry=("${var_ts} [${var_log_level}]: ${ary_message[*]}")
|
||||||
|
|
||||||
if do_should_log "${var_log_level}"; then
|
if do_should_log "${var_log_level}"; then
|
||||||
if [[ "${var_log_only,,}" == "true" ]]; then
|
if [[ "${var_log_only,,}" == "file_only" ]]; then
|
||||||
case "${var_log_level,,}" in
|
case "${var_log_level,,}" in
|
||||||
debug | info | notice) do_print_log "${var_log_entry[*]}" >> "${LOG_INS}" ;;
|
debug | info | notice) do_print_log "${var_log_entry[*]}" >> "${LOG_INS}" ;;
|
||||||
warn | error | critical | fatal | emergency ) do_print_log "${var_log_entry[*]}" >> "${LOG_ERR}" ;;
|
warn | error | critical | fatal | emergency ) do_print_log "${var_log_entry[*]}" >> "${LOG_ERR}" ;;
|
||||||
esac
|
esac
|
||||||
elif [[ "${var_log_only,,}" == "false" ]]; then
|
elif [[ "${var_log_only,,}" == "tty" ]]; then
|
||||||
case "${var_log_level,,}" in
|
case "${var_log_level,,}" in
|
||||||
debug | info | notice)
|
debug | info | notice)
|
||||||
if [[ ${#var_msg_string} -le 76 ]]; then
|
if [[ ${#var_msg_string} -le 76 ]]; then
|
||||||
@@ -22,58 +22,60 @@ guard_sourcing
|
|||||||
check_pkgs() {
|
check_pkgs() {
|
||||||
apt-get update -y > /dev/null 2>&1
|
apt-get update -y > /dev/null 2>&1
|
||||||
|
|
||||||
|
# TODO: Only activate in case CISS.debian.live.builder does not include the following packages as per default.
|
||||||
### Define HashMap: command -> package
|
### Define HashMap: command -> package
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
declare -A hmp_command_packages=(
|
#declare -A hmp_command_packages=(
|
||||||
[apt-transport-https]=apt-transport-https
|
# [apt-transport-https]=apt-transport-https
|
||||||
[bzip2]=bzip2
|
# [bzip2]=bzip2
|
||||||
[ca-certificates]=ca-certificates
|
# [ca-certificates]=ca-certificates
|
||||||
[curl]=curl
|
# [curl]=curl
|
||||||
[expect]=expect
|
# [expect]=expect
|
||||||
[fdisk]=fdisk
|
# [fdisk]=fdisk
|
||||||
[gdisk]=gdisk
|
# [gdisk]=gdisk
|
||||||
[git]=git
|
# [git]=git
|
||||||
[gpg]=gnupg
|
# [gpg]=gnupg
|
||||||
[lsb_release]=lsb-release
|
# [lsb_release]=lsb-release
|
||||||
[mkfs.btrfs]=btrfs-progs
|
# [mkfs.btrfs]=btrfs-progs
|
||||||
[mkfs.ext4]=e2fsprogs
|
# [mkfs.ext4]=e2fsprogs
|
||||||
[mkfs.fat]=dosfstools
|
# [mkfs.fat]=dosfstools
|
||||||
[mkswap]=util-linux
|
# [mkswap]=util-linux
|
||||||
[mkfs.xfs]=xfsprogs
|
# [mkfs.xfs]=xfsprogs
|
||||||
[parted]=parted
|
# [parted]=parted
|
||||||
[pwgen]=pwgen
|
# [pwgen]=pwgen
|
||||||
[tar]=tar
|
# [tar]=tar
|
||||||
[wget]=wget
|
# [wget]=wget
|
||||||
[whois]=whois
|
# [whois]=whois
|
||||||
[xz]=xz-utils
|
# [xz]=xz-utils
|
||||||
[yq]=yq
|
# [yq]=yq
|
||||||
)
|
#)
|
||||||
|
|
||||||
### Iterate over HashMap
|
### Iterate over HashMap
|
||||||
declare var_cmd var_pkg
|
#declare var_cmd var_pkg
|
||||||
for var_cmd in "${!hmp_command_packages[@]}"; do
|
#for var_cmd in "${!hmp_command_packages[@]}"; do
|
||||||
var_pkg="${hmp_command_packages[${var_cmd}]}"
|
# var_pkg="${hmp_command_packages[${var_cmd}]}"
|
||||||
if ! command -v "${var_cmd}" &>/dev/null; then
|
# if ! command -v "${var_cmd}" &>/dev/null; then
|
||||||
do_log "info" "true" "Installing ${var_pkg} ..."
|
# apt-get install -y --no-install-recommends "${var_pkg}"
|
||||||
apt-get install -y --no-install-recommends "${var_pkg}"
|
# do_log "info" "file_only" "Installing ${var_pkg} done."
|
||||||
do_log "info" "true" "Installing ${var_pkg} done."
|
# else
|
||||||
else
|
# do_log "info" "file_only" "${var_cmd} already installed."
|
||||||
do_log "info" "true" "${var_cmd} already installed."
|
# fi
|
||||||
fi
|
#done
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -z "$(command -v debootstrap || true)" ]]; then
|
#if [[ -z "$(command -v debootstrap || true)" ]]; then
|
||||||
if grep -RqsE '^[[:space:]]*deb .*backports' /etc/apt/sources.list /etc/apt/sources.list.d; then
|
# if grep -RqsE '^[[:space:]]*deb .*backports' /etc/apt/sources.list /etc/apt/sources.list.d; then
|
||||||
# shellcheck disable=SC2155
|
# # shellcheck disable=SC2155
|
||||||
declare codename=$(lsb_release -sc)
|
# declare codename=$(lsb_release -sc)
|
||||||
apt-get install -y -t "${codename}-backports" debootstrap
|
# apt-get install -y -t "${codename}-backports" debootstrap
|
||||||
else
|
# else
|
||||||
apt-get install -y debootstrap
|
# apt-get install -y debootstrap
|
||||||
fi
|
# fi
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
if [[ -z "$(command -v dialog || true)" ]]; then
|
#if [[ -z "$(command -v dialog || true)" ]]; then
|
||||||
if ! "${VAR_AUTO_INSTALL}"; then apt-get install -y --no-install-recommends dialog; fi
|
# if ! "${VAR_AUTO_INSTALL}"; then apt-get install -y --no-install-recommends dialog; fi
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -10,13 +10,17 @@
|
|||||||
# SPDX-PackageName: CISS.debian.live.builder
|
# SPDX-PackageName: CISS.debian.live.builder
|
||||||
# SPDX-Security-Contact: security@coresecret.eu
|
# SPDX-Security-Contact: security@coresecret.eu
|
||||||
|
|
||||||
|
guard_sourcing
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Trap function to be called on 'EXIT'.
|
# Trap function to be called on 'EXIT'.
|
||||||
# Globals:
|
# Globals:
|
||||||
# VAR_DEBUG_TRACE
|
# VAR_DEBUG_TRACE
|
||||||
# VAR_DEBUG_TRAP
|
# VAR_DEBUG_TRAP
|
||||||
|
# VAR_LAST_CMD
|
||||||
|
# __preexec_invoke
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# $1: "$?"
|
# 1: "$?"
|
||||||
#######################################
|
#######################################
|
||||||
trap_exit() {
|
trap_exit() {
|
||||||
trap - DEBUG ERR EXIT INT
|
trap - DEBUG ERR EXIT INT
|
||||||
@@ -49,7 +53,7 @@ trap_exit() {
|
|||||||
# VAR_DEBUG_TRAP
|
# VAR_DEBUG_TRAP
|
||||||
# VAR_SCRIPT_SUCCESS
|
# VAR_SCRIPT_SUCCESS
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# $1: ${var_trap_on_exit_code} of trap_exit()
|
# 1: ${var_trap_on_exit_code} of trap_exit()
|
||||||
#######################################
|
#######################################
|
||||||
print_scr_exit() {
|
print_scr_exit() {
|
||||||
declare -r var_print_scr_exit_code="$1"
|
declare -r var_print_scr_exit_code="$1"
|
||||||
|
|||||||
@@ -10,10 +10,12 @@
|
|||||||
# SPDX-PackageName: CISS.debian.installer
|
# SPDX-PackageName: CISS.debian.installer
|
||||||
# SPDX-Security-Contact: security@coresecret.eu
|
# SPDX-Security-Contact: security@coresecret.eu
|
||||||
|
|
||||||
|
guard_sourcing
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Restart Dialog Wrapper in case of unintentional SIGINT.
|
# Restart Dialog Wrapper in case of unintentional SIGINT.
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# $1: Dialog Wrapper in use.
|
# 1: Dialog Wrapper in use.
|
||||||
#######################################
|
#######################################
|
||||||
restart_dialog() {
|
restart_dialog() {
|
||||||
trap 'trap_int' INT
|
trap 'trap_int' INT
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
# SPDX-PackageName: CISS.debian.live.builder
|
# SPDX-PackageName: CISS.debian.live.builder
|
||||||
# SPDX-Security-Contact: security@coresecret.eu
|
# SPDX-Security-Contact: security@coresecret.eu
|
||||||
|
|
||||||
|
guard_sourcing
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Clean Up Wrapper on Trap on 'EXIT'.
|
# Clean Up Wrapper on Trap on 'EXIT'.
|
||||||
# Globals:
|
# Globals:
|
||||||
@@ -17,9 +19,9 @@
|
|||||||
# VAR_KERNEL_INF
|
# VAR_KERNEL_INF
|
||||||
# VAR_KERNEL_SRT
|
# VAR_KERNEL_SRT
|
||||||
# VAR_KERNEL_TMP
|
# VAR_KERNEL_TMP
|
||||||
# VAR_WORKDIR
|
# VAR_NOTES
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# $1: ${var_trap_on_exit_code} of trap_exit()
|
# 1: ${var_trap_on_exit_code} of trap_exit()
|
||||||
#######################################
|
#######################################
|
||||||
clean_up() {
|
clean_up() {
|
||||||
declare var_clean_exit_code="$1"
|
declare var_clean_exit_code="$1"
|
||||||
@@ -27,11 +29,11 @@ clean_up() {
|
|||||||
rm -f -- "${VAR_KERNEL_SRT}"
|
rm -f -- "${VAR_KERNEL_SRT}"
|
||||||
rm -f -- "${VAR_KERNEL_TMP}"
|
rm -f -- "${VAR_KERNEL_TMP}"
|
||||||
rm -f -- "${VAR_NOTES}"
|
rm -f -- "${VAR_NOTES}"
|
||||||
# Release advisory lock on FD 127.
|
### Release advisory lock on FD 127.
|
||||||
flock -u 127
|
flock -u 127
|
||||||
# Close file descriptor 127.
|
### Close file descriptor 127.
|
||||||
exec 127>&-
|
exec 127>&-
|
||||||
# Remove the lockfile artifact.
|
### Remove the lockfile artifact.
|
||||||
rm -f /run/lock/ciss_debian_installer.lock
|
rm -f /run/lock/ciss_debian_installer.lock
|
||||||
if (( var_clean_exit_code == 0 )); then rm -f -- "${LOG_ERR}"; fi
|
if (( var_clean_exit_code == 0 )); then rm -f -- "${LOG_ERR}"; fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ arg_priority_check() {
|
|||||||
if [[ -n ${VAR_PRIORITY} ]]; then
|
if [[ -n ${VAR_PRIORITY} ]]; then
|
||||||
renice "${VAR_PRIORITY}" -p "$$"
|
renice "${VAR_PRIORITY}" -p "$$"
|
||||||
var=$(ps -o ni= -p $$) > /dev/null 2>&1
|
var=$(ps -o ni= -p $$) > /dev/null 2>&1
|
||||||
do_log "info" "true" "New renice value: '${var}'."
|
do_log "info" "file_only" "New renice value: '${var}'."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Check if ionice PRIORITY is set and adjust ionice priority.
|
### Check if ionice PRIORITY is set and adjust ionice priority.
|
||||||
if [[ -n ${VAR_REIONICE_CLASS} ]]; then
|
if [[ -n ${VAR_REIONICE_CLASS} ]]; then
|
||||||
ionice -c"${VAR_REIONICE_CLASS:-2}" -n"${VAR_REIONICE_PRIORITY:-4}" -p "$$"
|
ionice -c"${VAR_REIONICE_CLASS:-2}" -n"${VAR_REIONICE_PRIORITY:-4}" -p "$$"
|
||||||
var=$(ionice -p $$) > /dev/null 2>&1
|
var=$(ionice -p $$) > /dev/null 2>&1
|
||||||
do_log "info" "true" "New ionice value: '${var}'."
|
do_log "info" "file_only" "New ionice value: '${var}'."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -52,13 +52,13 @@ nuke_passphrase() {
|
|||||||
|
|
||||||
sync
|
sync
|
||||||
if shred -vfzu -n 5 "${var_nuke_pwd_file}" > /dev/null 2>&1; then
|
if shred -vfzu -n 5 "${var_nuke_pwd_file}" > /dev/null 2>&1; then
|
||||||
do_log "info" "false" "✅ Password file '${var_nuke_pwd_file}': shred -vfzu -n 5 >> done."
|
do_log "info" "file_only" "✅ Password file '${var_nuke_pwd_file}': shred -vfzu -n 5 >> done."
|
||||||
else
|
else
|
||||||
do_log "warn" "false" "❌ Password file '${var_nuke_pwd_file}': shred -vfzu -n 5 >> NOT successful."
|
do_log "warn" "false" "❌ Password file '${var_nuke_pwd_file}': shred -vfzu -n 5 >> NOT successful."
|
||||||
fi
|
fi
|
||||||
sync
|
sync
|
||||||
|
|
||||||
do_log "info" "false" "Nuke Hash generated."
|
do_log "info" "file_only" "Nuke Hash generated."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
. ./func/helper/1084_helper_sanitizer.sh
|
. ./func/helper/1084_helper_sanitizer.sh
|
||||||
. ./func/helper/1085_helper_secure_dl.sh
|
. ./func/helper/1085_helper_secure_dl.sh
|
||||||
. ./func/helper/1086_helper_yaml.sh
|
. ./func/helper/1086_helper_yaml.sh
|
||||||
. ./func/helper/1120_logging_modules.sh
|
|
||||||
. ./func/helper/1220_validation_element.sh
|
. ./func/helper/1220_validation_element.sh
|
||||||
. ./func/helper/1221_validation_ip.sh
|
. ./func/helper/1221_validation_ip.sh
|
||||||
. ./func/helper/1222_validation_preseed.sh
|
. ./func/helper/1222_validation_preseed.sh
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
. ./lib/0011_guard_safe_exec.sh
|
. ./lib/0011_guard_safe_exec.sh
|
||||||
. ./lib/0020_gen_dir_files.sh
|
. ./lib/0020_gen_dir_files.sh
|
||||||
|
. ./lib/0025_logging_modules.sh
|
||||||
. ./lib/0030_check_pkgs.sh
|
. ./lib/0030_check_pkgs.sh
|
||||||
. ./lib/0031_check_git.sh
|
. ./lib/0031_check_git.sh
|
||||||
. ./lib/0040_check_var.sh
|
. ./lib/0040_check_var.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user