Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/repo-remove.sh.in
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-05-09 19:26:57 -0500
committerDan McGee <dan@archlinux.org>2008-05-10 00:48:55 -0500
commit2edd01a973f9695b6bb918ccdbaabd004058f578 (patch)
tree706e531c88058394fde63ca27de11d770acb41f1 /scripts/repo-remove.sh.in
parent502645c0e304a8ee062d8da7f162ff4c195e6be8 (diff)
scripts: add -q/--quiet option to repo-add and repo-remove
They are pretty noisy scripts in their normal course of operations, so allow all messages to be squashed except for warning and error messages with this new flag. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts/repo-remove.sh.in')
-rw-r--r--scripts/repo-remove.sh.in16
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts/repo-remove.sh.in b/scripts/repo-remove.sh.in
index 47a0d5ae..08786eec 100644
--- a/scripts/repo-remove.sh.in
+++ b/scripts/repo-remove.sh.in
@@ -3,7 +3,7 @@
# repo-remove - remove a package entry from a given repo database file
# @configure_input@
#
-# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
+# Copyright (c) 2007-2008 Dan McGee <dan@archlinux.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
@@ -25,14 +25,17 @@ export TEXTDOMAINDIR='@localedir@'
myver='@PACKAGE_VERSION@'
confdir='@sysconfdir@'
+QUIET=0
REPO_DB_FILE=""
msg() {
+ [ $QUIET -ne 0 ] && return
local mesg=$1; shift
printf "==> ${mesg}\n" "$@" >&1
}
msg2() {
+ [ $QUIET -ne 0 ] && return
local mesg=$1; shift
printf " -> ${mesg}\n" "$@" >&1
}
@@ -50,18 +53,21 @@ error() {
# print usage instructions
usage() {
printf "$(gettext "repo-remove %s\n\n")" $myver
- printf "$(gettext "usage: %s <path-to-db> <packagename> ...\n\n")" "$0"
+ printf "$(gettext "usage: %s [-q] <path-to-db> <packagename> ...\n\n")" "$0"
printf "$(gettext "\
repo-remove will update a package database by removing the package name\n\
specified on the command line from the given repo database. Multiple\n\
packages to remove can be specified on the command line.\n\n")"
+ printf "$(gettext "\
+The -q/--quiet flag will force this program to run silently except\n\
+in the case of warnings or errors.\n\n")"
echo "$(gettext "Example: repo-remove /path/to/repo.db.tar.gz kernel26")"
}
version() {
printf "repo-remove (pacman) %s\n" "$myver"
printf "$(gettext "\
-Copyright (C) 2002-2007 Judd Vinet <jvinet@zeroflux.org>.\n\n\
+Copyright (c) 2007-2008 Dan McGee <dan@archlinux.org>.\n\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n")"
}
@@ -140,7 +146,9 @@ gstmpdir=$(mktemp -d /tmp/repo-remove.XXXXXXXXXX) || (\
success=0
# parse arguments
for arg in "$@"; do
- if [ -z "$REPO_DB_FILE" ]; then
+ if [ "$arg" == "--quiet" -o "$arg" == "-q" ]; then
+ QUIET=1
+ elif [ -z "$REPO_DB_FILE" ]; then
REPO_DB_FILE=$(readlink -f "$arg")
if ! test_repo_db_file; then
error "$(gettext "Repository file '%s' is not a proper pacman database.")\n" "$REPO_DB_FILE"