#!/bin/sh # The location of the sources SOURCES=sources/equivs # The codename of the archive to import into CODENAME=stderr # Save the root of the repository cd `dirname $0` REPO_ROOT=`pwd` # Create our output dir OUT_DIR=`mktemp -d` || exit 1 cd $OUT_DIR for i in $REPO_ROOT/$SOURCES/*; do BASE=`basename "$i"` if [ -d "$i" ]; then echo "Skipping directory '$BASE'" continue; fi if [ ! -f "$i" ]; then echo "Skipping special file file '$BASE'" continue; fi if [ ! -r "$i" ]; then echo "Skipping non-readable file '$BASE'" continue; fi VERSION=`cat $i | grep "^Version:" | sed "s/^Version: //"` PACKAGE=`cat $i | grep "^Package:" | sed "s/^Package: //"` if [ -z "${PACKAGE}" -o -z "${VERSION}" ]; then echo "Skipping non-equivs file '$BASE'" continue; fi # Find out what the current repostory version is. We simply take the # first of the architectures in the output, since these are # architecture all packages and should have the same version on all # archs. REPO_VERSION=`$REPO_ROOT/reprepro list "${CODENAME}" "${PACKAGE}" | head -1 | cut -d' ' -f 3` if dpkg --compare-versions "${REPO_VERSION}" ge "${VERSION}"; then echo "Not building version $VERSION of $PACKAGE, version $REPO_VERSION already in repository" continue fi echo "Building version $VERSION of $PACKAGE" equivs-build $i || exit 1 # Import the produced deb $REPO_ROOT/reprepro includedeb "${CODENAME}" "${PACKAGE}_${VERSION}_all.deb" || exit 1 done # Conservatively delete our temporary directory (To prevent issues when # $OUT_DIR got set to / for some reason or something like that) cd / rm -f $OUT_DIR/*.deb rmdir $OUT_DIR