2006-12-05 02:30:15 -05:00
|
|
|
#!/bin/bash
|
2007-04-11 17:04:51 -04:00
|
|
|
#
|
|
|
|
# abs
|
|
|
|
#
|
|
|
|
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
|
|
# USA.
|
|
|
|
#
|
2006-12-05 02:30:15 -05:00
|
|
|
|
2007-04-11 15:53:43 -04:00
|
|
|
myver='@PACKAGE_VERSION@'
|
2006-12-21 18:10:20 -05:00
|
|
|
CONFDIR="/etc/abs"
|
|
|
|
CONNMODE="m"
|
|
|
|
|
|
|
|
[ -f "$CONFDIR/abs.conf" ] && source "$CONFDIR/abs.conf"
|
|
|
|
|
|
|
|
#user based overrides
|
|
|
|
[ -f ~/.abs.conf ] && source ~/.abs.conf
|
2006-12-05 02:30:15 -05:00
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "Arch Build System -- synchronization utility"
|
|
|
|
echo "usage: $0 [-p] [repository1 [repository2 ...]]"
|
|
|
|
echo
|
|
|
|
echo "abs will synchronize PKGBUILD scripts from the CVS repository"
|
|
|
|
echo "into $ABSROOT. You can follow different package trees by"
|
|
|
|
echo "editing /etc/abs/supfile.* files. If no argument is given, abs "
|
|
|
|
echo "will synchronize from supfiles specified in /etc/abs/abs.conf."
|
|
|
|
echo "If -p is specified, the connection is opened in passive mode."
|
|
|
|
}
|
|
|
|
|
2007-04-11 15:53:43 -04:00
|
|
|
version() {
|
|
|
|
printf "abs (pacman) %s\n" "$myver"
|
|
|
|
printf "Copyright (C) 2002-2007 Judd Vinet <jvinet@zeroflux.org>.\n"
|
|
|
|
echo
|
|
|
|
printf "This is free software; see the source for copying conditions.\n"
|
|
|
|
printf "There is NO WARRANTY, to the extent permitted by law.\n"
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2006-12-05 02:30:15 -05:00
|
|
|
update() {
|
2006-12-21 18:10:20 -05:00
|
|
|
cd "$ABSROOT"
|
2006-12-20 20:53:40 -05:00
|
|
|
for sup in "${SUPFILES[@]}"; do
|
|
|
|
if [ "$sup" != "testing" ]; then
|
|
|
|
if [ "$sup" = "${sup#!}" ]; then
|
2006-12-21 18:10:20 -05:00
|
|
|
$CVSUP -L 1 -r 0 -g -b "$ABSROOT" -P $CONNMODE -c .sup "$CONFDIR/supfile.$sup"
|
2006-12-20 20:53:40 -05:00
|
|
|
fi
|
|
|
|
elif [ "$sup" = "testing" ]; then
|
2006-12-21 18:10:20 -05:00
|
|
|
if [ ! -d "$ABSROOT/testing" ]; then
|
|
|
|
mkdir "$ABSROOT/testing"
|
2006-12-20 20:53:40 -05:00
|
|
|
fi
|
2006-12-21 18:10:20 -05:00
|
|
|
cd "$ABSROOT/testing"
|
|
|
|
$CVSUP -L 1 -r 0 -g -b "$ABSROOT/testing" -P $CONNMODE -c .sup "$CONFDIR/supfile.testing"
|
|
|
|
cd "$ABSROOT"
|
2006-12-20 20:53:40 -05:00
|
|
|
fi
|
|
|
|
done
|
2006-12-05 02:30:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2007-04-11 15:53:43 -04:00
|
|
|
if [ "$1" = "-V" ] || [ "$1" = "--version" ]; then
|
|
|
|
version
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2006-12-21 18:10:20 -05:00
|
|
|
if [ ! -d "$ABSROOT" ]; then
|
2006-12-05 02:30:15 -05:00
|
|
|
echo "abs: $ABSROOT does not exist (or is not a directory)"
|
|
|
|
exit 1
|
|
|
|
fi
|
2006-12-21 18:10:20 -05:00
|
|
|
if [ ! -w "$ABSROOT" ]; then
|
2006-12-05 02:30:15 -05:00
|
|
|
echo "abs: no write permissions in $ABSROOT"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2006-12-21 18:10:20 -05:00
|
|
|
if [ "$(type -p cvsup)" ]; then
|
2006-12-05 02:30:15 -05:00
|
|
|
CVSUP="cvsup"
|
2006-12-21 18:10:20 -05:00
|
|
|
elif [ "$(type -p csup)" ]; then
|
2006-12-05 02:30:15 -05:00
|
|
|
CVSUP="csup"
|
|
|
|
else
|
|
|
|
echo "abs: missing CVS synchronization utility. Install cvsup or csup."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "-p" ] || [ "$1" = "--passive" ]; then
|
|
|
|
CONNMODE="-"
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
CONNMODE="m"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$#" -ne "0" ]; then
|
|
|
|
SUPFILES=("$@")
|
|
|
|
fi
|
|
|
|
|
|
|
|
update
|
|
|
|
|
|
|
|
exit 0
|
2006-12-20 20:53:40 -05:00
|
|
|
# vim: set ts=2 sw=2 noet:
|