prune based on current version

This commit is contained in:
Heavybullets8 2022-12-15 00:04:18 -07:00
parent b27d01fdbe
commit af30249987

View File

@ -18,10 +18,16 @@ export -f sync
prune(){
echo -e "🄿 🅁 🅄 🄽 🄴"
echo "Pruned Docker Images"
version="$(cli -c 'system version' | awk -F '-' '{print $3}' | tr -d " \t\r\.")"
if (( "$version" <= 22120 )); then
if ! cli -c 'app container config prune prune_options={"remove_unused_images": true, "remove_stopped_containers": true}' | head -n -4; then
echo "Failed to Prune Docker Images"
fi
else
if ! docker image prune -af | grep "^Total"; then
echo "Failed to Prune Docker Images"
fi
fi
}
export -f prune