mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2024-12-22 18:55:30 +00:00
Fix manifest location.
This commit is contained in:
parent
b67439fdd6
commit
6d2730c8bf
|
@ -20,14 +20,16 @@ echo -n "Updating APT package list..."
|
|||
sudo apt-get update > /dev/null
|
||||
echo "done."
|
||||
|
||||
echo "Clean installing and caching $(echo $packages | wc -w) packages..."
|
||||
for package in $packages; do
|
||||
cache_filepath=$cache_dir/$package.tar.gz
|
||||
|
||||
echo -n "Clean installing $package..."
|
||||
echo "- $package"
|
||||
echo -n " Installing..."
|
||||
sudo apt-get --yes install $package > /dev/null
|
||||
echo "done."
|
||||
|
||||
echo -n "Caching $package to $cache_filepath..."
|
||||
echo -n " Caching to $cache_filepath..."
|
||||
# Pipe all package files (no folders) to Tar.
|
||||
dpkg -L $package |
|
||||
while IFS= read -r f; do
|
||||
|
@ -36,5 +38,10 @@ for package in $packages; do
|
|||
xargs tar -czf $cache_filepath -C /
|
||||
echo "done."
|
||||
done
|
||||
echo "done."
|
||||
|
||||
echo "$(echo $packages | wc -w) package(s) installed and cached."
|
||||
manifest_filepath="$cache_dir/manifest.log"
|
||||
echo -n "Writing package manifest to $manifest_filepath..."
|
||||
# Remove trailing comma.
|
||||
echo ${manifest:0:-1} > $manifest_filepath
|
||||
echo "done."
|
|
@ -36,9 +36,3 @@ for package in $packages; do
|
|||
manifest=$manifest$item,
|
||||
done
|
||||
echo "done."
|
||||
|
||||
manifest_filepath="$cache_dir/manifest.log"
|
||||
echo -n "Writing manifest to $manifest_filepath..."
|
||||
# Remove trailing comma.
|
||||
echo ${manifest:0:-1} > $manifest_filepath
|
||||
echo "done."
|
|
@ -17,17 +17,10 @@ packages="${@:3}"
|
|||
cache_filenames=$(ls -1 $cache_dir | grep .tar.gz | sort)
|
||||
cache_filename_count=$(echo $cache_filenames | wc -w)
|
||||
|
||||
echo "Found $cache_filename_count packages in cache."
|
||||
echo -n "Restoring $cache_filename_count packages from cache..."
|
||||
for cache_filename in $cache_filenames; do
|
||||
echo "- $cache_filename"
|
||||
done
|
||||
|
||||
echo -n "Restoring cached packages..."
|
||||
for package in $packages; do
|
||||
cache_filepath=$cache_dir/$package.tar.gz
|
||||
echo "- $package ($cache_filepath)"
|
||||
sudo tar -xf $cache_filepath -C $cache_restore_root > /dev/null
|
||||
done
|
||||
echo "done."
|
||||
|
||||
echo "$cache_filename_count package(s) restored."
|
Loading…
Reference in a new issue