2012-12-06 16:48:10 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2013-05-23 20:24:14 +00:00
|
|
|
set -e
|
|
|
|
|
2012-12-06 16:48:10 +00:00
|
|
|
trash=/data/releases/.trash
|
|
|
|
mkdir -p $trash
|
|
|
|
|
|
|
|
# Remove garbage temporary directories.
|
|
|
|
find /data/releases/nixos/ /data/releases/nixpkgs/ -maxdepth 1 -name ".tmp*" -mtime +7 | while read rel; do
|
2012-12-10 18:22:46 +00:00
|
|
|
echo "removing temporary directory $rel" >&2
|
2012-12-06 16:48:10 +00:00
|
|
|
mv $rel $trash/
|
|
|
|
done
|
|
|
|
|
|
|
|
# Remove old NixOS releases.
|
2014-12-09 12:42:06 +00:00
|
|
|
find /data/releases/nixos/unstable/ /data/releases/nixos/unstable-small/ /data/releases/nixos/??.??/ /data/releases/nixos/??.??-small/ -maxdepth 1 -name "nixos-*pre*" -mtime +7 | sort | while read rel; do
|
2012-12-06 16:48:10 +00:00
|
|
|
if [ -e $rel/keep ]; then
|
2012-12-10 18:22:46 +00:00
|
|
|
echo "keeping NixOS release $rel" >&2
|
2012-12-06 16:48:10 +00:00
|
|
|
continue
|
|
|
|
fi
|
2012-12-10 18:22:46 +00:00
|
|
|
echo "removing old NixOS release $rel" >&2
|
2014-12-09 12:42:06 +00:00
|
|
|
dst=$trash/$(basename $(dirname $rel))
|
|
|
|
mkdir -p $dst
|
|
|
|
mv $rel $dst/
|
2012-12-06 16:48:10 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# Remove old Nixpkgs releases.
|
|
|
|
find /data/releases/nixpkgs/ -maxdepth 1 -name "nixpkgs-*pre*" -mtime +30 | sort | while read rel; do
|
|
|
|
if [ -e $rel/keep ]; then
|
2012-12-10 18:22:46 +00:00
|
|
|
echo "keeping Nixpkgs release $rel" >&2
|
2012-12-06 16:48:10 +00:00
|
|
|
continue
|
|
|
|
fi
|
2012-12-10 18:22:46 +00:00
|
|
|
echo "removing old Nixpkgs release $rel" >&2
|
2012-12-06 16:48:10 +00:00
|
|
|
mv $rel $trash/
|
|
|
|
done
|
|
|
|
|
2013-10-09 09:02:09 +00:00
|
|
|
exit 0
|
|
|
|
|
2012-12-10 18:22:46 +00:00
|
|
|
# Remove unreferenced NARs/patches (but only if they're older than 2
|
|
|
|
# weeks, to prevent messing with binary patch generation in progress).
|
|
|
|
./print-dead-files.pl /data/releases/patches/all-patches $(find /data/releases/nix* /data/releases/patchelf -name MANIFEST | grep -v '\.trash' | grep -v '\.tmp') \
|
|
|
|
| xargs -d '\n' sh -c 'find "$@" -mtime +14 -print' \
|
2012-12-06 16:48:10 +00:00
|
|
|
| xargs -d '\n' mv -v --target-directory=$trash
|