#!/bin/bash

set -o nounset

dist=$1
for i in ${dist}; do
	echo Processing ${i}
	for snap in $(find dists/${i}/snapshots -maxdepth 1 -type d -ctime +14 -printf '%f\n'); do
		reprepro unreferencesnapshot ${i} ${snap}
		rm -r dists/${i}/snapshots/${snap}
	done
	reprepro deleteunreferenced
done
