V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m0s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m0s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
99
func/cdi_5000_recovery/5121_installation_initramfs.sh
Normal file
99
func/cdi_5000_recovery/5121_installation_initramfs.sh
Normal file
@@ -0,0 +1,99 @@
|
||||
#!/bin/bash
|
||||
# SPDX-Version: 3.0
|
||||
# SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.installer.git
|
||||
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
||||
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-FileType: SOURCE
|
||||
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
|
||||
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
|
||||
# SPDX-PackageName: CISS.debian.installer
|
||||
# SPDX-Security-Contact: security@coresecret.eu
|
||||
|
||||
guard_sourcing
|
||||
|
||||
#######################################
|
||||
# Installation of 'initramfs'-environment.
|
||||
# Every 'apt-get install' command is invoked by adding 'export INITRD=No'
|
||||
# to suppress the 'update-initramfs'-Kernel-Hooks, according to the initramfs-tools manpage:
|
||||
# https://manpages.debian.org/testing/initramfs-tools-core/initramfs-tools.7.en.html
|
||||
# Globals:
|
||||
# RECOVERY
|
||||
# VAR_ROOT_FS
|
||||
# VAR_SETUP_PATH
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# 0: on success
|
||||
#######################################
|
||||
installation_initramfs_reco() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
declare var_modules="" var_whereiam=""
|
||||
|
||||
# shellcheck disable=SC2312
|
||||
if [[ -x "$(command -v virt-what)" ]]; then
|
||||
var_whereiam=$(virt-what | head -n1)
|
||||
else
|
||||
var_whereiam=$(grep -iE 'kvm|vmware|qemu' /sys/class/dmi/id/product_name 2>/dev/null || echo "baremetal")
|
||||
fi
|
||||
|
||||
mkdir -p "${RECOVERY}/etc/initramfs-tools/files"
|
||||
|
||||
### Install the script that will be called by 'update-initramfs' to install the necessary modules for the initramfs environment.
|
||||
install -D -m 0644 -o root -g root "${VAR_SETUP_PATH}/includes/target/etc/initramfs-tools/modules" \
|
||||
"${RECOVERY}/etc/initramfs-tools/"
|
||||
|
||||
insert_comments "${RECOVERY}/etc/initramfs-tools/modules"
|
||||
|
||||
var_modules=$(grep_nic_driver_modules)
|
||||
|
||||
cat << EOF >> "${RECOVERY}/etc/initramfs-tools/modules"
|
||||
### Custom NIC driver:
|
||||
${var_modules}
|
||||
|
||||
EOF
|
||||
|
||||
if [[ "${var_whereiam}" =~ ^(kvm|vmware|qemu)$ ]]; then
|
||||
|
||||
cat << EOF >> "${RECOVERY}/etc/initramfs-tools/modules"
|
||||
### QEMU Bochs-compatible virtual machine support:
|
||||
bochs
|
||||
|
||||
### Virtio support:
|
||||
virtio_pci
|
||||
virtio_blk
|
||||
virtio_scsi
|
||||
virtio_console
|
||||
virtio_rng
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
printf "%s\n" '# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=conf' >> "${RECOVERY}/etc/initramfs-tools/modules"
|
||||
|
||||
### MODULES: [ most | netboot | dep | list ]
|
||||
## 'most' - Add most filesystem and all hard-drive drivers.
|
||||
## 'dep' - Try and guess the modules to load.
|
||||
|
||||
insert_header "${RECOVERY}/etc/initramfs-tools/conf.d/driver-policy"
|
||||
insert_comments "${RECOVERY}/etc/initramfs-tools/conf.d/driver-policy"
|
||||
cat << EOF >> "${RECOVERY}/etc/initramfs-tools/conf.d/driver-policy"
|
||||
# Driver inclusion policy selected during installation.
|
||||
# Note: This setting overrides the value set in the file '/etc/initramfs-tools/initramfs.conf'.
|
||||
|
||||
MODULES=dep
|
||||
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
EOF
|
||||
|
||||
insert_header "${RECOVERY}/etc/initramfs-tools/conf.d/fsroot"
|
||||
insert_comments "${RECOVERY}/etc/initramfs-tools/conf.d/fsroot"
|
||||
cat << EOF >> "${RECOVERY}/etc/initramfs-tools/conf.d/fsroot"
|
||||
FSTYPE=${VAR_ROOT_FS}
|
||||
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
EOF
|
||||
|
||||
guard_dir && return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
Reference in New Issue
Block a user