From ff0c13f90c4e4ca922171a08f7344e86cd64fcd0 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Wed, 29 Jul 2020 18:18:33 +0300 Subject: Build initramfs images only once Place custom mkinitcpio.conf in airootfs. Use a custom mkinitcpio preset to specify generated image file path. --- configs/releng/build.sh | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) (limited to 'configs/releng/build.sh') diff --git a/configs/releng/build.sh b/configs/releng/build.sh index e360f23..888c061 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -86,44 +86,31 @@ make_custom_airootfs() { done < "${_airootfs}/etc/passwd" fi fi -} - -# Packages (airootfs) -make_packages() { - if [ -n "${verbose}" ]; then - mkarchiso -v -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ - -p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install - else - mkarchiso -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ - -p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install - fi -} -# Copy mkinitcpio archiso hooks and build initramfs (airootfs) -make_setup_mkinitcpio() { local _hook - mkdir -p "${work_dir}/x86_64/airootfs/etc/initcpio/hooks" - mkdir -p "${work_dir}/x86_64/airootfs/etc/initcpio/install" + mkdir -p -- "${work_dir}/x86_64/airootfs/etc/initcpio/hooks" + mkdir -p -- "${work_dir}/x86_64/airootfs/etc/initcpio/install" for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do - cp "/usr/lib/initcpio/hooks/${_hook}" "${work_dir}/x86_64/airootfs/etc/initcpio/hooks" - cp "/usr/lib/initcpio/install/${_hook}" "${work_dir}/x86_64/airootfs/etc/initcpio/install" + cp "/usr/lib/initcpio/hooks/${_hook}" "${work_dir}/x86_64/airootfs/etc/initcpio/hooks/" + cp "/usr/lib/initcpio/install/${_hook}" "${work_dir}/x86_64/airootfs/etc/initcpio/install/" done sed -i "s|/usr/lib/initcpio/|/etc/initcpio/|g" "${work_dir}/x86_64/airootfs/etc/initcpio/install/archiso_shutdown" - cp /usr/lib/initcpio/install/archiso_kms "${work_dir}/x86_64/airootfs/etc/initcpio/install" - cp /usr/lib/initcpio/archiso_shutdown "${work_dir}/x86_64/airootfs/etc/initcpio" - cp "${script_path}/mkinitcpio.conf" "${work_dir}/x86_64/airootfs/etc/mkinitcpio-archiso.conf" + cp /usr/lib/initcpio/install/archiso_kms "${work_dir}/x86_64/airootfs/etc/initcpio/install/" + cp /usr/lib/initcpio/archiso_shutdown "${work_dir}/x86_64/airootfs/etc/initcpio/" +} + +# Packages (airootfs) +make_packages() { if [[ "${gpg_key}" ]]; then gpg --export "${gpg_key}" > "${work_dir}/gpgkey" exec 17<>"${work_dir}/gpgkey" fi if [ -n "${verbose}" ]; then - ARCHISO_GNUPG_FD="${gpg_key:+17}" mkarchiso -v -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" \ - -D "${install_dir}" \ - -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run + ARCHISO_GNUPG_FD="${gpg_key:+17}" mkarchiso -v -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ + -p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install else - ARCHISO_GNUPG_FD="${gpg_key:+17}" mkarchiso -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" \ - -D "${install_dir}" \ - -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run + ARCHISO_GNUPG_FD="${gpg_key:+17}" mkarchiso -w "${work_dir}/x86_64" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ + -p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install fi if [[ "${gpg_key}" ]]; then exec 17<&- @@ -321,7 +308,6 @@ run_once make_pacman_conf run_once make_custom_airootfs run_once make_packages run_once make_customize_airootfs -run_once make_setup_mkinitcpio run_once make_boot run_once make_boot_extra run_once make_syslinux -- cgit v1.2.3-70-g09d2