Skip to content
Snippets Groups Projects
Commit 2db5e985 authored by Holger Levsen's avatar Holger Levsen
Browse files

r.d.n: add script to work around/implement a missing feature of debrebuild

parent 239fd5a1
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
#
# Copyright 2025 Holger Levsen (holger@layer-acht.org)
# released under the GPLv2
CACHE=~rebuilderd/cache
if [ ! -d $CACHE ] ; then
echo "$CACHE does not exist."
exit 1
fi
case $HOSTNAME in
ionos17*) LIMIT=50 ;;
codethink*) LIMIT=20 ;;
osuosl*) LIMIT=333 ;;
infom07*) LIMIT=200 ;; # FIXME: drop extra partition again?
infom08*) LIMIT=100 ;;
riscv64*) LIMIT=180 ;;
*) echo "Limit for $HOSTNAME not defined."
exit 1 ;;
esac
# delete 1000 oldest files
# FIXME: use atime, but then, this script should not exist in the first place... :)
find $CACHE -type f -printf '%T+ %p\n' | sort | head -n 1000|cut -d ' ' -f2-|xargs sudo rm
set -e
set -o pipefail
SIZE=$(du -sh $CACHE | grep G | cut -d 'G' -f 1)
if [ $SIZE -gt $LIMIT ] ; then
echo "$CACHE is still ${SIZE}G, reducing further."
$0
else
echo "$CACHE is ${SIZE}G, voila."
fi
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment