Skip to content

Commit 13d2226

Browse files
authored
Avoid using xargs when creating package tarballs (#136)
1 parent d1a184e commit 13d2226

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

install_and_cache_pkgs.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,10 @@ for installed_package in ${installed_packages}; do
8888
log " * Caching ${package_name} to ${cache_filepath}..."
8989

9090
# Pipe all package files (no folders) and installation control data to Tar.
91-
{ dpkg -L "${package_name}" \
92-
& get_install_script_filepath "" "${package_name}" "preinst" \
93-
& get_install_script_filepath "" "${package_name}" "postinst"; } |
94-
while IFS= read -r f; do test -f "${f}" -o -L "${f}" && get_tar_relpath "${f}"; done |
95-
# Single quotes ensure literals like backslash get captured. Use \0 to avoid field separation.
96-
awk -F"\0" '{print "\x27"$1"\x27"}' |
97-
sudo xargs tar -cf "${cache_filepath}" -C /
91+
tar -cf "${cache_filepath}" -C / --verbatim-files-from --files-from <( { dpkg -L "${package_name}" &&
92+
get_install_script_filepath "" "${package_name}" "preinst" &&
93+
get_install_script_filepath "" "${package_name}" "postinst" ;} |
94+
while IFS= read -r f; do test -f "${f}" -o -L "${f}" && get_tar_relpath "${f}"; done )
9895

9996
log " done (compressed size $(du -h "${cache_filepath}" | cut -f1))."
10097
fi

0 commit comments

Comments
 (0)