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.
|
# Typically filesystem root '/' but can be changed for testing.
|
||||||
cache_restore_root=$2
|
cache_restore_root=$2
|
||||||
|
|
||||||
# List of the packages to use.
|
cache_filepaths=$(ls -1 $cache_dir | sort)
|
||||||
packages="${@:3}"
|
echo "Found $(echo $cache_filepaths | wc -w) files in the cache."
|
||||||
|
for cache_filepath in $cache_filepaths; do
|
||||||
cache_filenames=$(ls -1 $cache_dir | sort)
|
echo "- $(basename $cache_filepath)"
|
||||||
echo "Found $(echo $cache_filenames | wc -w) files in the cache."
|
|
||||||
for cache_filename in $cache_filenames; do
|
|
||||||
echo "- $(basename $cache_filename)"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Only search for archived results. Manifest and cache key also live here.
|
# Only search for archived results. Manifest and cache key also live here.
|
||||||
cache_pkg_filenames=$(ls -1 $cache_dir/*.tar.gz | sort)
|
cache_pkg_filepaths=$(ls -1 $cache_dir/*.tar.gz | sort)
|
||||||
echo "Found $(echo $cache_pkg_filenames | wc -w) packages in the cache."
|
cache_pkg_filecount=$(echo $cache_pkg_filepaths | wc -w)
|
||||||
for cache_pkg_filename in $cache_pkg_filenames; do
|
echo "Found $cache_pkg_filecount packages in the cache."
|
||||||
echo "- $(basename $cache_pkg_filename)"
|
for cache_pkg_filepath in $cache_pkg_filepaths; do
|
||||||
|
echo "- $(basename $cache_pkg_filepath)"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Restoring $cache_filename_count packages from cache..."
|
echo "Restoring $cache_pkg_filecount packages from cache..."
|
||||||
for cache_pkg_filename in $cache_pkg_filenames; do
|
for cache_pkg_filepath in $cache_pkg_filepaths; do
|
||||||
cache_pkg_filepath=$cache_dir/$package.tar.gz
|
package=$(basename $cache_pkg_filepath | awk -F. '{print $1}')
|
||||||
echo "- $package ($(basename $cache_pkg_filepath))"
|
echo "- $package"
|
||||||
sudo tar -xf $cache_pkg_filepath -C $cache_restore_root > /dev/null
|
sudo tar -xf $cache_pkg_filepath -C $cache_restore_root > /dev/null
|
||||||
done
|
done
|
||||||
echo "done."
|
echo "done."
|
||||||
|
|
Loading…
Reference in a new issue