3 # abs - download a PKGBUILD tree from a CVS repository
5 # Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # E_OK : Everything worked :)
25 # E_MISSING_PROGRAM : A program the script depends on is not installed.
26 # E_CONFIG_ERROR : Missing/incorrect configuration.
27 # E_INVALID_OPTION : User has passed unknown/invalid option to script.
31 BUG_REPORT_EMAIL
='pacman-dev@archlinux.org'
32 eval CONFDIR
="~/abs/conf"
36 if [ -r "$CONFDIR/abs.conf" ]; then
37 source "$CONFDIR/abs.conf"
40 # User based overrides
41 if [ -r ~
/.abs.conf
]; then
48 printf "==> ${mesg}\n" "$@" >&2
53 printf "==> ERROR: ${mesg}\n" "$@" >&2
58 printf "abs (pacman) %s - download a PKGBUILD tree from a CVS repository\n\n" "$myver"
59 printf "Usage %s [options] [repository...]\n\n" "$0"
61 printf " -p, --passive The connection is opened in passive mode.\n"
63 printf " -h, --help Display this help message then exit.\n"
64 printf " -V, --version Display version information then exit.\n"
67 abs will synchronize build scripts from the CVS repository\n\
68 into %s. You can follow different package trees by\n\
69 editing %s files. If no argument is given, abs\n\
70 will synchronize from supfiles specified in %s.\n\n" \
71 "$ABSROOT" "$CONFDIR/supfile.*" "$CONFDIR/abs.conf"
72 printf "Report bugs to <%s>.\n" "$BUG_REPORT_EMAIL"
76 printf "abs (pacman) %s\n" "$myver"
78 Copyright (C) 2002-2007 Judd Vinet <jvinet@zeroflux.org>.\n\n\
79 This is free software; see the source for copying conditions.\n\
80 There is NO WARRANTY, to the extent permitted by law.\n"
87 trap 'error "TERM signal caught. Exiting..."; exit 1' TERM HUP QUIT
88 trap 'error "Aborted by user! Exiting..."; exit 1' INT
89 trap 'error "An unknown error has occured. Exiting..."; exit 1' ERR
92 # Parse Command Line Options.
94 OPT_LONG
="help,passive,version"
95 OPT_TEMP
="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$
(basename "$0")" -- "$@
" || echo 'GETOPT GO BANG!')"
96 if echo "$OPT_TEMP" |
grep -q 'GETOPT GO BANG!'; then
97 # This is a small hack to stop the script bailing with 'set -e'
98 echo; usage
; exit 1 # E_INVALID_OPTION;
100 eval set -- "$OPT_TEMP"
101 unset OPT_SHORT OPT_LONG OPT_TEMP
105 -p|
--passive) PASSIVE
='-';;
107 -h|
--help) usage
; exit 0;; # E_OK
108 -V|
--version) version
; exit 0;; # E_OK
110 --) OPT_IND
=0; shift; break;;
111 *) usage
; exit 1;; # E_INVALID_OPTION
116 if [ $# -gt 0 ]; then
121 # Check permissions and programs.
122 if [ ! -d "$ABSROOT" ]; then
123 error
"%s does not exist or is not a directory." "$ABSROOT"
124 exit 1 # E_CONFIG_ERROR
125 elif [ ! -w "$ABSROOT" ]; then
126 error
"You do not have write permissions in %s." "$ABSROOT"
127 exit 1 # E_CONFIG_ERROR
131 if [ "$(type -p csup)" ]; then
133 elif [ "$(type -p cvsup)" ]; then
136 error
"Missing CVS synchronization utility. Install csup or cvsup."
137 exit 1 # E_MISSING_PROGRAM
142 for sup
in ${SUPFILES[@]}; do
145 if [ ! -d "$ABSROOT/$sup" ]; then
146 mkdir
"$ABSROOT/$sup"
148 workdir
="$ABSROOT/$sup"
152 if [ "$sup" != "${sup#!}" ]; then
159 msg
"Updating %s..." "$sup"
161 echo $CVSUP -L 1 -r 0 -g -b "$workdir" -P "$PASSIVE" -c .sup
"$CONFDIR/supfile.$sup"
162 $CVSUP -L 1 -r 0 -g -b "$workdir" -P "$PASSIVE" -c .sup
"$CONFDIR/supfile.$sup"
167 # vim: set ts=2 sw=2 noet: