V8.00.000.2025.06.17
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:
2025-07-24 23:01:23 +02:00
parent 1983e0229f
commit c026d9a324
48 changed files with 269 additions and 284 deletions

View File

@@ -27,10 +27,10 @@ guard_sourcing
func_debootstrap() {
# shellcheck disable=SC2312
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
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}"
fi
}

View File

@@ -40,11 +40,11 @@ configure_system() {
mkdir -p "${var_dst}"
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}"
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
@@ -52,7 +52,7 @@ configure_system() {
return "${ERR_CHRT_MOUNTS}"
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
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -28,7 +28,7 @@ guard_sourcing
write_fstab() {
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"
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
}
@@ -200,7 +200,7 @@ EOF
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
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.
var_path="SWAP"

View File

@@ -27,7 +27,7 @@ guard_sourcing
write_crypttab() {
declare _label="$1" _device="$2" _key_file="$3" _opts="$4"
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
}
@@ -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"
;;
*)
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
;;
esac

View File

@@ -53,9 +53,9 @@ generate_sources() {
var_hostsecure="${apt_sec,,}"
ary_components=(main)
[[ "${apt_contrib,,}" == true ]] && ary_components+=(contrib)
[[ "${apt_non_free,,}" == true ]] && ary_components+=(non-free)
[[ "${apt_non_free_firmware,,}" == true ]] && ary_components+=(non-free-firmware)
[[ "${apt_contrib,,}" == "true" ]] && ary_components+=(contrib)
[[ "${apt_non_free,,}" == "true" ]] && ary_components+=(non-free)
[[ "${apt_non_free_firmware,,}" == "true" ]] && ary_components+=(non-free-firmware)
if [[ "${apt_mirror_protocol,,}" == "https" ]]; then
var_url="https://${var_hostname}${var_dir}"
@@ -82,11 +82,11 @@ generate_sources() {
#------------------------------------------------------------------------------------------------------------------------------#
deb ${var_url} ${var_codename} ${ary_components[*]}
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
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
### Security Repository
@@ -95,10 +95,10 @@ EOF
deb ${var_surl} ${var_codename}-security ${ary_components[*]}
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
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
@@ -108,10 +108,10 @@ EOF
deb ${var_url} ${var_codename}-updates ${ary_components[*]}
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
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
@@ -121,10 +121,10 @@ EOF
deb ${var_url} ${var_codename}-backports ${ary_components[*]}
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
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
@@ -142,7 +142,7 @@ EOF
if [[ "${apt_updates_policy,,}" == "unattended" ]]; then
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
@@ -150,15 +150,15 @@ EOF
# shellcheck disable=SC2016
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
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
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
return 0

View File

@@ -24,32 +24,33 @@ guard_sourcing
minimal_toolset() {
declare var_bin
### Define HashMap: command -> package
# shellcheck disable=SC2154
declare -A hmp_tool_pkg=(
["awk"]="gawk"
["busybox"]="busybox"
["cat"]="coreutils"
["chmod"]="coreutils"
["chown"]="coreutils"
["chpasswd"]="passwd"
["chsh"]="passwd"
["cp"]="coreutils"
["cryptsetup"]="cryptsetup-initramfs"
["echo"]="coreutils"
["grep"]="grep"
["ip"]="iproute2"
["ln"]="coreutils"
["mkdir"]="coreutils"
["ping"]="iputils-ping"
["sed"]="sed"
["sudo"]="sudo"
["update-initramfs"]="initramfs-tools"
["zsh"]="zsh"
[awk]="gawk"
[busybox]="busybox"
[cat]="coreutils"
[chmod]="coreutils"
[chown]="coreutils"
[chpasswd]="passwd"
[chsh]="passwd"
[cp]="coreutils"
[cryptsetup]="cryptsetup-initramfs"
[echo]="coreutils"
[grep]="grep"
[ip]="iproute2"
[ln]="coreutils"
[mkdir]="coreutils"
[ping]="iputils-ping"
[sed]="sed"
[sudo]="sudo"
[update-initramfs]="initramfs-tools"
[zsh]="zsh"
)
for var_bin in "${!hmp_tool_pkg[@]}"; do
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_log "debug" "true" "Tool '${var_bin}' missing, installing '${hmp_tool_pkg[${var_bin}]}'."
fi
done

View File

@@ -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:
echo 'set clipboard=unnamed' >| "${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
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -43,7 +43,7 @@ setup_locales() {
### Set the keyboard layout for the system (for consoles)
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)
do_in_target "${TARGET}" localectl set-x11-keymap "${locale_keyboard_xkb_keymap}"

View File

@@ -99,23 +99,23 @@ setup_network() {
var_auto_fqdn=""
fi
do_log "info" "false" "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" "false" "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" "false" "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" "false" "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" "false" "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" "false" "Live environment network check: Auto FQDN ='${var_auto_fqdn}'."
do_log "info" "file_only" "Live environment network check: Auto NIC ='${var_auto_nic}'."
do_log "info" "file_only" "Live environment network check: Auto IPv4 ='${var_auto_ipv4}'."
do_log "info" "file_only" "Live environment network check: Auto IPv4 CCIDR ='${var_auto_ipv4_ccidr}'."
do_log "info" "file_only" "Live environment network check: Auto IPv4 Subnet ='${var_auto_ipv4_subnet}'."
do_log "info" "file_only" "Live environment network check: Auto IPv4 Gateway ='${var_auto_ipv4_gw}'."
do_log "info" "file_only" "Live environment network check: Auto IPv6 ='${var_auto_ipv6}'."
do_log "info" "file_only" "Live environment network check: Auto IPv6 CCIDR ='${var_auto_ipv6_ccidr}'."
do_log "info" "file_only" "Live environment network check: Auto IPv6 Gateway ='${var_auto_ipv6_gw}'."
do_log "info" "file_only" "Live environment network check: Auto IPv4 Link ='${var_link_ipv4}'."
do_log "info" "file_only" "Live environment network check: Auto IPv6 Link ='${var_link_ipv6}'."
do_log "info" "file_only" "Live environment network check: Auto FQDN ='${var_auto_fqdn}'."
### Create network configuration file header.
if [[ -f "${TARGET}/etc/network/interfaces" ]]; then
mkdir -p "${DIR_BAK}/etc/network"
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
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
EOF
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.
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
EOF
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
@@ -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
EOF
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
@@ -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
EOF
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
@@ -252,7 +252,7 @@ iface ${var_auto_nic} inet6 dhcp
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
EOF
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
@@ -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
EOF
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
if [[ -f "${TARGET}/etc/resolv.conf" ]]; then
mkdir -p "${DIR_BAK}/etc"
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
touch "${TARGET}/etc/resolv.conf"
@@ -315,7 +315,7 @@ EOF
done
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
@@ -331,7 +331,7 @@ EOF
done
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
@@ -343,7 +343,7 @@ EOF
if [[ -f "${TARGET}/etc/dhcp/dhclient.conf" ]]; then
mkdir -p "${DIR_BAK}/etc/dhcp"
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
if [[ "${network_autoconfig_enable,,}" == "true" && -n "${network_static_ipv4nameserver_0}" ]]; then
@@ -356,7 +356,7 @@ EOF
var_supersede="${var_supersede%, }"
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
@@ -366,7 +366,7 @@ EOF
var_supersede_ipv6="${var_supersede_ipv6%, }"
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

View File

@@ -32,14 +32,14 @@ setup_hostname() {
${VAR_FINAL_FQDN}
EOF
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.
cat << EOF >| "${TARGET}/etc/mailname"
${VAR_FINAL_FQDN}
EOF
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
cat << EOF >| "${TARGET}/etc/hosts"
@@ -48,7 +48,7 @@ ${VAR_FINAL_IPV4} ${VAR_FINAL_FQDN}
EOF
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
if [[ "${VAR_LINK_IPV6,,}" == "true" || "${network_ipv6,,}" == "true" ]]; then
@@ -65,7 +65,7 @@ ${VAR_FINAL_IPV6} ${VAR_FINAL_FQDN}
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

View File

@@ -33,6 +33,8 @@ setup_machineid() {
fi
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
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -52,7 +52,7 @@ setup_grub() {
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 ;;
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
else
@@ -70,7 +70,7 @@ setup_grub() {
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 ;;
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
else
@@ -103,7 +103,7 @@ setup_grub() {
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}"
fi
@@ -176,7 +176,7 @@ EOF
else
do_log "info" "true" "GRUB2 setup skipped."
do_log "info" "file_only" "GRUB2 setup skipped."
fi
@@ -233,7 +233,7 @@ get_all_boot_devs() {
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
@@ -259,7 +259,7 @@ install_grub_bios_all() {
case "${VAR_RECIPE_TABLE,,}" in
gpt) partmod="part_gpt" ;;
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
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
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"
done
@@ -294,7 +294,7 @@ install_grub_uefi_all() {
case "${VAR_RECIPE_TABLE,,}" in
gpt) partmod="part_gpt" ;;
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
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
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"
done

View File

@@ -12,13 +12,6 @@
guard_sourcing
#######################################
# Append GRUB superuser block to 40_custom.
# Arguments:
# 1: Username
# 2: Password
#######################################
#######################################
# Append GRUB superuser block to '/etc/grub.d/40_custom'.
# Globals:

View File

@@ -34,12 +34,12 @@ setup_grub_bootparameter() {
for var_param in "${ARY_BOOTPARAM[@]}"; do
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
fi
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
fi
@@ -56,7 +56,7 @@ setup_grub_bootparameter() {
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
}

View File

@@ -38,7 +38,7 @@ setup_kernel_modules() {
jitterentropy_rng
EOF
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
}
@@ -55,7 +55,7 @@ EOF
setup_modprobe() {
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"
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
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -25,7 +25,7 @@ guard_sourcing
setup_kernel_sysctl() {
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"
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
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -36,7 +36,7 @@ installation_microcode() {
case "${var_cpu_vendor}" in
*AuthenticAMD*) var_microcode_pkgs="amd64-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
###########################################################################################
@@ -50,7 +50,7 @@ installation_microcode() {
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

View File

@@ -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/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.
for ((i = 0; i <= VAR_USER_MAX; i++)); do

View File

@@ -54,7 +54,7 @@ build_dropbear() {
# shellcheck disable=2312
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
}

View File

@@ -210,7 +210,7 @@ DROPBEAR_OPTIONS="-b /etc/dropbear/banner -c /usr/local/bin/unlock_wrapper.sh -E
#DROPBEAR_SHUTDOWN_TIMEOUT=60
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
}

View File

@@ -54,7 +54,7 @@ setup_accounts() {
if [[ -x "${TARGET}${user_root_shell}" ]]; then
do_in_target "${TARGET}" chsh -s "${user_root_shell}" root
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
var_chpasswd="root:${user_root_password}"
@@ -84,7 +84,7 @@ setup_accounts() {
echo 'set clipboard=unnamed' >| "${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.
for ((i = 0; i <= VAR_USER_MAX; i++)); do
@@ -155,7 +155,7 @@ setup_accounts() {
printf "%s\n" "${var_sshpubkey}" >> "${var_sshdir}/authorized_keys"
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

View File

@@ -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"
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}"
unset var_of

View File

@@ -23,13 +23,13 @@ guard_sourcing
#######################################
exiting_chroot() {
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"
do_log "info" "true" "'umount -lf ${TARGET}/sys'."
do_log "info" "file_only" "'umount -lf ${TARGET}/sys'."
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"
do_log "info" "true" "'umount -lf ${TARGET}/run'."
do_log "info" "file_only" "'umount -lf ${TARGET}/run'."
return 0
}