diff options
author | Aaron Griffin <aaron@archlinux.org> | 2006-12-22 00:10:20 +0100 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2006-12-22 00:10:20 +0100 |
commit | 7f8ee3d1b1ee317d165b9587aafe49522ab1c20a (patch) | |
tree | 7fd426ac8ec63fbe13da69dce9c9ca8e2597a788 | |
parent | 3e3f30a212748d79dabec83d2182132741e0d898 (diff) | |
download | pacman-7f8ee3d1b1ee317d165b9587aafe49522ab1c20a.tar.gz pacman-7f8ee3d1b1ee317d165b9587aafe49522ab1c20a.tar.xz |
Fixes from Dan McGee <dpmcgee@gmail.com> and myself
* quoting and $() changes
* remove a boatload of duplications (previous patching)
* added user-based config file ~/.abs.conf (for fun)
* fixed CONNMODE usage
-rw-r--r-- | scripts/abs | 54 |
1 files changed, 18 insertions, 36 deletions
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 |