#!/bin/bash # # This script updates a "simple" debian repository consisting of a binary and # source directory. # See: http://www.debian.org/doc/manuals/repository-howto/repository-howto # # It has been created for the expand project and should be run on the # repository available at # http://www.aui.computing.edu.au/projects/Expand/debian # # Wilson Waters 11-1-2006 # this defines where dpkg is installed. Will usually be /usr for a debian # system, though for a non-debian system you may install it all elsewhere # uncomment it to use something else #DPKG_INSTALL_DIR=/usr/data/tango/web/aui/web_docs/projects/Expand/dpkg REPOSITORY_HOST="hammer.cs.curtin.edu.au" REPOSITORY_USER="12028421" REPOSITORY_BASE_DIR="/usr/data/tango/web/aui/web_docs/projects/Expand/debian" CVS_REPOSITORY="debianRepository" #-------------------------------END USER CONFIG------------------------------ #place the dpkg bins in our current path if [ -z $DPKG_INSTALL_DIR ]; then PATH=$PATH:${DPKG_INSTALL_DIR}/bin fi # make sure we are where we should be if [ ! -d ./binary -a ! -d ./source ]; then echo "In wrong directory!"; exit 1; fi # update the package lists dpkg-scansources source /dev/null | gzip -9c > source/Sources.gz allDirs=`find . -maxdepth 1 -type d` for dist in $allDirs; do if [ $dist == "./CVS" -o $dist == "." -o $dist == "./source" ]; then # do nothing echo else echo "\nScanning binary packages for $dist" dpkg-scanpackages $dist /dev/null | gzip -9c > $dist/Packages.gz fi done # now copy everything to the repository echo "" echo "Removing old repository from $REPOSITORY_HOST, enter your password:" remoteCommand="rm -rf $REPOSITORY_BASE_DIR/*" /usr/bin/ssh $REPOSITORY_USER@$REPOSITORY_HOST "$remoteCommand" echo "Recursively copying repository to $REPOSITORY_HOST, enter your password:" /usr/bin/scp -r * $REPOSITORY_USER@$REPOSITORY_HOST:$REPOSITORY_BASE_DIR/ echo " done." echo "" echo "Cleaning up repository on $REPOSITORY_HOST, enter your password:" remoteCommand="find $REPOSITORY_BASE_DIR/ -type d -name CVS -exec rm -rf {} \;" /usr/bin/ssh $REPOSITORY_USER@$REPOSITORY_HOST "$remoteCommand" # update changes in cvs! # check if we need to commit changes to the CVS if [ -n $CVSROOT -a -n $CVS_REPOSITORY ]; then echo "Comiting all changes to the CVS repository. Make sure you have 'cvs add\'ed any new files" echo "Note the changes you have made next:" cvs commit else echo "The CVSROOT or CVS_REPOSITORY variables were not set." echo "Not updating the CVS repository" fi