mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2024-12-22 18:55:30 +00:00
parent
09f9c08872
commit
c58510bf41
|
@ -64,7 +64,7 @@ log_empty_line
|
||||||
installed_package_count=$(wc -w <<< "${installed_packages}")
|
installed_package_count=$(wc -w <<< "${installed_packages}")
|
||||||
log "Caching ${installed_package_count} installed packages..."
|
log "Caching ${installed_package_count} installed packages..."
|
||||||
for installed_package in ${installed_packages}; do
|
for installed_package in ${installed_packages}; do
|
||||||
cache_filepath="${cache_dir}/${installed_package}.tar.gz"
|
cache_filepath="${cache_dir}/${installed_package}.tar"
|
||||||
|
|
||||||
# Sanity test in case APT enumerates duplicates.
|
# Sanity test in case APT enumerates duplicates.
|
||||||
if test ! -f "${cache_filepath}"; then
|
if test ! -f "${cache_filepath}"; then
|
||||||
|
@ -75,7 +75,7 @@ for installed_package in ${installed_packages}; do
|
||||||
while IFS= read -r f; do
|
while IFS= read -r f; do
|
||||||
if test -f $f || test -L $f; then echo "${f:1}"; fi; #${f:1} removes the leading slash that Tar disallows
|
if test -f $f || test -L $f; then echo "${f:1}"; fi; #${f:1} removes the leading slash that Tar disallows
|
||||||
done |
|
done |
|
||||||
sudo xargs tar -czf "${cache_filepath}" -C /
|
sudo xargs tar -cf "${cache_filepath}" -C /
|
||||||
log " done (compressed size $(du -h "${cache_filepath}" | cut -f1))."
|
log " done (compressed size $(du -h "${cache_filepath}" | cut -f1))."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ log "done"
|
||||||
log_empty_line
|
log_empty_line
|
||||||
|
|
||||||
# Only search for archived results. Manifest and cache key also live here.
|
# Only search for archived results. Manifest and cache key also live here.
|
||||||
cached_pkg_filepaths=$(ls -1 "${cache_dir}"/*.tar.gz | sort)
|
cached_pkg_filepaths=$(ls -1 "${cache_dir}"/*.tar | sort)
|
||||||
cached_pkg_filecount=$(echo ${cached_pkg_filepaths} | wc -w)
|
cached_pkg_filecount=$(echo ${cached_pkg_filepaths} | wc -w)
|
||||||
log "Restoring ${cached_pkg_filecount} packages from cache..."
|
log "Restoring ${cached_pkg_filecount} packages from cache..."
|
||||||
for cached_pkg_filepath in ${cached_pkg_filepaths}; do
|
for cached_pkg_filepath in ${cached_pkg_filepaths}; do
|
||||||
|
|
Loading…
Reference in a new issue