remove presets, configure is done in KERNEL is set in *.conf

This commit is contained in:
Tobias Powalowski 2023-09-03 14:22:59 +02:00
parent 4273ee79de
commit db6267e3a4
25 changed files with 69 additions and 147 deletions

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/boot/Image.gz"
HOOKS=(archboot_common_modules archboot_block_modules archboot_init)

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/boot/Image.gz"
HOOKS=(archboot_common_modules archboot_kms archboot_base_common \
archboot_base_latest archboot_installer_common archboot_net_common \

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/boot/Image.gz"
HOOKS=(archboot_common_modules archboot_kms archboot_base_common \
archboot_base_latest archboot_installer_common archboot_kexec archboot_licenses \

View file

@ -2,8 +2,9 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/boot/Image.gz"
HOOKS=(archboot_cache archboot_cache_cleanup archboot_firmware archboot_firmware_cleanup \
archboot_common_modules archboot_block_modules archboot_kms archboot_base_common \

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/boot/Image.gz"
HOOKS=(archboot_firmware archboot_common_modules archboot_kms archboot_block_modules \
archboot_base_common archboot_base archboot_installer_common archboot_installer \

View file

@ -1,9 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/aarch64.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/boot/Image.gz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,9 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/aarch64-init.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/boot/Image.gz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,9 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/aarch64-latest.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/boot/Image.gz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,9 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/aarch64-local.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/boot/Image.gz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,9 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/riscv64.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/usr/lib/modules/*/vmlinuz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,9 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/riscv64-init.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/usr/lib/modules/*/vmlinuz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,8 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/x86_64.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/usr/lib/modules/*/vmlinuz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,8 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/x86_64-init.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/usr/lib/modules/*/vmlinuz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,8 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/x86_64-latest.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/usr/lib/modules/*/vmlinuz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -1,8 +0,0 @@
# Created by Tobias Powalowski <tpowa@archlinux.org>
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/x86_64-local.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/usr/lib/modules/*/vmlinuz"
# vim: set ft=sh ts=4 sw=4 et:

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/usr/lib/modules/*/vmlinuz"
HOOKS=(archboot_common_modules archboot_block_modules archboot_init)

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/usr/lib/modules/*/vmlinuz"
HOOKS=(archboot_firmware archboot_common_modules archboot_kms archboot_block_modules \
archboot_base_common archboot_base archboot_installer_common archboot_installer \

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/usr/lib/modules/*/vmlinuz"
HOOKS=(archboot_common_modules archboot_block_modules archboot_init)

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/usr/lib/modules/*/vmlinuz"
HOOKS=(archboot_common_modules archboot_kms archboot_base_common \
archboot_base_latest archboot_installer_common archboot_net_common archboot_remote \

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/usr/lib/modules/*/vmlinuz"
HOOKS=(archboot_common_modules archboot_kms archboot_base_common \
archboot_base_latest archboot_installer_common archboot_kexec \

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/usr/lib/modules/*/vmlinuz"
HOOKS=(archboot_cache archboot_cache_cleanup archboot_firmware archboot_firmware_cleanup \
archboot_common_modules archboot_block_modules archboot_kms archboot_base_common \

View file

@ -2,8 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SETUP archboot-cpio.sh parameters, other mkinitcpio parameters are not supported!
#
# Please change the hooks only if you know what you are doing.
# Kernel is defined in this config file
KERNEL="/usr/lib/modules/*/vmlinuz"
HOOKS=(archboot_firmware archboot_common_modules archboot_block_modules archboot_kms \
archboot_base_common archboot_base archboot_installer_common archboot_installer \

View file

@ -152,7 +152,7 @@ while :; do
;;
-k|--kernel)
shift
_KERNEL="$1"
KERNEL="$1"
;;
-d|--generatedir)
shift
@ -184,28 +184,24 @@ fi
# use in mkinitcpio. Avoids issues like FS#26344.
[[ -e /proc/self/mountinfo ]] || die "/proc must be mounted!"
[[ -e /dev/fd ]] || die "/dev must be mounted!"
if [[ -z "${_KERNEL}" ]]; then
msg "Autodetecting kernel from: /etc/archboot/presets/${_RUNNING_ARCH}"
. /etc/archboot/presets/${_RUNNING_ARCH}
# allow * in config
ALL_kver="$(echo ${ALL_kver})"
if [[ ! -f "${ALL_kver}" ]]; then
die "specified kernel image does not exist!"
fi
_KERNELVERSION="$(_kver ${ALL_kver})"
! . "$_f_config" 2>"${_NO_LOG}" && die "Failed to read configuration '%s'" "$_f_config"
if [[ -z "${KERNEL}" ]]; then
msg "Autodetecting kernel from ${_RUNNING_ARCH}"
[[ "${_RUNNING_ARCH}" == "x86_64" || "${_RUNNING_ARCH}" == "riscv64" ]] && KERNEL="/usr/lib/modules/*/vmlinuz"
[[ "${_RUNNING_ARCH}" == "aarch64" ]] && KERNEL="/boot/Image.gz"
# allow * in config
KERNEL="$(echo ${KERNEL})"
else
msg "Using specified kernel: ${_KERNEL}"
if [[ ! -f "${_KERNEL}" ]]; then
die "specified kernel image does not exist!"
fi
_KERNELVERSION="$(_kver ${_KERNEL})"
msg "Using specified kernel: ${KERNEL}"
fi
if [[ ! -f "${KERNEL}" ]]; then
die "specified kernel image does not exist!"
fi
_KERNELVERSION="$(_kver ${KERNEL})"
_d_kmoduledir="/lib/modules/${_KERNELVERSION}"
[[ -d "$_d_kmoduledir" ]] || die "'$_d_kmoduledir' is not a valid kernel module directory"
_d_workdir="$(initialize_buildroot "${_KERNELVERSION}" "$_opttargetdir")" || exit 1
BUILDROOT="${_opttargetdir:-$_d_workdir/root}"
# shellcheck source=mkinitcpio.conf
! . "$_f_config" 2>"${_NO_LOG}" && die "Failed to read configuration '%s'" "$_f_config"
_hooks=("${HOOKS[@]}")
if (( ${#_hooks[*]} == 0 )); then
die "Invalid config: No hooks found"

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
. /etc/archboot/defaults
_PRESET_DIR="/etc/archboot/presets"
_CONFIG_DIR="/etc/archboot"
_ISODIR="$(mktemp -d ISODIR.XXX)"
_usage () {
@ -11,9 +11,9 @@ _usage () {
echo "This will create an archboot iso image."
echo ""
echo " -g Starting generation of image."
echo " -p=PRESET Which preset should be used."
echo " /etc/archboot/presets locates the presets"
echo " default=${_ARCH}"
echo " -c=CONFIG Which CONFIG should be used."
echo " /etc/archboot/ locates the configs"
echo " default=${_ARCH}.conf"
echo " -i=IMAGENAME Your IMAGENAME."
echo " -s Save init ramdisk to $(pwd)"
echo " -h This message."
@ -38,13 +38,13 @@ _parameters() {
_config() {
# set defaults, if nothing given
[[ -z "${_PRESET}" ]] && _PRESET="${_ARCH}"
_PRESET="${_PRESET_DIR}/${_PRESET}"
[[ -z "${_CONFIG}" ]] && _CONFIG="${_ARCH}.conf"
_CONFIG="${_CONFIG_DIR}/${_CONFIG}"
#shellcheck disable=SC1090
source "${_PRESET}"
ALL_kver=$(echo ${ALL_kver})
. "${_CONFIG}"
KERNEL="$(echo ${KERNEL})"
#shellcheck disable=SC2154
[[ -z "${_IMAGENAME}" ]] && _IMAGENAME="archboot-$(date +%Y.%m.%d-%H.%M)-$(_kver "${ALL_kver}")-${_ARCH}"
[[ -z "${_IMAGENAME}" ]] && _IMAGENAME="archboot-$(date +%Y.%m.%d-%H.%M)-$(_kver "${KERNEL}")-${_ARCH}"
}
### EFI status of RISCV64:
@ -63,17 +63,17 @@ _prepare_kernel_initrd_files() {
# needed to hash the kernel for secureboot enabled systems
echo "Preparing kernel..."
if [[ "${_ARCH}" == "x86_64" || "${_ARCH}" == "riscv64" ]]; then
install -m644 "${ALL_kver}" "${_ISODIR}/boot/vmlinuz-${_ARCH}"
install -m644 "${KERNEL}" "${_ISODIR}/boot/vmlinuz-${_ARCH}"
fi
if [[ "${_ARCH}" == "aarch64" ]]; then
install -m644 "${ALL_kver}" "${_ISODIR}/boot/Image-${_ARCH}.gz"
install -m644 "${KERNEL}" "${_ISODIR}/boot/Image-${_ARCH}.gz"
fi
if [[ -f "./init-${_ARCH}.img" ]]; then
echo "Using existing init-${_ARCH}.img..."
cp "./init-${_ARCH}.img" "${_ISODIR}/boot/"
else
echo "Running archboot-cpio.sh for init-${_ARCH}.img..."
archboot-cpio.sh -c "/etc/archboot/${_ARCH}-init.conf" -k "${ALL_kver}" -g "${_ISODIR}/boot/init-${_ARCH}.img" || exit 1
archboot-cpio.sh -c "/etc/archboot/${_ARCH}-init.conf" -k "${KERNEL}" -g "${_ISODIR}/boot/init-${_ARCH}.img" || exit 1
# save init ramdisk for further images
if [[ -n "${_SAVE_INIT}" ]]; then
cp "${_ISODIR}/boot/init-${_ARCH}.img" ./
@ -82,7 +82,7 @@ _prepare_kernel_initrd_files() {
fi
echo "Running archboot-cpio.sh for initrd-${_ARCH}.img..."
#shellcheck disable=SC2154
archboot-cpio.sh -c "${MKINITCPIO_CONFIG}" -k "${ALL_kver}" -g "${_ISODIR}/boot/initrd-${_ARCH}.img" || exit 1
archboot-cpio.sh -c "${MKINITCPIO_CONFIG}" -k "${KERNEL}" -g "${_ISODIR}/boot/initrd-${_ARCH}.img" || exit 1
# delete cachedir on archboot environment
if grep -qw 'archboot' /etc/hostname; then
if [[ -d "${_CACHEDIR}" ]]; then

View file

@ -14,8 +14,8 @@ else
_KERNEL="boot/vmlinuz-${_ARCH}"
_KERNEL_ARCHBOOT="boot/vmlinuz-${_ARCH}"
fi
_PRESET_LATEST="${_ARCH}-latest"
_PRESET_LOCAL="${_ARCH}-local"
_PRESET_LATEST="${_ARCH}-latest.conf"
_PRESET_LOCAL="${_ARCH}-local.conf"
_W_DIR="$(mktemp -u archboot-release.XXX)"
_usage () {
@ -34,8 +34,8 @@ _create_iso() {
# create container
archboot-"${_ARCH}"-create-container.sh "${_W_DIR}" -cc --install-source="${2}" || exit 1
_create_archboot_db "${_W_DIR}${_CACHEDIR}"
. ${_W_DIR}/etc/archboot/presets/${_ARCH}
_KERNEL_VERSION="$(${_NSPAWN} "${_W_DIR}" /bin/bash -c "ALL_kver="$(echo ${ALL_kver})";. /usr/lib/archboot/common.sh; _kver ${ALL_kver}")"
. ${_W_DIR}/etc/archboot/${_ARCH}.conf
_KERNEL_VERSION="$(${_NSPAWN} "${_W_DIR}" /bin/bash -c "KERNEL="$(echo ${KERNEL})";. /usr/lib/archboot/common.sh; _kver ${KERNEL}")"
_ISONAME="archboot-$(date +%Y.%m.%d-%H.%M)-${_KERNEL_VERSION}"
# riscv64 does not support kexec at the moment
if ! [[ "${_ARCH}" == "riscv64" ]]; then
@ -51,18 +51,18 @@ _create_iso() {
# wget -q "https://archboot.com/src/grub/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst.sig" -P "${_W_DIR}/var/cache/pacman/pkg"
#fi
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*;archboot-${_ARCH}-iso.sh -g -s \
-p=${_PRESET_LOCAL} -i=${_ISONAME}-local-${_ARCH}" || exit 1
-c=${_CONFIG_LOCAL} -i=${_ISONAME}-local-${_ARCH}" || exit 1
echo "Generating latest ISO..."
# generate latest iso in container
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*;archboot-${_ARCH}-iso.sh -g \
-p=${_PRESET_LATEST} -i=${_ISONAME}-latest-${_ARCH}" || exit 1
-c=${_CONFIG_LATEST} -i=${_ISONAME}-latest-${_ARCH}" || exit 1
echo "Installing lvm2 to container ${_W_DIR}..."
${_NSPAWN} "${_W_DIR}" pacman -Sy lvm2 --noconfirm &>"${_NO_LOG}"
fi
echo "Generating normal ISO..."
# generate iso in container
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;archboot-${_ARCH}-iso.sh -g -s \
-i=${_ISONAME}-${_ARCH}" || exit 1
-i=${_ISONAME}-${_ARCH}" || exit 1
# move iso out of container
mv "${_W_DIR}"/*.iso ./ &>"${_NO_LOG}"
mv "${_W_DIR}"/*.img ./ &>"${_NO_LOG}"