aboutsummaryrefslogtreecommitdiffstats
path: root/modules/draklive/files
diff options
context:
space:
mode:
Diffstat (limited to 'modules/draklive/files')
-rwxr-xr-xmodules/draklive/files/clean-live.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/draklive/files/clean-live.sh b/modules/draklive/files/clean-live.sh
new file mode 100755
index 00000000..cceb6a4a
--- /dev/null
+++ b/modules/draklive/files/clean-live.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# clean old draklive build sets
+DRAKLIVE_ROOT=/var/lib/draklive
+RM="rm -rf"
+
+# keep only chroot/build sets from previous day
+MAX_BUILD_AGE=1
+find $DRAKLIVE_ROOT/{chroot/*,build/*/*} -maxdepth 0 -not -name dist -mtime +$(expr $MAX_BUILD_AGE - 1) -exec $RM {} \;
+
+# keep dist (iso + lists) for all sets during 20 days
+MAX_DIST_AGE=20
+find $DRAKLIVE_ROOT/build/*/dist -maxdepth 0 -mtime +$(expr $MAX_DIST_AGE - 1) -exec $RM {} \;
+
+find $DRAKLIVE_ROOT/build -maxdepth 1 -links 2 -exec rmdir {} \;