Fixing issues with variable quoting and arrays

archiso/mkarchiso:
Calls to _pacman() need to be done with multiple parameters (e.g. array) instead of one string, as string splitting is
not done in that function anymore.
Turning _iso_efi_boot_args from string into an array to have an easier time of passing it to xorriso.
Calling xorriso within the if statements instead of providing -quiet via variable.
Fixing command_install() to provide packages separately to _pacman()

configs/releng/build.sh:
Replacing all newlines when retrieving the packages from packages.x86_64 with spaces so they will be properly provided
to "mkarchiso install".
This commit is contained in:
David Runge 2020-06-30 19:35:56 +02:00
parent 511ca9d95d
commit 5e43a63b3c
No known key found for this signature in database
GPG Key ID: 7258734B41C31549
2 changed files with 42 additions and 25 deletions

View File

@ -43,7 +43,7 @@ _msg_error() {
_chroot_init() {
mkdir -p ${work_dir}/airootfs
_pacman "base syslinux"
_pacman base syslinux
}
_chroot_run() {
@ -279,7 +279,7 @@ command_pkglist () {
# Create an ISO9660 filesystem from "iso" directory.
command_iso () {
local _iso_efi_boot_args=""
local _iso_efi_boot_args=()
if [[ ! -f "${work_dir}/iso/isolinux/isolinux.bin" ]]; then
_msg_error "The file '${work_dir}/iso/isolinux/isolinux.bin' does not exist." 1
@ -290,10 +290,12 @@ command_iso () {
# If exists, add an EFI "El Torito" boot image (FAT filesystem) to ISO-9660 image.
if [[ -f "${work_dir}/iso/EFI/archiso/efiboot.img" ]]; then
_iso_efi_boot_args="-eltorito-alt-boot
-e EFI/archiso/efiboot.img
-no-emul-boot
-isohybrid-gpt-basdat"
_iso_efi_boot_args+=(
'-eltorito-alt-boot'
'-e' 'EFI/archiso/efiboot.img'
'-no-emul-boot'
'-isohybrid-gpt-basdat'
)
fi
_show_config iso
@ -302,22 +304,36 @@ command_iso () {
_msg_info "Creating ISO image..."
local _qflag=""
if [[ "${quiet}" == "y" ]]; then
_qflag="-quiet"
xorriso -as mkisofs -quiet \
-iso-level 3 \
-full-iso9660-filenames \
-volid "${iso_label}" \
-appid "${iso_application}" \
-publisher "${iso_publisher}" \
-preparer "prepared by mkarchiso" \
-eltorito-boot isolinux/isolinux.bin \
-eltorito-catalog isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-isohybrid-mbr "${work_dir}/iso/isolinux/isohdpfx.bin" \
"${_iso_efi_boot_args[@]}" \
-output "${out_dir}/${img_name}" \
"${work_dir}/iso/"
else
xorriso -as mkisofs \
-iso-level 3 \
-full-iso9660-filenames \
-volid "${iso_label}" \
-appid "${iso_application}" \
-publisher "${iso_publisher}" \
-preparer "prepared by mkarchiso" \
-eltorito-boot isolinux/isolinux.bin \
-eltorito-catalog isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-isohybrid-mbr "${work_dir}/iso/isolinux/isohdpfx.bin" \
"${_iso_efi_boot_args[@]}" \
-output "${out_dir}/${img_name}" \
"${work_dir}/iso/"
fi
xorriso -as mkisofs "${_qflag}" \
-iso-level 3 \
-full-iso9660-filenames \
-volid "${iso_label}" \
-appid "${iso_application}" \
-publisher "${iso_publisher}" \
-preparer "prepared by mkarchiso" \
-eltorito-boot isolinux/isolinux.bin \
-eltorito-catalog isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-isohybrid-mbr "${work_dir}/iso/isolinux/isohdpfx.bin" \
"${_iso_efi_boot_args}" \
-output "${out_dir}/${img_name}" \
"${work_dir}/iso/"
_msg_info "Done! | $(ls -sh "${out_dir}/${img_name}")"
}
@ -351,7 +367,7 @@ command_install () {
_show_config install
_pacman "${pkg_list[*]}"
_pacman "${pkg_list[@]}"
}
command_init() {
@ -374,7 +390,8 @@ while getopts 'p:r:C:L:P:A:D:w:o:s:c:g:vh' arg; do
case "${arg}" in
p)
read -r -a opt_pkg_list <<< "${OPTARG}"
pkg_list+=("${opt_pkg_list[@]}") ;;
pkg_list+=("${opt_pkg_list[@]}")
;;
r) run_cmd="${OPTARG}" ;;
C) pacman_conf="${OPTARG}" ;;
L) iso_label="${OPTARG}" ;;

View File

@ -76,10 +76,10 @@ make_basefs() {
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")" install
-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")" install
-p "$(grep -h -v '^#' "${script_path}/packages.x86_64"| sed ':a;N;$!ba;s/\n/ /g')" install
fi
}