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
This commit is contained in:
Aaron Griffin 2006-12-21 23:10:20 +00:00
parent 3e3f30a212
commit 7f8ee3d1b1

View file

@ -1,6 +1,12 @@
#!/bin/bash #!/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() { usage() {
echo "Arch Build System -- synchronization utility" echo "Arch Build System -- synchronization utility"
@ -14,29 +20,19 @@ usage() {
} }
update() { update() {
cd $ABSROOT cd "$ABSROOT"
for sup in "${SUPFILES[@]}"; do for sup in "${SUPFILES[@]}"; do
if [ "$sup" != "testing" ]; then if [ "$sup" != "testing" ]; then
if [ "$sup" = "${sup#!}" ]; 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 fi
elif [ "$sup" = "testing" ]; then elif [ "$sup" = "testing" ]; then
if [ ! -d /var/abs/testing ]; then if [ ! -d "$ABSROOT/testing" ]; then
mkdir /var/abs/testing; mkdir "$ABSROOT/testing"
fi fi
cd $ABSROOT/testing cd "$ABSROOT/testing"
cvsup -L 1 -r 0 -g -b $ABSROOT/testing -c .sup /etc/abs/supfile.testing $CVSUP -L 1 -r 0 -g -b "$ABSROOT/testing" -P $CONNMODE -c .sup "$CONFDIR/supfile.testing"
cd $ABSROOT 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 fi
done done
} }
@ -46,43 +42,29 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
exit 0 exit 0
fi fi
if [ ! -d $ABSROOT ]; then if [ ! -d "$ABSROOT" ]; then
echo "abs: $ABSROOT does not exist (or is not a directory)" echo "abs: $ABSROOT does not exist (or is not a directory)"
exit 1 exit 1
fi fi
if [ ! -w $ABSROOT ]; then if [ ! -w "$ABSROOT" ]; then
echo "abs: no write permissions in $ABSROOT" echo "abs: no write permissions in $ABSROOT"
exit 1 exit 1
fi fi
if [ "`type -p cvsup`" ]; then if [ "$(type -p cvsup)" ]; then
CVSUP="cvsup" CVSUP="cvsup"
elif [ "`type -p csup`" ]; then elif [ "$(type -p csup)" ]; then
CVSUP="csup" CVSUP="csup"
else else
echo "abs: missing CVS synchronization utility. Install cvsup or csup." echo "abs: missing CVS synchronization utility. Install cvsup or csup."
exit 1 exit 1
fi fi
if [ ! -d "$ABSROOT" ]; then
echo "abs: directory $ABSROOT does not exist"
exit 1
fi
if [ "$1" = "-p" ] || [ "$1" = "--passive" ]; then if [ "$1" = "-p" ] || [ "$1" = "--passive" ]; then
CONNMODE="-" CONNMODE="-"
shift shift
else else
CONNMODE="m" CONNMODE="m"
shift
fi
if [ "$1" = "-p" ] || [ "$1" = "--passive" ]; then
CONNMODE="-"
shift
else
CONNMODE="m"
shift
fi fi
if [ "$#" -ne "0" ]; then if [ "$#" -ne "0" ]; then