From af302499879a487433fab0e4c12c675e988d1147 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 15 Dec 2022 00:04:18 -0700 Subject: [PATCH] prune based on current version --- functions/misc.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 5c75583b..7f4f51de 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -18,9 +18,15 @@ export -f sync prune(){ echo -e "🄿 🅁 🅄 🄽 🄴" -echo "Pruned Docker Images" -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" +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