#!/bin/bash # # Helper Script to add packages built by sbuild to the CRCnet archive. # # Licensed under the GPLv2 # # Author: Matt Brown # Version: $Id: add-packages 7 2006-06-09 05:40:02Z mglb1 $ set -e SRCDIR=/home/sbuild/build REPO_BASE_DIR="/home/httpd/packages.crc.net.nz/repository" cd $SRCDIR N=`ls -1 *.changes 2>/dev/null | wc -l` echo "" echo "CRCnet Archive Updater 1.0" echo "" if [ "$N" -eq "0" -a -z "$1" ]; then echo "No packages to add!" exit 0 fi if [ "$N" -gt "0" ]; then echo "The following $N packages will be added to the archive." for package in *.changes; do echo -n ${package/.changes/} DIST=`grep "^Distribution: " $package` ND=`echo $DIST | grep crcnet | wc -l` if [ "$ND" -eq "0" ]; then mv $package $package.disabled-wrong-dist echo " - Removed - Wrong Distribution!" fi echo " - to ${DIST}-testing" done echo -n "Are you sure you want to add these packages? N/y >" while read prompt; do if [ "$prompt" == "y" -o "$prompt" == "Y" ]; then break elif [ "$prompt" == "n" -o "$prompt" == "N" ]; then exit 1 fi echo "Invalid Input!" echo -n "Are you sure you want to add these packages? N/y >" done fi # Run debarchiver for package in *.changes; do DIST=`grep "^Distribution: " $package | cut -f2 -d' '` reprepro -b $REPO_BASE_DIR include ${DIST}-testing $package if [ "$?" == "0" ]; then name=`echo "$package" | cut -f1 -d'_'` rm -f "${name}*" fi done echo "Archive Updated" echo ""