mirror of
https://github.com/moparisthebest/pacman
synced 2024-10-31 15:45:03 -04:00
ecb594107e
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
120 lines
3.2 KiB
Bash
120 lines
3.2 KiB
Bash
#!/bin/bash
|
|
#
|
|
# abs - download a PKGBUILD tree from a CVS repository
|
|
# @configure_input@
|
|
#
|
|
# 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.
|
|
#
|
|
|
|
# gettext initialization
|
|
export TEXTDOMAIN='pacman'
|
|
export TEXTDOMAINDIR='@localedir@'
|
|
|
|
myver='@PACKAGE_VERSION@'
|
|
CONFDIR="@sysconfdir@/abs"
|
|
CONNMODE="m"
|
|
|
|
[ -f "$CONFDIR/abs.conf" ] && source "$CONFDIR/abs.conf"
|
|
|
|
#user based overrides
|
|
[ -f ~/.abs.conf ] && source ~/.abs.conf
|
|
|
|
usage() {
|
|
printf "abs (pacman) %s\n" "$myver"
|
|
echo
|
|
printf "$(gettext "Usage: %s [-p] [repository1 [repository2 ...]]")\n" "$0"
|
|
echo
|
|
printf "$(gettext "abs will synchronize PKGBUILD scripts from the CVS repository")\n"
|
|
printf "$(gettext "into %s. You can follow different package trees by")\n" "$ABSROOT"
|
|
printf "$(gettext "editing %s files. If no argument is given, abs")\n" "$CONFDIR/supfile.*"
|
|
printf "$(gettext "will synchronize from supfiles specified in %s.")\n" "$CONFDIR/abs.conf"
|
|
printf "$(gettext "If -p is specified, the connection is opened in passive mode.")\n"
|
|
echo
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
update() {
|
|
cd "$ABSROOT"
|
|
for sup in "${SUPFILES[@]}"; do
|
|
if [ "$sup" != "testing" ]; then
|
|
if [ "$sup" = "${sup#!}" ]; then
|
|
$CVSUP -L 1 -r 0 -g -b "$ABSROOT" -P $CONNMODE -c .sup "$CONFDIR/supfile.$sup"
|
|
fi
|
|
elif [ "$sup" = "testing" ]; then
|
|
if [ ! -d "$ABSROOT/testing" ]; then
|
|
mkdir "$ABSROOT/testing"
|
|
fi
|
|
cd "$ABSROOT/testing"
|
|
$CVSUP -L 1 -r 0 -g -b "$ABSROOT/testing" -P $CONNMODE -c .sup "$CONFDIR/supfile.testing"
|
|
cd "$ABSROOT"
|
|
fi
|
|
done
|
|
}
|
|
|
|
if [ "$1" = "-h" -o "$1" = "--help" ]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$1" = "-V" -o "$1" = "--version" ]; then
|
|
version
|
|
exit 0
|
|
fi
|
|
|
|
if [ ! -d "$ABSROOT" ]; then
|
|
echo "$(gettext "abs: %s does not exist (or is not a directory).")" "$ABSROOT"
|
|
exit 1
|
|
fi
|
|
if [ ! -w "$ABSROOT" ]; then
|
|
echo "$(gettext "abs: no write permissions in %s.")" "$ABSROOT"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$(type -p cvsup)" ]; then
|
|
CVSUP="cvsup"
|
|
elif [ "$(type -p csup)" ]; then
|
|
CVSUP="csup"
|
|
else
|
|
echo "$(gettext "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
|
|
# vim: set ts=2 sw=2 noet:
|