--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import re
+import pwd
+import sys
+import errno
+import datetime
+import subprocess
+import time
+import fileinput
+import psycopg2
+from common_code import *
+from cidb import *
+
+logger = logger_init()
+
+def keep_liveboot(name):
+ con = db_connect()
+ cur = con.cursor()
+ try:
+ cur.execute("SELECT keep_image FROM liveboot WHERE build_name = '%s'" % (name))
+ except psycopg2.DatabaseError as e:
+ logger.debug("SELECT keep_image FROM liveboot WHERE build_name = '%s' and keep_image = true" % (name))
+ return False
+ if cur.fetchone():
+ return True
+
+
--- /dev/null
+#!/bin/bash
+
+# copyright 2012 Holger Levsen <holger@layer-acht.org>
+# GPL2 licenced
+
+set -x
+export
+
+# some settings
+AMOUNT_TO_KEEP=15
+KEPT=0
+
+for DIRECTORY in $(ls -1r) ; do
+ echo -n $DIRECTORY
+ if ! ./keep_liveboot.py "$DIRECTORY" && [ $KEPT -le $AMOUNT_TO_KEEP ] ; then
+ echo we can delete this one
+ else
+ echo keep it
+ let "KEPT=KEPT+1"
+ fi
+done