Filter packages correctly.
This commit is contained in:
parent
13b8ebb8f7
commit
1decb12863
1 changed files with 13 additions and 15 deletions
|
@ -10,26 +10,24 @@ cache_dir=$1
|
|||
# Typically filesystem root '/' but can be changed for testing.
|
||||
cache_restore_root=$2
|
||||
|
||||
# List of the packages to use.
|
||||
packages="${@:3}"
|
||||
|
||||
cache_filenames=$(ls -1 $cache_dir | sort)
|
||||
echo "Found $(echo $cache_filenames | wc -w) files in the cache."
|
||||
for cache_filename in $cache_filenames; do
|
||||
echo "- $(basename $cache_filename)"
|
||||
cache_filepaths=$(ls -1 $cache_dir | sort)
|
||||
echo "Found $(echo $cache_filepaths | wc -w) files in the cache."
|
||||
for cache_filepath in $cache_filepaths; do
|
||||
echo "- $(basename $cache_filepath)"
|
||||
done
|
||||
|
||||
# Only search for archived results. Manifest and cache key also live here.
|
||||
cache_pkg_filenames=$(ls -1 $cache_dir/*.tar.gz | sort)
|
||||
echo "Found $(echo $cache_pkg_filenames | wc -w) packages in the cache."
|
||||
for cache_pkg_filename in $cache_pkg_filenames; do
|
||||
echo "- $(basename $cache_pkg_filename)"
|
||||
cache_pkg_filepaths=$(ls -1 $cache_dir/*.tar.gz | sort)
|
||||
cache_pkg_filecount=$(echo $cache_pkg_filepaths | wc -w)
|
||||
echo "Found $cache_pkg_filecount packages in the cache."
|
||||
for cache_pkg_filepath in $cache_pkg_filepaths; do
|
||||
echo "- $(basename $cache_pkg_filepath)"
|
||||
done
|
||||
|
||||
echo "Restoring $cache_filename_count packages from cache..."
|
||||
for cache_pkg_filename in $cache_pkg_filenames; do
|
||||
cache_pkg_filepath=$cache_dir/$package.tar.gz
|
||||
echo "- $package ($(basename $cache_pkg_filepath))"
|
||||
echo "Restoring $cache_pkg_filecount packages from cache..."
|
||||
for cache_pkg_filepath in $cache_pkg_filepaths; do
|
||||
package=$(basename $cache_pkg_filepath | awk -F. '{print $1}')
|
||||
echo "- $package"
|
||||
sudo tar -xf $cache_pkg_filepath -C $cache_restore_root > /dev/null
|
||||
done
|
||||
echo "done."
|
||||
|
|
Loading…
Reference in a new issue