mkarchiso: do not place the pkglist.x86_64.txt file inside the bootstrap tarball's root.x86_64 directory

Keep it inside the archive, but separate from the `root.x86_64` directory
to avoid polluting it.
This commit is contained in:
nl6720 2024-05-02 10:51:08 +03:00
parent 969b91f700
commit e567a2ab26
No known key found for this signature in database
GPG key ID: 6B5387E670A955AD
3 changed files with 9 additions and 7 deletions

View file

@ -152,7 +152,7 @@ create_metrics() {
"$(du -m -- "${output}/"*.tar*(.gz|.xz|.zst) | cut -f1)" "$(du -m -- "${output}/"*.tar*(.gz|.xz|.zst) | cut -f1)"
printf 'bootstrap_package_count{image="%s"} %s\n' \ printf 'bootstrap_package_count{image="%s"} %s\n' \
"${profile}" \ "${profile}" \
"$(sort -u -- "${tmpdir}/"*/bootstrap/root.*/pkglist.*.txt | wc -l)" "$(sort -u -- "${tmpdir}/"*/bootstrap/pkglist.*.txt | wc -l)"
;; ;;
esac esac
} >"${_metrics}" } >"${_metrics}"

View file

@ -11,6 +11,9 @@ Added
Changed Changed
------- -------
- Moved the ``pkglist.x86_64.txt`` file outside the bootstrap tarball's ``root.x86_64`` directly to avoid polluting the
root file system.
Deprecated Deprecated
---------- ----------

View file

@ -33,6 +33,7 @@ arch=""
pacman_conf="" pacman_conf=""
packages="" packages=""
bootstrap_packages="" bootstrap_packages=""
bootstrap_parent=""
pacstrap_dir="" pacstrap_dir=""
search_filename="" search_filename=""
declare -i rm_work_dir=0 declare -i rm_work_dir=0
@ -1702,16 +1703,13 @@ _build_bootstrap_image() {
*) _msg_error 'Unsupported compression!' 1 ;; *) _msg_error 'Unsupported compression!' 1 ;;
esac esac
local _bootstrap_parent
_bootstrap_parent="$(dirname -- "${pacstrap_dir}")"
[[ -d "${out_dir}" ]] || install -d -- "${out_dir}" [[ -d "${out_dir}" ]] || install -d -- "${out_dir}"
cd -- "${_bootstrap_parent}" cd -- "${bootstrap_parent}"
_msg_info "Creating bootstrap image..." _msg_info "Creating bootstrap image..."
rm -f -- "${out_dir:?}/${image_name:?}${tarball_ext}" rm -f -- "${out_dir:?}/${image_name:?}${tarball_ext}"
bsdtar -cf - "root.${arch}" | "${bootstrap_tarball_compression[@]}" >"${out_dir}/${image_name}${tarball_ext}" bsdtar -cf - "root.${arch}" "pkglist.${arch}.txt" | "${bootstrap_tarball_compression[@]}" >"${out_dir}/${image_name}${tarball_ext}"
_msg_info "Done!" _msg_info "Done!"
du -h -- "${out_dir}/${image_name}${tarball_ext}" du -h -- "${out_dir}/${image_name}${tarball_ext}"
cd -- "${OLDPWD}" cd -- "${OLDPWD}"
@ -1961,7 +1959,7 @@ _make_pkglist() {
_msg_info "Creating a list of installed packages on live-enviroment..." _msg_info "Creating a list of installed packages on live-enviroment..."
case "${buildmode}" in case "${buildmode}" in
"bootstrap") "bootstrap")
pacman -Q --sysroot "${pacstrap_dir}" >"${pacstrap_dir}/pkglist.${arch}.txt" pacman -Q --sysroot "${pacstrap_dir}" >"${bootstrap_parent}/pkglist.${arch}.txt"
;; ;;
"iso"|"netboot") "iso"|"netboot")
install -d -m 0755 -- "${isofs_dir}/${install_dir}" install -d -m 0755 -- "${isofs_dir}/${install_dir}"
@ -2024,6 +2022,7 @@ _build_buildmode_bootstrap() {
# Set up essential directory paths # Set up essential directory paths
pacstrap_dir="${work_dir}/${arch}/bootstrap/root.${arch}" pacstrap_dir="${work_dir}/${arch}/bootstrap/root.${arch}"
bootstrap_parent="$(dirname -- "${pacstrap_dir}")"
[[ -d "${work_dir}" ]] || install -d -- "${work_dir}" [[ -d "${work_dir}" ]] || install -d -- "${work_dir}"
install -d -m 0755 -o 0 -g 0 -- "${pacstrap_dir}" install -d -m 0755 -o 0 -g 0 -- "${pacstrap_dir}"