Clean cache on remove if requested
This commit is contained in:
parent
e419b716a4
commit
68d1160c03
1 changed files with 11 additions and 1 deletions
12
arkdep
12
arkdep
|
@ -137,6 +137,9 @@ init () {
|
||||||
|
|
||||||
# Keep the latest n-1 deployments, remove anything older
|
# Keep the latest n-1 deployments, remove anything older
|
||||||
deploy_keep=4
|
deploy_keep=4
|
||||||
|
|
||||||
|
# Remove images from the cache when their deployments are removed
|
||||||
|
clean_cache_on_remove=1
|
||||||
END
|
END
|
||||||
|
|
||||||
# Add default bootloader config file
|
# Add default bootloader config file
|
||||||
|
@ -229,7 +232,6 @@ remove_deployment () {
|
||||||
|
|
||||||
# Ensure the deployment and all sub-volumes are writable
|
# Ensure the deployment and all sub-volumes are writable
|
||||||
for volume in $(btrfs subvolume list / | grep -oE '[^ ]+$' | grep $target); do
|
for volume in $(btrfs subvolume list / | grep -oE '[^ ]+$' | grep $target); do
|
||||||
echo $volume
|
|
||||||
btrfs property set -f -ts $(readlink -m /$volume) ro false || printf "failed to make subvol $volume writable\n"
|
btrfs property set -f -ts $(readlink -m /$volume) ro false || printf "failed to make subvol $volume writable\n"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -240,6 +242,14 @@ remove_deployment () {
|
||||||
grep -v $1 $arkdep_dir/tracker > $arkdep_dir/tracker_tmp
|
grep -v $1 $arkdep_dir/tracker > $arkdep_dir/tracker_tmp
|
||||||
mv $arkdep_dir/tracker_tmp $arkdep_dir/tracker
|
mv $arkdep_dir/tracker_tmp $arkdep_dir/tracker
|
||||||
|
|
||||||
|
# Remove images from cache if requested
|
||||||
|
if [[ $clean_cache_on_remove -eq 1 ]]; then
|
||||||
|
# Only attempt remove if file exists
|
||||||
|
if ls $arkdep_dir/cache/ | grep $1; then
|
||||||
|
rm -v $arkdep_dir/cache/$1.tar.*
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue