From e558e74c19c0ef40fd89c3d5fafe36578a903106 Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Sat, 16 Oct 2021 21:23:27 -0700 Subject: [PATCH] Full qualify paths. --- restore_pkgs.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/restore_pkgs.sh b/restore_pkgs.sh index cfd292e..2e61d70 100755 --- a/restore_pkgs.sh +++ b/restore_pkgs.sh @@ -9,11 +9,16 @@ cache_dir=$1 # Typically filesystem root '/' but can be changed for testing. cache_restore_root=$2 -for cache_filepath in $(ls $cache_dir); do +cache_filenames=$(ls -1 $cache_dir | sort) +echo "* Found ${#cache_filenames[@]} files in cache..." +echo $cache_filenames + +for cache_filename in $cache_filenames; do + cache_filepath=$cache_dir/$cache_filename echo "* Restoring $cache_filepath from cache... " sudo tar -xf $cache_filepath -C $cache_restore_root done # Update all packages. sudo apt-get --yes --only-upgrade install -echo "Action complete. $(ls -l $cache_dir | wc -l) package(s) restored." +echo "Action complete. $(echo $cache_filenames | wc -l) package(s) restored."