From 82dcc19ff9b2da486e1fe45621da3303add921d8 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 4 Mar 2012 22:38:07 +0100 Subject: commitpkg: Add ability to override the server This might be useful for unofficial repos --- commitpkg.in | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/commitpkg.in b/commitpkg.in index 4ce0f7b..81af1c6 100644 --- a/commitpkg.in +++ b/commitpkg.in @@ -42,7 +42,7 @@ pkgbase=${pkgbase:-$pkgname} case "$cmd" in commitpkg) if (( $# == 0 )); then - die 'usage: commitpkg [-l limit] [-a arch] [commit message]' + die 'usage: commitpkg [-s server] [-l limit] [-a arch] [commit message]' fi repo="$1" shift @@ -51,20 +51,10 @@ case "$cmd" in repo="${cmd%pkg}" ;; *) - die 'usage: commitpkg [-l limit] [-a arch] [commit message]' + die 'usage: commitpkg [-s server] [-l limit] [-a arch] [commit message]' ;; esac -case "$repo" in - core|extra|testing|staging|kde-unstable|gnome-unstable) - server='gerolde.archlinux.org' ;; - community*|multilib*) - server='aur.archlinux.org' ;; - *) - server='gerolde.archlinux.org' - msg "Non-standard repository $repo in use, defaulting to server $server" ;; -esac - # check if all local source files are under version control for s in "${source[@]}"; do if [[ $s != *://* ]] && ! svn status -v "$s" | grep -q '^[ AMRX~]'; then @@ -83,10 +73,10 @@ for i in 'changelog' 'install'; do done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) done -# see if any limit options were passed, we'll send them to rsync rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y) -while getopts ':l:a:' flag; do +while getopts ':l:a:s:' flag; do case $flag in + s) server=$2 ;; l) rsyncopts+=("--bwlimit=$2") ;; a) commit_arch=$2 ;; :) die "Option requires an argument -- '$OPTARG'" ;; @@ -95,6 +85,18 @@ while getopts ':l:a:' flag; do done shift $(( OPTIND - 1 )) +if [[ -z $server ]]; then + case "$repo" in + core|extra|testing|staging|kde-unstable|gnome-unstable) + server='gerolde.archlinux.org' ;; + community*|multilib*) + server='aur.archlinux.org' ;; + *) + server='gerolde.archlinux.org' + msg "Non-standard repository $repo in use, defaulting to server $server" ;; + esac +fi + if [[ -n $(svn status -q) ]]; then msgtemplate="upgpkg: $pkgbase $(get_full_version)"$'\n\n' if [[ -n $1 ]]; then -- cgit v1.2.3-70-g09d2