mkarchiso: make bootstrap tarball extension part of the image_name

This shows the correct image file name in `_show_config` and simplifies
actions with the `image_name` in other functions.
This commit is contained in:
nl6720 2024-07-27 15:09:52 +03:00
parent fa3aba32c8
commit 654e834f8c
No known key found for this signature in database
GPG key ID: 6B5387E670A955AD
2 changed files with 15 additions and 17 deletions

View file

@ -17,6 +17,8 @@ Deprecated
Fixed
-----
- Show the correct image file name, including the extension, when building a bootstrap image.
Removed
-------

View file

@ -1687,34 +1687,20 @@ _add_xorrisofs_options_uefi-x64.grub.eltorito() {
# Build bootstrap image
_build_bootstrap_image() {
local tarball_ext
# Set default tarball compression to uncompressed
if (( ! "${#bootstrap_tarball_compression[@]}" )); then
bootstrap_tarball_compression=('cat')
fi
# Set tarball extension
case "${bootstrap_tarball_compression[0]}" in
'cat') tarball_ext='' ;;
'bzip') tarball_ext='.b2z' ;;
'gzip') tarball_ext='.gz' ;;
'lrzip') tarball_ext='.lrz' ;;
'lzip') tarball_ext='.lz' ;;
'lzop') tarball_ext='.lzo' ;;
'zstd'|'zstdmt') tarball_ext='.zst' ;;
*) _msg_error 'Unsupported compression!' 1 ;;
esac
[[ -d "${out_dir}" ]] || install -d -- "${out_dir}"
cd -- "${bootstrap_parent}"
_msg_info "Creating bootstrap image..."
rm -f -- "${out_dir:?}/${image_name:?}${tarball_ext}"
bsdtar -cf - "root.${arch}" "pkglist.${arch}.txt" | "${bootstrap_tarball_compression[@]}" >"${out_dir}/${image_name}${tarball_ext}"
rm -f -- "${out_dir:?}/${image_name:?}"
bsdtar -cf - "root.${arch}" "pkglist.${arch}.txt" | "${bootstrap_tarball_compression[@]}" >"${out_dir}/${image_name}"
_msg_info "Done!"
du -h -- "${out_dir}/${image_name}${tarball_ext}"
du -h -- "${out_dir}/${image_name}"
cd -- "${OLDPWD}"
}
@ -2034,6 +2020,16 @@ _build_buildmode_bootstrap() {
[[ -d "${work_dir}" ]] || install -d -- "${work_dir}"
install -d -m 0755 -o 0 -g 0 -- "${pacstrap_dir}"
# Set tarball extension
case "${bootstrap_tarball_compression[0]}" in
'bzip') image_name="${image_name}.b2z" ;;
'gzip') image_name="${image_name}.gz" ;;
'lrzip') image_name="${image_name}.lrz" ;;
'lzip') image_name="${image_name}.lz" ;;
'lzop') image_name="${image_name}.lzo" ;;
'zstd'|'zstdmt') image_name="${image_name}.zst" ;;
esac
[[ "${quiet}" == "y" ]] || _show_config
_run_once _make_pacman_conf
_run_once _make_packages