V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 54s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 54s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -58,7 +58,7 @@ partitioning() {
|
||||
# shellcheck disable=SC2034
|
||||
declare -ag ARY_FORMT_MOUNT_PATHS=() # Used in: 3240() - Only entries [/paths] for filesystem generation.
|
||||
# shellcheck disable=SC2034
|
||||
declare -ag ARY_FSTAB_MOUNT_PATHS=() # Used in: 4200() - Only entries [/paths] for '/etc/fstab' generation.
|
||||
declare -ag ARY_FSTAB_MOUNT_PATHS=() # Used in: 4200() - Only entries [/paths] for the '/etc/fstab' generation.
|
||||
# shellcheck disable=SC2034
|
||||
declare -ag ARY_PATHS_SORTED=() # Used in: 3280() - All entries [/paths] in a mount ordering scheme.
|
||||
# Used in: 4200() - All entries [/paths] in a mount ordering scheme.
|
||||
@@ -69,7 +69,7 @@ partitioning() {
|
||||
|
||||
declare -a ary_devs=() ary_parts=() ary_paths_unsorted=()
|
||||
|
||||
declare -i i=0 var_dev_size=0 var_dev_end=0 var_multi_boot=0 var_multi_esp=0
|
||||
declare -i i=0 var_dev_size=0 var_dev_end=0 var_sec_size=512
|
||||
|
||||
### Iterate over all devices in the recipe.
|
||||
# shellcheck disable=SC2312
|
||||
@@ -141,7 +141,7 @@ partitioning() {
|
||||
var_mount_true=$(yq_val ".recipe.${VAR_RECIPE_STRING}.dev.${var_dev}.${var_part}.mount.enable" "${VAR_SETUP_PART}")
|
||||
var_encryption=$(yq_val ".recipe.${VAR_RECIPE_STRING}.dev.${var_dev}.${var_part}.encryption.enable" "${VAR_SETUP_PART}")
|
||||
|
||||
### Assign the start zone of the first partition and skip the first 2 MiB as best practice.
|
||||
### Assign the start zone of the first partition and skip the first 2 MiB as the best practice.
|
||||
if [[ "${var_begin,,}" == "min" ]]; then
|
||||
var_begin="2MiB"
|
||||
fi
|
||||
@@ -150,8 +150,9 @@ partitioning() {
|
||||
### There is no mandatory upper limit, but for particularly critical systems (FDE, RAID-6 setups, dm-integrity, etc.),
|
||||
### more generous reserves between 32 and 64 MiB are recommended.
|
||||
if [[ "${var_end,,}" == "max" ]]; then
|
||||
var_sec_size=$(blockdev --getpbsz "/dev/${var_dev}")
|
||||
var_dev_size=$(blockdev --getsize64 "/dev/${var_dev}")
|
||||
var_dev_end=$(( var_dev_size - 64 * 1024 * 1024 ))
|
||||
var_dev_end=$(( var_dev_size - (64 * 1024 * 1024) ))
|
||||
var_end_mib=$(( var_dev_end / 1024 / 1024 ))
|
||||
var_end_arg="${var_end_mib}MiB"
|
||||
else
|
||||
@@ -187,7 +188,7 @@ partitioning() {
|
||||
|
||||
do_log "info" "file_only" "3200() Partition: '/dev/${var_dev}${var_part}' generated | begin: '${var_begin}' | end: '${var_end_arg}'."
|
||||
|
||||
### Assign the correct GPT typecode via sgdisk if table is GPT.
|
||||
### Assign the correct GPT typecode via sgdisk if the table is GPT.
|
||||
if [[ "${VAR_RECIPE_TABLE,,}" == "gpt" ]]; then
|
||||
declare typecode="8300" # Default: Linux FS
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ validate_btrfs_compression() {
|
||||
mount_partition() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
# shellcheck disable=SC2034
|
||||
declare -Ag HMP_FSTAB_MOUNT_OPTS # Used in: 4040() - [Mount Path:Mount Options].
|
||||
declare -Ag HMP_FSTAB_MOUNT_OPTS # Used in: 4200() - [Mount Path:Mount Options].
|
||||
|
||||
declare var_mount_path="" var_dev_part="" var_dev="" var_btrfs_options="" \
|
||||
var_encryption_label="" var_fs_btrfs_compress="" var_fs_btrfs_level="" var_fs_btrfs_snapshot="" \
|
||||
@@ -354,8 +354,12 @@ mount_partition() {
|
||||
|
||||
var_dev="${var_dev_part%.*}"
|
||||
lsblk -o NAME,MAJ:MIN,FSTYPE,FSVER,SIZE,UUID,MOUNTPOINT,PATH "/dev/${var_dev}" >| "${DIR_LOG}/${var_dev}_overview_3280.log"
|
||||
printf "%b" "${NL}" >> "${DIR_LOG}/${var_dev}_overview_3280.log"
|
||||
lsblk "/dev/${var_dev}" >> "${DIR_LOG}/${var_dev}_overview_3280.log"
|
||||
{
|
||||
printf "%b" "${NL}"
|
||||
lsblk "/dev/${var_dev}"
|
||||
printf "%b" "${NL}"
|
||||
lsblk -t "/dev/${var_dev}"
|
||||
} >> "${DIR_LOG}/${var_dev}_overview_3280.log"
|
||||
|
||||
done
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ update_sources() {
|
||||
if [[ "${apt_updates_policy,,}" == "unattended" ]]; then
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests unattended-upgrades 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests unattended-upgrades 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
do_log "info" "file_only" "4110() The update policy was set at installation time to: '${apt_updates_policy}'."
|
||||
@@ -49,7 +50,8 @@ update_sources() {
|
||||
elif [[ "${apt_updates_policy,,}" == "security" ]]; then
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests unattended-upgrades 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests unattended-upgrades 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ installation_kernel() {
|
||||
if [[ -n "${VAR_KERNEL}" ]]; then
|
||||
|
||||
do_in_target_script "${TARGET}" '
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests '"${VAR_KERNEL}"' initramfs-tools 2>&1 | tee -a '"${var_logfile}"'
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests '"${VAR_KERNEL}"' initramfs-tools 2>&1 | tee -a '"${var_logfile}"'
|
||||
echo ExitCode: $? >> '"${var_logfile}"'
|
||||
'
|
||||
|
||||
@@ -46,7 +47,8 @@ installation_kernel() {
|
||||
else
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests ${image} initramfs-tools 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests ${image} initramfs-tools 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
|
||||
@@ -120,7 +120,8 @@ installation_toolset() {
|
||||
do_log "debug" "file_only" "4130() [ary_unique_pkgs]='${ary_unique_pkgs[*]}'."
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests ${ary_unique_pkgs[*]} 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests ${ary_unique_pkgs[*]} 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ installation_systemd() {
|
||||
do_log "info" "file_only" "4131() 'systemctl' NOT found, installing 'systemd' and dependencies."
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests systemd systemd-sysv dbus 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests systemd systemd-sysv dbus 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
|
||||
@@ -55,14 +55,16 @@ installation_microcode() {
|
||||
if ! do_in_target_script "${TARGET}" "dpkg -s ${var_microcode_pkgs} >/dev/null 2>&1"; then
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests ${var_microcode_pkgs} 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests ${var_microcode_pkgs} 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
else
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests --only-upgrade ${var_microcode_pkgs} 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests --only-upgrade ${var_microcode_pkgs} 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ installation_chrony() {
|
||||
mkdir -p "${TARGET}/var/log/chrony"
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests chrony 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests chrony 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ installation_cryptsetup() {
|
||||
touch "${TARGET}${var_logfile}" && chmod 0600 "${TARGET}${var_logfile}"
|
||||
|
||||
do_in_target_script "${TARGET}" '
|
||||
export INITRD=No apt-get install -y --no-install-recommends --no-install-suggests cryptsetup cryptsetup-initramfs 2>&1 | tee -a '"${var_logfile}"'
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends --no-install-suggests cryptsetup cryptsetup-initramfs 2>&1 | tee -a '"${var_logfile}"'
|
||||
echo ExitCode: $? >> '"${var_logfile}"'
|
||||
'
|
||||
|
||||
|
||||
@@ -78,14 +78,16 @@ installation_grub() {
|
||||
|
||||
amd64)
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends -t bookworm-backports grub2-common grub-efi-amd64 grub-efi-amd64-bin 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends -t bookworm-backports grub2-common grub-efi-amd64 grub-efi-amd64-bin 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
;;
|
||||
|
||||
arm64)
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends -t bookworm-backports grub2-common grub-efi-arm64 grub-efi-arm64-bin 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends -t bookworm-backports grub2-common grub-efi-arm64 grub-efi-arm64-bin 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
;;
|
||||
@@ -99,7 +101,8 @@ installation_grub() {
|
||||
else
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
export INITRD=No apt-get install -y --no-install-recommends -t bookworm-backports grub2-common grub-pc grub-pc-bin 2>&1 | tee -a ${var_logfile}
|
||||
export INITRD=No
|
||||
apt-get install -y --no-install-recommends -t bookworm-backports grub2-common grub-pc grub-pc-bin 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
@@ -111,14 +114,14 @@ installation_grub() {
|
||||
if [[ "${VAR_RECIPE_FIRMWARE}" == "uefi" ]]; then
|
||||
|
||||
case "${VAR_ARCHITECTURE}" in
|
||||
amd64) do_in_target "${TARGET}" export INITRD=No apt-get install -y --no-install-recommends grub2-common grub-efi-amd64 grub-efi-amd64-bin ;;
|
||||
arm64) do_in_target "${TARGET}" export INITRD=No apt-get install -y --no-install-recommends grub2-common grub-efi-arm64 grub-efi-arm64-bin ;;
|
||||
amd64) do_in_target "${TARGET}" export INITRD=No; apt-get install -y --no-install-recommends grub2-common grub-efi-amd64 grub-efi-amd64-bin ;;
|
||||
arm64) do_in_target "${TARGET}" export INITRD=No; apt-get install -y --no-install-recommends grub2-common grub-efi-arm64 grub-efi-arm64-bin ;;
|
||||
*) do_log "emergency" "file_only" "4230() Unsupported architecture: ${VAR_ARCHITECTURE}"; return "${ERR_GRUB_ARCHITECTURE}" ;;
|
||||
esac
|
||||
|
||||
else
|
||||
|
||||
do_in_target "${TARGET}" export INITRD=No apt-get install -y --no-install-recommends grub2 grub2-common grub-pc grub-pc-bin
|
||||
do_in_target "${TARGET}" export INITRD=No; apt-get install -y --no-install-recommends grub2 grub2-common grub-pc grub-pc-bin
|
||||
|
||||
fi
|
||||
|
||||
@@ -159,7 +162,7 @@ EOF
|
||||
### Change the GRUB OS detection configuration accordingly.
|
||||
if [[ "${grub_prober}" == "true" ]]; then
|
||||
|
||||
do_in_target "${TARGET}" export INITRD=No apt-get install -y --no-install-recommends os-prober
|
||||
do_in_target "${TARGET}" export INITRD=No; apt-get install -y --no-install-recommends os-prober
|
||||
|
||||
cat << EOF >> "${TARGET}/etc/default/grub"
|
||||
# If your computer has multiple operating systems installed, then you
|
||||
@@ -255,7 +258,7 @@ install_grub_bios() {
|
||||
|
||||
ary_bios_arg+=( --target=i386-pc --boot-directory=/boot "--modules=${var_bios_mod}" )
|
||||
|
||||
do_in_target "${TARGET}" export INITRD=No grub-install "${ary_bios_arg[@]}" "${grub_bootdev}" || return "${ERR_GRUB_INSTALL}"
|
||||
do_in_target "${TARGET}" export INITRD=No; grub-install "${ary_bios_arg[@]}" "${grub_bootdev}" || return "${ERR_GRUB_INSTALL}"
|
||||
do_log "info" "file_only" "4230() Installed: GRUB on Device: '${grub_bootdev}' [BIOS]."
|
||||
var_update_grub_required="true"
|
||||
|
||||
@@ -302,7 +305,7 @@ install_grub_uefi() {
|
||||
|
||||
[[ "${grub_update_nvram}" == "false" ]] && ary_uefi_arg+=( --no-nvram )
|
||||
|
||||
do_in_target "${TARGET}" export INITRD=No grub-install "${ary_uefi_arg[@]}" "${grub_bootdev}" || return "${ERR_GRUB_INSTALL}"
|
||||
do_in_target "${TARGET}" export INITRD=No; grub-install "${ary_uefi_arg[@]}" "${grub_bootdev}" || return "${ERR_GRUB_INSTALL}"
|
||||
do_log "info" "file_only" "4230() Installed: GRUB on Device: '${grub_bootdev}' [UEFI]."
|
||||
var_update_grub_required="true"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user