summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xonce/update.sh28
1 files changed, 25 insertions, 3 deletions
diff --git a/once/update.sh b/once/update.sh
index 6962973..d93a461 100755
--- a/once/update.sh
+++ b/once/update.sh
@@ -21,6 +21,10 @@ if [ "$tarballs" = '/updates/*.tar.gz' ]; then
exit 0
fi
+if [ -f /etc/vendor.cfg ]; then
+ . /etc/vendor.cfg
+fi
+
for tarball in $tarballs; do
tarball="${tarball##*/}"
@@ -38,9 +42,27 @@ for tarball in $tarballs; do
pkgdir=/tarballs/archive/${tarball%%.tar.gz}/
mkdir -p $pkgdir
printf '%s\n' "$pkgsig" >> ${pkgdir}/pkgsigs.log
- pkgdir=$pkgdir/$pkgsig/
- mkdir -p $pkgdir
- mv /tarballs/$tarball $pkgdir
+ mkdir -p $pkgdir/$pkgsig/
+ mv /tarballs/$tarball $pkgdir/$pkgsig/
+
+ case ${keep:-'-1'} in
+ -1 )
+ ;;
+
+ * )
+ tail -n ${keep} ${pkgdir}/pkgsigs.log > ${pkgdir}/pkgsigs.keep
+
+ for pkgsigdir in ${pkgdir}/*; do
+ if [ -d $pkgsigdir ]; then
+ if ! grep ${pkgsigdir##*/} ${pkgdir}/pkgsigs.keep; then
+ rm $pkgsigdir/$tarball
+ rmdir $pkgsigdir
+ fi
+ fi
+ done
+
+ ;;
+ esac
fi
echo caching the current $tarball