#!/bin/sh # # ports(8) driver for subversion # # create a file with the name .svn into your /etc/ports # # ---------------------------------------------------------- # ROOT_DIR=/usr/ports # URL=svn://svn.berlios.de/clc/x86/tags/CRUX-2_1/base # COLLECTION=base # USER= # PASS= # ---------------------------------------------------------- # this will create a directory called '$COLLECTION' in '$ROOT_DIR' # with the contents of $URL # 'USER' and 'PASS' can contain username and password if this is required if [ $# -ne 1 ]; then echo "usage: $0 " >&2 exit 1 fi . $1 if [ -z "$ROOT_DIR" ]; then echo "ROOT_DIR not set in '$1'" >&2 exit 2 fi if [ -z "$COLLECTION" ]; then echo "COLLECTION not set in '$1'" >&2 exit 2 fi if [ -z "$URL" ]; then echo "URL not set in '$1'" >&2 exit 2 fi if [ ! -d "$ROOT_DIR" ]; then echo "NOTICE: ROOT_DIR '$ROOT_DIR' does not exist. Trying to create." mkdir -p $ROOT_DIR if [ "$?" != "0" ]; then echo "Failed to create '$ROOT_DIR', exiting." exit 3 fi fi if [ -d $ROOT_DIR/$COLLECTION ] && [ ! -d $ROOT_DIR/$COLLECTION/.svn ]; then echo "$ROOT_DIR/$COLLECTION is not a subversion; deleting" rm -rf $ROOT_DIR/$COLLECTION fi if [ ! -z "$USER" ]; then USER="--username $USER" fi if [ ! -z "$PASS" ]; then PASS="--password $PASS" fi echo "Connection to $URL" echo "Updating collection $COLLECTION" if [ -d $ROOT_DIR/$COLLECTION ]; then svn $USER $PASS update $ROOT_DIR/$COLLECTION|\ sed -e 's|^| |g'|sed -e '/At revision.*/d' else svn $USER $PASS co $URL $ROOT_DIR/$COLLECTION|\ sed -e 's|^| |g'|sed -e '/At revision.*/d' fi echo "Finished successfully"