From 2b6bc5bcda7de08507df82cc2a275f7cd4a4e3c4 Mon Sep 17 00:00:00 2001 From: Andrew Fyfe Date: Wed, 11 Apr 2007 20:53:43 +0100 Subject: autotool scripts/abs - move scripts/abs -> scripts/abs.in - add -V --version options to scripts/abs.in - add autotool commands to generate scripts/abs Signed-off-by: Andrew Fyfe --- configure.ac | 1 + scripts/Makefile.am | 2 +- scripts/abs | 77 -------------------------------------------- scripts/abs.in | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 78 deletions(-) delete mode 100755 scripts/abs create mode 100755 scripts/abs.in diff --git a/configure.ac b/configure.ac index 3ee1567a..4aad0aa7 100644 --- a/configure.ac +++ b/configure.ac @@ -217,6 +217,7 @@ src/pacman/Makefile src/pacman/po/Makefile.in src/util/Makefile scripts/Makefile +scripts/abs scripts/makepkg doc/Makefile etc/Makefile diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 3e81b8cc..58312e0a 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -13,7 +13,7 @@ bin_SCRIPTS = \ repo-remove \ updatesync -EXTRA_DIST = abs \ +EXTRA_DIST = abs.in \ gensync \ makepkg.in \ makeworld \ diff --git a/scripts/abs b/scripts/abs deleted file mode 100755 index 2ec4322c..00000000 --- a/scripts/abs +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -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" - 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." -} - -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" ] || [ "$1" = "--help" ]; then - usage - exit 0 -fi - -if [ ! -d "$ABSROOT" ]; then - echo "abs: $ABSROOT does not exist (or is not a directory)" - exit 1 -fi -if [ ! -w "$ABSROOT" ]; then - echo "abs: no write permissions in $ABSROOT" - exit 1 -fi - -if [ "$(type -p cvsup)" ]; then - CVSUP="cvsup" -elif [ "$(type -p csup)" ]; then - 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 -# vim: set ts=2 sw=2 noet: diff --git a/scripts/abs.in b/scripts/abs.in new file mode 100755 index 00000000..76040270 --- /dev/null +++ b/scripts/abs.in @@ -0,0 +1,92 @@ +#!/bin/bash + +myver='@PACKAGE_VERSION@' +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" + 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." +} + +version() { + printf "abs (pacman) %s\n" "$myver" + printf "Copyright (C) 2002-2007 Judd Vinet .\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" ] || [ "$1" = "--help" ]; then + usage + exit 0 +fi + +if [ "$1" = "-V" ] || [ "$1" = "--version" ]; then + version + exit 0 +fi + +if [ ! -d "$ABSROOT" ]; then + echo "abs: $ABSROOT does not exist (or is not a directory)" + exit 1 +fi +if [ ! -w "$ABSROOT" ]; then + echo "abs: no write permissions in $ABSROOT" + exit 1 +fi + +if [ "$(type -p cvsup)" ]; then + CVSUP="cvsup" +elif [ "$(type -p csup)" ]; then + 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 +# vim: set ts=2 sw=2 noet: -- cgit v1.2.3-24-g4f1b