From 7f8ee3d1b1ee317d165b9587aafe49522ab1c20a Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 21 Dec 2006 23:10:20 +0000 Subject: Fixes from Dan McGee and myself * quoting and $() changes * remove a boatload of duplications (previous patching) * added user-based config file ~/.abs.conf (for fun) * fixed CONNMODE usage --- scripts/abs | 54 ++++++++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 36 deletions(-) (limited to 'scripts') diff --git a/scripts/abs b/scripts/abs index 3d8dd728..2ec4322c 100644 --- a/scripts/abs +++ b/scripts/abs @@ -1,6 +1,12 @@ #!/bin/bash -[ -f /etc/abs/abs.conf ] && source /etc/abs/abs.conf +CONFDIR="/etc/abs" +CONNMODE="m" + +[ -f "$CONFDIR/abs.conf" ] && source "$CONFDIR/abs.conf" + +#user based overrides +[ -f ~/.abs.conf ] && source ~/.abs.conf usage() { echo "Arch Build System -- synchronization utility" @@ -14,75 +20,51 @@ usage() { } update() { - cd $ABSROOT + cd "$ABSROOT" for sup in "${SUPFILES[@]}"; do if [ "$sup" != "testing" ]; then if [ "$sup" = "${sup#!}" ]; then - cvsup -L 1 -r 0 -g -b $ABSROOT -c .sup /etc/abs/supfile.$sup + $CVSUP -L 1 -r 0 -g -b "$ABSROOT" -P $CONNMODE -c .sup "$CONFDIR/supfile.$sup" fi elif [ "$sup" = "testing" ]; then - if [ ! -d /var/abs/testing ]; then - mkdir /var/abs/testing; + if [ ! -d "$ABSROOT/testing" ]; then + mkdir "$ABSROOT/testing" fi - cd $ABSROOT/testing - cvsup -L 1 -r 0 -g -b $ABSROOT/testing -c .sup /etc/abs/supfile.testing - cd $ABSROOT + cd "$ABSROOT/testing" + $CVSUP -L 1 -r 0 -g -b "$ABSROOT/testing" -P $CONNMODE -c .sup "$CONFDIR/supfile.testing" + cd "$ABSROOT" fi done } - -update() { - cd $ABSROOT - for sup in "${SUPFILES[@]}"; do - if [ "$sup" = "${sup#!}" ]; then - $CVSUP -L 1 -r 0 -g -b $ABSROOT -P $CONNMODE -c .sup /etc/abs/supfile.$sup - fi - done -} - if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then usage exit 0 fi -if [ ! -d $ABSROOT ]; then +if [ ! -d "$ABSROOT" ]; then echo "abs: $ABSROOT does not exist (or is not a directory)" exit 1 fi -if [ ! -w $ABSROOT ]; then +if [ ! -w "$ABSROOT" ]; then echo "abs: no write permissions in $ABSROOT" exit 1 fi -if [ "`type -p cvsup`" ]; then +if [ "$(type -p cvsup)" ]; then CVSUP="cvsup" -elif [ "`type -p csup`" ]; then +elif [ "$(type -p csup)" ]; then CVSUP="csup" else echo "abs: missing CVS synchronization utility. Install cvsup or csup." exit 1 fi -if [ ! -d "$ABSROOT" ]; then - echo "abs: directory $ABSROOT does not exist" - exit 1 -fi - if [ "$1" = "-p" ] || [ "$1" = "--passive" ]; then CONNMODE="-" shift else CONNMODE="m" - shift -fi - -if [ "$1" = "-p" ] || [ "$1" = "--passive" ]; then - CONNMODE="-" - shift -else - CONNMODE="m" - shift fi if [ "$#" -ne "0" ]; then -- cgit v1.2.3-70-g09d2