Merge remote-tracking branch 'nl6720/more-quiet'

* nl6720/more-quiet:
  mkarchiso: use mkfs.erofs --quiet in quiet mode
  mkarchiso: use mksquashfs -quiet instead of redirecting its stdout to /dev/null
  mkarchiso: do not show subdirectory sizes in netboot mode
  mkarchiso: redirect command -v output to /dev/null
  mkarchiso: silence xorriso's note about SOURCE_DATE_EPOCH
  mkarchiso: silence mkfs.fat in quiet mode
This commit is contained in:
David Runge 2021-11-30 19:39:46 +01:00
commit 6cd4a64caa
No known key found for this signature in database
GPG Key ID: 7258734B41C31549

View File

@ -165,13 +165,10 @@ _cleanup_pacstrap_dir() {
# Create a squashfs image and place it in the ISO 9660 file system. # Create a squashfs image and place it in the ISO 9660 file system.
# $@: options to pass to mksquashfs # $@: options to pass to mksquashfs
_run_mksquashfs() { _run_mksquashfs() {
local image_path="${isofs_dir}/${install_dir}/${arch}/airootfs.sfs" local mksquashfs_options=() image_path="${isofs_dir}/${install_dir}/${arch}/airootfs.sfs"
rm -f -- "${image_path}" rm -f -- "${image_path}"
if [[ "${quiet}" == "y" ]]; then [[ ! "${quiet}" == "y" ]] || mksquashfs_options+=('-no-progress' '-quiet')
mksquashfs "$@" "${image_path}" -noappend "${airootfs_image_tool_options[@]}" -no-progress > /dev/null mksquashfs "$@" "${image_path}" -noappend "${airootfs_image_tool_options[@]}" "${mksquashfs_options[@]}"
else
mksquashfs "$@" "${image_path}" -noappend "${airootfs_image_tool_options[@]}"
fi
} }
# Create an ext4 image containing the root file system and pack it inside a squashfs image. # Create an ext4 image containing the root file system and pack it inside a squashfs image.
@ -216,16 +213,18 @@ _mkairootfs_squashfs() {
# Create an EROFS image containing the root file system and saves it on the ISO 9660 file system. # Create an EROFS image containing the root file system and saves it on the ISO 9660 file system.
_mkairootfs_erofs() { _mkairootfs_erofs() {
local fsuuid local fsuuid mkfs_erofs_options=()
[[ -e "${pacstrap_dir}" ]] || _msg_error "The path '${pacstrap_dir}' does not exist" 1 [[ -e "${pacstrap_dir}" ]] || _msg_error "The path '${pacstrap_dir}' does not exist" 1
install -d -m 0755 -- "${isofs_dir}/${install_dir}/${arch}" install -d -m 0755 -- "${isofs_dir}/${install_dir}/${arch}"
local image_path="${isofs_dir}/${install_dir}/${arch}/airootfs.erofs" local image_path="${isofs_dir}/${install_dir}/${arch}/airootfs.erofs"
rm -f -- "${image_path}" rm -f -- "${image_path}"
[[ ! "${quiet}" == "y" ]] || mkfs_erofs_options+=('--quiet')
# Generate reproducible file system UUID from SOURCE_DATE_EPOCH # Generate reproducible file system UUID from SOURCE_DATE_EPOCH
fsuuid="$(uuidgen --sha1 --namespace 93a870ff-8565-4cf3-a67b-f47299271a96 --name "${SOURCE_DATE_EPOCH}")" fsuuid="$(uuidgen --sha1 --namespace 93a870ff-8565-4cf3-a67b-f47299271a96 --name "${SOURCE_DATE_EPOCH}")"
mkfs_erofs_options+=('-U' "${fsuuid}" "${airootfs_image_tool_options[@]}")
_msg_info "Creating EROFS image, this may take some time..." _msg_info "Creating EROFS image, this may take some time..."
mkfs.erofs -U "${fsuuid}" "${airootfs_image_tool_options[@]}" -- "${image_path}" "${pacstrap_dir}" mkfs.erofs "${mkfs_erofs_options[@]}" -- "${image_path}" "${pacstrap_dir}"
_msg_info "Done!" _msg_info "Done!"
} }
@ -505,7 +504,13 @@ _make_efibootimg() {
# https://lists.gnu.org/archive/html/grub-devel/2019-04/msg00099.html # https://lists.gnu.org/archive/html/grub-devel/2019-04/msg00099.html
rm -f -- "${work_dir}/efiboot.img" rm -f -- "${work_dir}/efiboot.img"
_msg_info "Creating FAT image of size: ${imgsize} KiB..." _msg_info "Creating FAT image of size: ${imgsize} KiB..."
if [[ "${quiet}" == "y" ]]; then
# mkfs.fat does not have a -q/--quiet option, so redirect stdout to /dev/null instead
# https://github.com/dosfstools/dosfstools/issues/103
mkfs.fat -C -n ARCHISO_EFI "${work_dir}/efiboot.img" "${imgsize}" > /dev/null
else
mkfs.fat -C -n ARCHISO_EFI "${work_dir}/efiboot.img" "${imgsize}" mkfs.fat -C -n ARCHISO_EFI "${work_dir}/efiboot.img" "${imgsize}"
fi
# Create the default/fallback boot path in which a boot loaders will be placed later. # Create the default/fallback boot path in which a boot loaders will be placed later.
mmd -i "${work_dir}/efiboot.img" ::/EFI ::/EFI/BOOT mmd -i "${work_dir}/efiboot.img" ::/EFI ::/EFI/BOOT
@ -698,7 +703,7 @@ _export_netboot_artifacts() {
install -d -m 0755 "${out_dir}" install -d -m 0755 "${out_dir}"
cp -a -- "${isofs_dir}/${install_dir}/" "${out_dir}/" cp -a -- "${isofs_dir}/${install_dir}/" "${out_dir}/"
_msg_info "Done!" _msg_info "Done!"
du -h -- "${out_dir}/${install_dir}" du -hs -- "${out_dir}/${install_dir}"
} }
# sign build artifacts for netboot # sign build artifacts for netboot
@ -742,7 +747,7 @@ _validate_requirements_airootfs_image_type_ext4+squashfs() {
} }
_validate_requirements_airootfs_image_type_erofs() { _validate_requirements_airootfs_image_type_erofs() {
if ! command -v mkfs.erofs; then if ! command -v mkfs.erofs &> /dev/null; then
(( validation_error=validation_error+1 )) (( validation_error=validation_error+1 ))
_msg_error "Validating '${airootfs_image_type}': mkfs.erofs is not available on this host. Install 'erofs-utils'!" 0 _msg_error "Validating '${airootfs_image_type}': mkfs.erofs is not available on this host. Install 'erofs-utils'!" 0
fi fi
@ -989,12 +994,17 @@ _build_bootstrap_image() {
# Build ISO # Build ISO
_build_iso_image() { _build_iso_image() {
local xorrisofs_options=() local xorriso_options=() xorrisofs_options=()
local bootmode local bootmode
[[ -d "${out_dir}" ]] || install -d -- "${out_dir}" [[ -d "${out_dir}" ]] || install -d -- "${out_dir}"
[[ "${quiet}" == "y" ]] && xorrisofs_options+=('-quiet') if [[ "${quiet}" == "y" ]]; then
# The when xorriso is run in mkisofs compatibility mode (xorrisofs), the mkisofs option -quiet is interpreted
# too late (e.g. messages about SOURCE_DATE_EPOCH still get shown).
# Instead use native xorriso option to silence the output.
xorriso_options=('-report_about' 'SORRY' "${xorriso_options[@]}")
fi
# Add required xorrisofs options for each boot mode # Add required xorrisofs options for each boot mode
for bootmode in "${bootmodes[@]}"; do for bootmode in "${bootmodes[@]}"; do
@ -1003,7 +1013,7 @@ _build_iso_image() {
rm -f -- "${out_dir}/${image_name}" rm -f -- "${out_dir}/${image_name}"
_msg_info "Creating ISO image..." _msg_info "Creating ISO image..."
xorriso -as mkisofs \ xorriso "${xorriso_options[@]}" -as mkisofs \
-iso-level 3 \ -iso-level 3 \
-full-iso9660-filenames \ -full-iso9660-filenames \
-joliet \ -joliet \