rename parameters

This commit is contained in:
Tobias Powalowski 2023-01-08 08:48:05 +01:00
parent 75a59edd13
commit 277eec8e18
7 changed files with 60 additions and 59 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DESTDIR="${1}" _DESTDIR="${1}"
. /usr/lib/archboot/installer/common.sh . /usr/lib/archboot/installer/common.sh
usage() { usage() {
@ -11,7 +11,7 @@ usage() {
echo "This script is for users who would rather partition/mkfs/mount their target" echo "This script is for users who would rather partition/mkfs/mount their target"
echo "media manually than go through the routines in the setup script." echo "media manually than go through the routines in the setup script."
echo echo
if ! [[ -e "${LOCAL_DB}" ]]; then if ! [[ -e "${_LOCAL_DB}" ]]; then
echo -e "First configure \033[1m/etc/pacman.conf\033[0m which repositories to use" echo -e "First configure \033[1m/etc/pacman.conf\033[0m which repositories to use"
echo -e "and set a mirror in \033[1m/etc/pacman.d/mirrorlist\033[0m" echo -e "and set a mirror in \033[1m/etc/pacman.d/mirrorlist\033[0m"
fi fi
@ -31,11 +31,11 @@ usage() {
# returns: 1 on error # returns: 1 on error
prepare_pacman() { prepare_pacman() {
# Set up the necessary directories for pacman use # Set up the necessary directories for pacman use
if [[ ! -d "${DESTDIR}/var/cache/pacman/pkg" ]]; then if [[ ! -d "${_DESTDIR}/var/cache/pacman/pkg" ]]; then
mkdir -p "${DESTDIR}/var/cache/pacman/pkg" mkdir -p "${_DESTDIR}/var/cache/pacman/pkg"
fi fi
if [[ ! -d "${DESTDIR}/var/lib/pacman" ]]; then if [[ ! -d "${_DESTDIR}/var/lib/pacman" ]]; then
mkdir -p "${DESTDIR}/var/lib/pacman" mkdir -p "${_DESTDIR}/var/lib/pacman"
fi fi
# pacman-key process itself # pacman-key process itself
while pgrep -x pacman-key > /dev/null 2>&1; do while pgrep -x pacman-key > /dev/null 2>&1; do
@ -47,21 +47,21 @@ prepare_pacman() {
done done
[[ -e /etc/systemd/system/pacman-init.service ]] && systemctl stop pacman-init.service [[ -e /etc/systemd/system/pacman-init.service ]] && systemctl stop pacman-init.service
${PACMAN} -Sy ${PACMAN} -Sy
KEYRING="archlinux-keyring" _KEYRING="archlinux-keyring"
[[ "$(uname -m)" == "aarch64" ]] && KEYRING="${KEYRING} archlinuxarm-keyring" [[ "$(uname -m)" == "aarch64" ]] && _KEYRING="${_KEYRING} archlinuxarm-keyring"
#shellcheck disable=SC2086 #shellcheck disable=SC2086
pacman -Sy ${PACMAN_CONF} --noconfirm --noprogressbar ${KEYRING} || exit 1 pacman -Sy ${PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING} || exit 1
} }
# package_installation # package_installation
install_packages() { install_packages() {
# add packages from archboot defaults # add packages from archboot defaults
PACKAGES=$(grep '^_PACKAGES' /etc/archboot/defaults | sed -e 's#_PACKAGES=##g' -e 's#"##g') _PACKAGES=$(grep '^_PACKAGES' /etc/archboot/defaults | sed -e 's#_PACKAGES=##g' -e 's#"##g')
# fallback if _PACKAGES is empty # fallback if _PACKAGES is empty
[[ -z "${PACKAGES}" ]] && PACKAGES="base linux linux-firmware" [[ -z "${_PACKAGES}" ]] && _PACKAGES="base linux linux-firmware"
auto_packages auto_packages
#shellcheck disable=SC2086 #shellcheck disable=SC2086
${PACMAN} -S ${PACKAGES} ${PACMAN} -S ${_PACKAGES}
} }
# start script # start script
@ -71,7 +71,7 @@ fi
! [[ -d /tmp ]] && mkdir /tmp ! [[ -d /tmp ]] && mkdir /tmp
if [[ -e "${LOCAL_DB}" ]]; then if [[ -e "${_LOCAL_DB}" ]]; then
local_pacman_conf local_pacman_conf
else else
PACMAN_CONF="" PACMAN_CONF=""
@ -94,18 +94,18 @@ echo
echo -e "\033[1mPackage installation complete.\033[0m" echo -e "\033[1mPackage installation complete.\033[0m"
echo echo
echo -e "Please install a \033[1mbootloader\033[0m. Edit the appropriate config file for" echo -e "Please install a \033[1mbootloader\033[0m. Edit the appropriate config file for"
echo -e "your loader. Please use \033[1m${VMLINUZ}\033[0m as kernel image." echo -e "your loader. Please use \033[1m${_VMLINUZ}\033[0m as kernel image."
echo -e "Chroot into your system to install it:" echo -e "Chroot into your system to install it:"
echo -e " \033[1m# mount -o bind /dev ${DESTDIR}/dev\033[0m" echo -e " \033[1m# mount -o bind /dev ${_DESTDIR}/dev\033[0m"
echo -e " \033[1m# mount -t proc none ${DESTDIR}/proc\033[0m" echo -e " \033[1m# mount -t proc none ${_DESTDIR}/proc\033[0m"
echo -e " \033[1m# mount -t sysfs none ${DESTDIR}/sys\033[0m" echo -e " \033[1m# mount -t sysfs none ${_DESTDIR}/sys\033[0m"
echo -e " \033[1m# chroot ${DESTDIR} /bin/bash\033[0m" echo -e " \033[1m# chroot ${_DESTDIR} /bin/bash\033[0m"
echo echo
echo "Next step, initramfs setup:" echo "Next step, initramfs setup:"
echo -e "Edit your \033[1m/etc/mkinitcpio.conf\033[0m to fit your needs. After that run:" echo -e "Edit your \033[1m/etc/mkinitcpio.conf\033[0m to fit your needs. After that run:"
echo -e " \033[1m# mkinitcpio -p ${KERNELPKG}\033[0m" echo -e " \033[1m# mkinitcpio -p ${_KERNELPKG}\033[0m"
echo echo
echo -e "Then \033[1mexit\033[0m your chroot shell, edit \033[1m${DESTDIR}/etc/fstab\033[0m and \033[1mreboot\033[0m! " echo -e "Then \033[1mexit\033[0m your chroot shell, edit \033[1m${_DESTDIR}/etc/fstab\033[0m and \033[1mreboot\033[0m! "
exit 0 exit 0
# vim: set ts=4 sw=4 et: # vim: set ts=4 sw=4 et:

View file

@ -139,13 +139,13 @@ auto_mkinitcpio() {
fi fi
# get kernel version # get kernel version
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
offset=$(hexdump -s 526 -n 2 -e '"%0d"' "${_DESTDIR}/boot/${VMLINUZ}") offset=$(hexdump -s 526 -n 2 -e '"%0d"' "${_DESTDIR}/boot/${_VMLINUZ}")
read -r HWKVER _ < <(dd if="${_DESTDIR}/boot/${VMLINUZ}" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null) read -r HWKVER _ < <(dd if="${_DESTDIR}/boot/${_VMLINUZ}" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null)
elif [[ "${_RUNNING_ARCH}" == "aarch64" || "${_RUNNING_ARCH}" == "riscv64" ]]; then elif [[ "${_RUNNING_ARCH}" == "aarch64" || "${_RUNNING_ARCH}" == "riscv64" ]]; then
reader="cat" reader="cat"
# try if the image is gzip compressed # try if the image is gzip compressed
[[ $(file -b --mime-type "${_DESTDIR}/boot/${VMLINUZ}") == 'application/gzip' ]] && reader="zcat" [[ $(file -b --mime-type "${_DESTDIR}/boot/${_VMLINUZ}") == 'application/gzip' ]] && reader="zcat"
read -r _ _ HWKVER _ < <($reader "${_DESTDIR}/boot/${VMLINUZ}" | grep -m1 -aoE 'Linux version .(\.[-[:alnum:]]+)+') read -r _ _ HWKVER _ < <($reader "${_DESTDIR}/boot/${_VMLINUZ}" | grep -m1 -aoE 'Linux version .(\.[-[:alnum:]]+)+')
fi fi
# arrange MODULES for mkinitcpio.conf # arrange MODULES for mkinitcpio.conf
HWDETECTMODULES="$(hwdetect --kernel_directory="${_DESTDIR}" --kernel_version="${HWKVER}" --hostcontroller --filesystem ${FBPARAMETER})" HWDETECTMODULES="$(hwdetect --kernel_directory="${_DESTDIR}" --kernel_version="${HWKVER}" --hostcontroller --filesystem ${FBPARAMETER})"

View file

@ -20,6 +20,7 @@ _VC="VC${_VC_NUM}"
_S_SRC=0 # choose mirror _S_SRC=0 # choose mirror
_S_MKFS=0 # formatting _S_MKFS=0 # formatting
_S_MKFSAUTO=0 # auto fs part/formatting _S_MKFSAUTO=0 # auto fs part/formatting
_S_BOOTLOADER=0 # bootloader installation
# menu item tracker- autoselect the next item # menu item tracker- autoselect the next item
_NEXTITEM="" _NEXTITEM=""
# To allow choice in script set EDITOR="" # To allow choice in script set EDITOR=""

View file

@ -6,7 +6,7 @@ INTEL_UCODE="intel-ucode.img"
AMD_UCODE="amd-ucode.img" AMD_UCODE="amd-ucode.img"
ROOTFS="" ROOTFS=""
# name of the initramfs filesystem # name of the initramfs filesystem
INITRAMFS="initramfs-${KERNELPKG}.img" INITRAMFS="initramfs-${_KERNELPKG}.img"
getrootfstype() { getrootfstype() {
ROOTFS="$(getfstype "${PART_ROOT}")" ROOTFS="$(getfstype "${PART_ROOT}")"
@ -277,23 +277,23 @@ do_mok_sign () {
sleep 5 sleep 5
fi fi
SIGN_MOK="" SIGN_MOK=""
DIALOG --yesno "Do you want to sign with the MOK certificate?\n\n/boot/${VMLINUZ} and ${UEFI_BOOTLOADER_DIR}/grub${_SPEC_UEFI_ARCH}.efi" 7 55 && SIGN_MOK="1" DIALOG --yesno "Do you want to sign with the MOK certificate?\n\n/boot/${_VMLINUZ} and ${UEFI_BOOTLOADER_DIR}/grub${_SPEC_UEFI_ARCH}.efi" 7 55 && SIGN_MOK="1"
if [[ "${SIGN_MOK}" == "1" ]]; then if [[ "${SIGN_MOK}" == "1" ]]; then
if [[ "${_DESTDIR}" == "/install" ]]; then if [[ "${_DESTDIR}" == "/install" ]]; then
systemd-nspawn -q -D "${_DESTDIR}" sbsign --key /"${KEYDIR}"/MOK/MOK.key --cert /"${KEYDIR}"/MOK/MOK.crt --output /boot/"${VMLINUZ}" /boot/"${VMLINUZ}" > "${_LOG}" 2>&1 systemd-nspawn -q -D "${_DESTDIR}" sbsign --key /"${KEYDIR}"/MOK/MOK.key --cert /"${KEYDIR}"/MOK/MOK.crt --output /boot/"${_VMLINUZ}" /boot/"${_VMLINUZ}" > "${_LOG}" 2>&1
systemd-nspawn -q -D "${_DESTDIR}" sbsign --key /"${KEYDIR}"/MOK/MOK.key --cert /"${KEYDIR}"/MOK/MOK.crt --output "${UEFI_BOOTLOADER_DIR}"/grub"${_SPEC_UEFI_ARCH}".efi "${UEFI_BOOTLOADER_DIR}"/grub"${_SPEC_UEFI_ARCH}".efi > "${_LOG}" 2>&1 systemd-nspawn -q -D "${_DESTDIR}" sbsign --key /"${KEYDIR}"/MOK/MOK.key --cert /"${KEYDIR}"/MOK/MOK.crt --output "${UEFI_BOOTLOADER_DIR}"/grub"${_SPEC_UEFI_ARCH}".efi "${UEFI_BOOTLOADER_DIR}"/grub"${_SPEC_UEFI_ARCH}".efi > "${_LOG}" 2>&1
else else
sbsign --key /"${KEYDIR}"/MOK/MOK.key --cert /"${KEYDIR}"/MOK/MOK.crt --output /boot/"${VMLINUZ}" /boot/"${VMLINUZ}" > "${_LOG}" 2>&1 sbsign --key /"${KEYDIR}"/MOK/MOK.key --cert /"${KEYDIR}"/MOK/MOK.crt --output /boot/"${_VMLINUZ}" /boot/"${_VMLINUZ}" > "${_LOG}" 2>&1
sbsign --key /"${KEYDIR}"/MOK/MOK.key --cert /"${KEYDIR}"/MOK/MOK.crt --output "${UEFI_BOOTLOADER_DIR}"/grub"${_SPEC_UEFI_ARCH}".efi "${UEFI_BOOTLOADER_DIR}"/grub"${_SPEC_UEFI_ARCH}".efi > "${_LOG}" 2>&1 sbsign --key /"${KEYDIR}"/MOK/MOK.key --cert /"${KEYDIR}"/MOK/MOK.crt --output "${UEFI_BOOTLOADER_DIR}"/grub"${_SPEC_UEFI_ARCH}".efi "${UEFI_BOOTLOADER_DIR}"/grub"${_SPEC_UEFI_ARCH}".efi > "${_LOG}" 2>&1
fi fi
DIALOG --infobox "/boot/${VMLINUZ} and ${UEFI_BOOTLOADER_DIR}/grub${_SPEC_UEFI_ARCH}.efi\n\nbeen signed successfully.\n\nContinuing in 5 seconds ..." 7 60 DIALOG --infobox "/boot/${_VMLINUZ} and ${UEFI_BOOTLOADER_DIR}/grub${_SPEC_UEFI_ARCH}.efi\n\nbeen signed successfully.\n\nContinuing in 5 seconds ..." 7 60
sleep 5 sleep 5
fi fi
} }
do_pacman_sign() { do_pacman_sign() {
SIGN_KERNEL="" SIGN_KERNEL=""
DIALOG --yesno "Do you want to install a pacman hook\nfor automatic signing /boot/${VMLINUZ} on updates?" 6 60 && SIGN_KERNEL="1" DIALOG --yesno "Do you want to install a pacman hook\nfor automatic signing /boot/${_VMLINUZ} on updates?" 6 60 && SIGN_KERNEL="1"
if [[ "${SIGN_KERNEL}" == "1" ]]; then if [[ "${SIGN_KERNEL}" == "1" ]]; then
[[ ! -d "${_DESTDIR}/etc/pacman.d/hooks" ]] && mkdir -p "${_DESTDIR}"/etc/pacman.d/hooks/ [[ ! -d "${_DESTDIR}/etc/pacman.d/hooks" ]] && mkdir -p "${_DESTDIR}"/etc/pacman.d/hooks/
HOOKNAME="${_DESTDIR}/etc/pacman.d/hooks/999-sign_kernel_for_secureboot.hook" HOOKNAME="${_DESTDIR}/etc/pacman.d/hooks/999-sign_kernel_for_secureboot.hook"
@ -328,9 +328,9 @@ do_efistub_parameters() {
UEFISYS_PART_FS_UUID="$(getfsuuid "${_uefisysdev}")" UEFISYS_PART_FS_UUID="$(getfsuuid "${_uefisysdev}")"
if [[ "${UEFISYS_MP}" == "/boot" ]]; then if [[ "${UEFISYS_MP}" == "/boot" ]]; then
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
_KERNEL="${VMLINUZ_EFISTUB}" _KERNEL="${_VMLINUZ_EFISTUB}"
else else
_KERNEL="${VMLINUZ}" _KERNEL="${_VMLINUZ}"
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
_INITRD_INTEL_UCODE="${INTEL_UCODE}" _INITRD_INTEL_UCODE="${INTEL_UCODE}"
fi fi
@ -342,9 +342,9 @@ do_efistub_parameters() {
else else
# name .efi for uefisys partition # name .efi for uefisys partition
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
_KERNEL="${UEFISYS_PATH}/${VMLINUZ_EFISTUB}" _KERNEL="${UEFISYS_PATH}/${_VMLINUZ_EFISTUB}"
else else
_KERNEL="${UEFISYS_PATH}/${VMLINUZ}" _KERNEL="${UEFISYS_PATH}/${_VMLINUZ}"
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
_INITRD_INTEL_UCODE="${UEFISYS_PATH}/${INTEL_UCODE}" _INITRD_INTEL_UCODE="${UEFISYS_PATH}/${INTEL_UCODE}"
fi fi
@ -362,7 +362,7 @@ do_efistub_copy_to_efisys() {
DIALOG --infobox "Copying kernel, ucode and initramfs to EFI system partition now ..." 4 50 DIALOG --infobox "Copying kernel, ucode and initramfs to EFI system partition now ..." 4 50
! [[ -d "${_DESTDIR}/${UEFISYS_MP}/${UEFISYS_PATH}" ]] && mkdir -p "${_DESTDIR}/${UEFISYS_MP}/${UEFISYS_PATH}" ! [[ -d "${_DESTDIR}/${UEFISYS_MP}/${UEFISYS_PATH}" ]] && mkdir -p "${_DESTDIR}/${UEFISYS_MP}/${UEFISYS_PATH}"
rm -f "${_DESTDIR}/${UEFISYS_MP}/${_KERNEL}" rm -f "${_DESTDIR}/${UEFISYS_MP}/${_KERNEL}"
cp -f "${_DESTDIR}/boot/${VMLINUZ}" "${_DESTDIR}/${UEFISYS_MP}/${_KERNEL}" cp -f "${_DESTDIR}/boot/${_VMLINUZ}" "${_DESTDIR}/${UEFISYS_MP}/${_KERNEL}"
rm -f "${_DESTDIR}/${UEFISYS_MP}/${_INITRD}" rm -f "${_DESTDIR}/${UEFISYS_MP}/${_INITRD}"
cp -f "${_DESTDIR}/boot/${INITRAMFS}" "${_DESTDIR}/${UEFISYS_MP}/${_INITRD}" cp -f "${_DESTDIR}/boot/${INITRAMFS}" "${_DESTDIR}/${UEFISYS_MP}/${_INITRD}"
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
@ -379,7 +379,7 @@ do_efistub_copy_to_efisys() {
[Unit] [Unit]
Description=Copy EFISTUB Kernel and Initramfs files to EFI SYSTEM PARTITION Description=Copy EFISTUB Kernel and Initramfs files to EFI SYSTEM PARTITION
[Path] [Path]
PathChanged=/boot/${VMLINUZ} PathChanged=/boot/${_VMLINUZ}
PathChanged=/boot/${INITRAMFS} PathChanged=/boot/${INITRAMFS}
CONFEOF CONFEOF
[[ "${_RUNNING_ARCH}" == "aarch64" || "${_RUNNING_ARCH}" == "x86_64" ]] && \ [[ "${_RUNNING_ARCH}" == "aarch64" || "${_RUNNING_ARCH}" == "x86_64" ]] && \
@ -396,7 +396,7 @@ CONFEOF
Description=Copy EFISTUB Kernel and Initramfs files to EFI SYSTEM PARTITION Description=Copy EFISTUB Kernel and Initramfs files to EFI SYSTEM PARTITION
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/usr/bin/cp -f /boot/${VMLINUZ} ${UEFISYS_MP}/${_KERNEL} ExecStart=/usr/bin/cp -f /boot/${_VMLINUZ} ${UEFISYS_MP}/${_KERNEL}
ExecStart=/usr/bin/cp -f /boot/${INITRAMFS} ${UEFISYS_MP}/${_INITRD} ExecStart=/usr/bin/cp -f /boot/${INITRAMFS} ${UEFISYS_MP}/${_INITRD}
CONFEOF CONFEOF
[[ "${_RUNNING_ARCH}" == "aarch64" || "${_RUNNING_ARCH}" == "x86_64" ]] && \ [[ "${_RUNNING_ARCH}" == "aarch64" || "${_RUNNING_ARCH}" == "x86_64" ]] && \
@ -661,9 +661,9 @@ EOF
fi fi
fi fi
if [[ "${GRUB_UEFI}" == "1" ]]; then if [[ "${GRUB_UEFI}" == "1" ]]; then
LINUX_UNMOD_COMMAND="linux ${subdir}/${VMLINUZ} ${_KERNEL_PARAMS_MOD}" LINUX_UNMOD_COMMAND="linux ${subdir}/${_VMLINUZ} ${_KERNEL_PARAMS_MOD}"
else else
LINUX_UNMOD_COMMAND="linux ${subdir}/${VMLINUZ} ${_KERNEL_PARAMS_MOD}" LINUX_UNMOD_COMMAND="linux ${subdir}/${_VMLINUZ} ${_KERNEL_PARAMS_MOD}"
fi fi
LINUX_MOD_COMMAND=$(echo "${LINUX_UNMOD_COMMAND}" | sed -e 's# # #g' | sed -e 's# # #g') LINUX_MOD_COMMAND=$(echo "${LINUX_UNMOD_COMMAND}" | sed -e 's# # #g' | sed -e 's# # #g')
## create default kernel entry ## create default kernel entry
@ -758,7 +758,7 @@ timeout 100
default linux default linux
label linux label linux
menu label Boot System (automatic boot in 10 seconds ...) menu label Boot System (automatic boot in 10 seconds ...)
kernel ${subdir}/${VMLINUZ} kernel ${subdir}/${_VMLINUZ}
initrd ${subdir}/${INITRAMFS} initrd ${subdir}/${INITRAMFS}
append ${_KERNEL_PARAMS_COMMON_MOD} append ${_KERNEL_PARAMS_COMMON_MOD}
EOF EOF

View file

@ -4,13 +4,13 @@
LANG=C.UTF8 LANG=C.UTF8
_LOCAL_DB="/var/cache/pacman/pkg/archboot.db" _LOCAL_DB="/var/cache/pacman/pkg/archboot.db"
_RUNNING_ARCH="$(uname -m)" _RUNNING_ARCH="$(uname -m)"
KERNELPKG="linux" _KERNELPKG="linux"
# name of the kernel image # name of the kernel image
[[ "${_RUNNING_ARCH}" == "x86_64" || "${_RUNNING_ARCH}" == "riscv64" ]] && VMLINUZ="vmlinuz-${KERNELPKG}" [[ "${_RUNNING_ARCH}" == "x86_64" || "${_RUNNING_ARCH}" == "riscv64" ]] && _VMLINUZ="vmlinuz-${_KERNELPKG}"
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
VMLINUZ="Image.gz" _VMLINUZ="Image.gz"
#shellcheck disable=SC2034 #shellcheck disable=SC2034
VMLINUZ_EFISTUB="Image" _VMLINUZ_EFISTUB="Image"
fi fi
# abstract the common pacman args # abstract the common pacman args
PACMAN="pacman --root ${_DESTDIR} ${PACMAN_CONF} --cachedir=${_DESTDIR}/var/cache/pacman/pkg --noconfirm --noprogressbar" PACMAN="pacman --root ${_DESTDIR} ${PACMAN_CONF} --cachedir=${_DESTDIR}/var/cache/pacman/pkg --noconfirm --noprogressbar"

View file

@ -89,9 +89,9 @@ run_mkinitcpio() {
chroot_mount chroot_mount
echo "Initramfs progress ..." > /tmp/mkinitcpio.log echo "Initramfs progress ..." > /tmp/mkinitcpio.log
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
chroot "${_DESTDIR}" mkinitcpio -p "${KERNELPKG}"-"${_RUNNING_ARCH}" |& tee -a "${_LOG}" /tmp/mkinitcpio.log >/dev/null 2>&1 chroot "${_DESTDIR}" mkinitcpio -p "${_KERNELPKG}"-"${_RUNNING_ARCH}" |& tee -a "${_LOG}" /tmp/mkinitcpio.log >/dev/null 2>&1
else else
chroot "${_DESTDIR}" mkinitcpio -p "${KERNELPKG}" |& tee -a "${_LOG}" /tmp/mkinitcpio.log >/dev/null 2>&1 chroot "${_DESTDIR}" mkinitcpio -p "${_KERNELPKG}" |& tee -a "${_LOG}" /tmp/mkinitcpio.log >/dev/null 2>&1
fi fi
echo $? > /tmp/.mkinitcpio-retcode echo $? > /tmp/.mkinitcpio-retcode
if [[ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ]]; then if [[ $(cat /tmp/.mkinitcpio-retcode) -ne 0 ]]; then

View file

@ -2,19 +2,19 @@
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
# downloader # downloader
DLPROG="wget" DLPROG="wget"
MIRRORLIST="/etc/pacman.d/mirrorlist" _MIRRORLIST="/etc/pacman.d/mirrorlist"
getsource() { getsource() {
S_SRC=0 _S_SRC=0
PACMAN_CONF="" _PACMAN_CONF=""
if [[ -e "${_LOCAL_DB}" ]]; then if [[ -e "${_LOCAL_DB}" ]]; then
_NEXTITEM="4" _NEXTITEM="4"
local_pacman_conf local_pacman_conf
DIALOG --msgbox "Setup is running in <Local mode>.\nOnly Local package database is used for package installation.\n\nIf you want to switch to <Online mode>, you have to delete /var/cache/pacman/pkg/archboot.db and rerun this step." 10 70 DIALOG --msgbox "Setup is running in <Local mode>.\nOnly Local package database is used for package installation.\n\nIf you want to switch to <Online mode>, you have to delete /var/cache/pacman/pkg/archboot.db and rerun this step." 10 70
S_SRC=1 _S_SRC=1
else else
select_mirror || return 1 select_mirror || return 1
S_SRC=1 _S_SRC=1
fi fi
} }
@ -30,12 +30,12 @@ select_mirror() {
dialog --infobox "Downloading latest mirrorlist ..." 3 40 dialog --infobox "Downloading latest mirrorlist ..." 3 40
${DLPROG} -q "https://www.archlinux.org/mirrorlist/?country=all&protocol=http&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on" -O /tmp/pacman_mirrorlist.txt ${DLPROG} -q "https://www.archlinux.org/mirrorlist/?country=all&protocol=http&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on" -O /tmp/pacman_mirrorlist.txt
if grep -q '#Server = http:' /tmp/pacman_mirrorlist.txt; then if grep -q '#Server = http:' /tmp/pacman_mirrorlist.txt; then
mv "${MIRRORLIST}" "${MIRRORLIST}.bak" mv "${_MIRRORLIST}" "${_MIRRORLIST}.bak"
cp /tmp/pacman_mirrorlist.txt "${MIRRORLIST}" cp /tmp/pacman_mirrorlist.txt "${_MIRRORLIST}"
fi fi
fi fi
# FIXME: this regex doesn't honor commenting # FIXME: this regex doesn't honor commenting
MIRRORS=$(grep -E -o '((http)|(https))://[^/]*' "${MIRRORLIST}" | sed 's|$| _|g') MIRRORS=$(grep -E -o '((http)|(https))://[^/]*' "${_MIRRORLIST}" | sed 's|$| _|g')
#shellcheck disable=SC2086 #shellcheck disable=SC2086
DIALOG --menu "Select a mirror:" 14 55 7 \ DIALOG --menu "Select a mirror:" 14 55 7 \
${MIRRORS} \ ${MIRRORS} \
@ -51,7 +51,7 @@ select_mirror() {
# our mirrorlist and pulling the full URL out. Substitute 'core' in # our mirrorlist and pulling the full URL out. Substitute 'core' in
# for the repository name, and ensure that if it was listed twice we # for the repository name, and ensure that if it was listed twice we
# only return one line for the mirror. # only return one line for the mirror.
SYNC_URL=$(grep -E -o "${_server}.*" "${MIRRORLIST}" | head -n1) SYNC_URL=$(grep -E -o "${_server}.*" "${_MIRRORLIST}" | head -n1)
fi fi
_NEXTITEM="4" _NEXTITEM="4"
echo "Using mirror: ${SYNC_URL}" > "${_LOG}" echo "Using mirror: ${SYNC_URL}" > "${_LOG}"
@ -87,13 +87,13 @@ update_environment() {
sleep 1 sleep 1
DIALOG --infobox "Checking on new online kernel version ..." 3 70 DIALOG --infobox "Checking on new online kernel version ..." 3 70
#shellcheck disable=SC2086 #shellcheck disable=SC2086
LOCAL_KERNEL="$(pacman -Qi ${KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')" LOCAL_KERNEL="$(pacman -Qi ${_KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
#shellcheck disable=SC2086 #shellcheck disable=SC2086
ONLINE_KERNEL="$(pacman -Si ${KERNELPKG}-${_RUNNING_ARCH} | grep Version | cut -d ':' -f2 | sed -e 's# ##')" ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG}-${_RUNNING_ARCH} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
else else
#shellcheck disable=SC2086 #shellcheck disable=SC2086
ONLINE_KERNEL="$(pacman -Si ${KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')" ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
fi fi
echo "${LOCAL_KERNEL} local kernel version and ${ONLINE_KERNEL} online kernel version." > "${_LOG}" echo "${LOCAL_KERNEL} local kernel version and ${ONLINE_KERNEL} online kernel version." > "${_LOG}"
sleep 2 sleep 2
@ -136,7 +136,7 @@ prepare_pacman() {
KEYRING="archlinux-keyring" KEYRING="archlinux-keyring"
[[ "${_RUNNING_ARCH}" == "aarch64" ]] && KEYRING="${KEYRING} archlinuxarm-keyring" [[ "${_RUNNING_ARCH}" == "aarch64" ]] && KEYRING="${KEYRING} archlinuxarm-keyring"
#shellcheck disable=SC2086 #shellcheck disable=SC2086
pacman -Sy ${PACMAN_CONF} --noconfirm --noprogressbar ${KEYRING} > "${_LOG}" 2>&1 || (DIALOG --msgbox "Keyring update failed! Check ${_LOG} for errors." 6 60; return 1) pacman -Sy ${_PACMAN_CONF} --noconfirm --noprogressbar ${KEYRING} > "${_LOG}" 2>&1 || (DIALOG --msgbox "Keyring update failed! Check ${_LOG} for errors." 6 60; return 1)
} }
# Set _PACKAGES parameter before running to install wanted packages # Set _PACKAGES parameter before running to install wanted packages