Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-01-23 12:19:51 -0600
committerDan McGee <dan@archlinux.org>2012-01-23 12:20:52 -0600
commite50c4a8837cedf47c2fe1a2c6064b4dc03dc5b03 (patch)
treedf2e33d95d02b17e5d720320c19e267893d68bdf /scripts
parentb3612e9cc198f198b3806efa461bf6fc04dd4502 (diff)
parent825b4ff35aa676b139dc24bc651724b092f2fded (diff)
Merge branch 'maint'
Conflicts: lib/libalpm/diskspace.c src/pacman/util.h
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in17
-rw-r--r--scripts/pacman-key.sh.in174
-rw-r--r--scripts/repo-add.sh.in24
3 files changed, 171 insertions, 44 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 20440265..c761a098 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -3,7 +3,7 @@
# makepkg - make packages compatible for use with pacman
# @configure_input@
#
-# Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2006-2012 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
@@ -412,7 +412,11 @@ download_file() {
run_pacman() {
local cmd
- printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@"
+ if [[ ! $1 = -@(T|Qq) ]]; then
+ printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@"
+ else
+ printf -v cmd "%q " "$PACMAN" "$@"
+ fi
if (( ! ASROOT )) && [[ ! $1 = -@(T|Qq) ]]; then
if type -p sudo >/dev/null; then
cmd="sudo $cmd"
@@ -507,14 +511,15 @@ remove_deps() {
# check for packages removed during dependency install (e.g. due to conflicts)
# removing all installed packages is risky in this case
if [[ -n $(grep -xvFf <(printf '%s\n' "${current_packagelist[@]}") \
- <(printf '%s\n' "${original_packagelist[@]}") ) ]]; then
+ <(printf '%s\n' "${original_packagelist[@]}") || true) ]]; then
warning "$(gettext "Failed to remove installed dependencies.")"
return 0
fi
local deplist
- if ! deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \
- <(printf "%s\n" "${current_pkglist[@]}"))); then
+ deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \
+ <(printf "%s\n" "${current_pkglist[@]}") || true))
+ if [[ -n deplist ]]; then
return
fi
@@ -1869,7 +1874,7 @@ usage() {
version() {
printf "makepkg (pacman) %s\n" "$myver"
printf "$(gettext "\
-Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>.\n\
+Copyright (c) 2006-2012 Pacman Development Team <pacman-dev@archlinux.org>.\n\
Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.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")"
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 689dc564..4e321e63 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -4,7 +4,7 @@
# Based on apt-key, from Debian
# @configure_input@
#
-# Copyright (c) 2010-2011 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2010-2012 Pacman Development Team <pacman-dev@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
@@ -88,7 +88,7 @@ usage() {
version() {
printf "pacman-key (pacman) %s\n" "${myver}"
printf "$(gettext "\
-Copyright (c) 2010-2011 Pacman Development Team <pacman-dev@archlinux.org>.\n\
+Copyright (c) 2010-2012 Pacman Development Team <pacman-dev@archlinux.org>.\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n")"
}
@@ -144,6 +144,20 @@ add_gpg_conf_option() {
fi
}
+check_keyids_exist() {
+ local ret=0
+ for key in "${KEYIDS[@]}"; do
+ # Verify if the key exists in pacman's keyring
+ if ! "${GPG_PACMAN[@]}" --list-keys "$key" &>/dev/null ; then
+ error "$(gettext "The key identified by %s could not be found locally.")" "$key"
+ ret=1
+ fi
+ done
+ if (( ret )); then
+ exit 1
+ fi
+}
+
initialize() {
local conffile keyserv
# Check for simple existence rather than for a directory as someone
@@ -338,41 +352,144 @@ populate_keyring() {
fi
}
+add_keys() {
+ if ! "${GPG_PACMAN[@]}" --quiet --batch --import "${KEYFILES[@]}" ; then
+ error "$(gettext "A specified keyfile could not be added to the gpg keychain.")"
+ exit 1
+ fi
+}
+
+delete_keys() {
+ check_keyids_exist
+ if ! "${GPG_PACMAN[@]}" --quiet --batch --delete-key --yes "${KEYIDS[@]}" ; then
+ error "$(gettext "A specified key could not be removed from the gpg keychain.")"
+ exit 1
+ fi
+}
+
edit_keys() {
- local errors=0;
+ check_keyids_exist
+ local ret=0
for key in "${KEYIDS[@]}"; do
- # Verify if the key exists in pacman's keyring
- if ! "${GPG_PACMAN[@]}" --list-keys "$key" &>/dev/null; then
- error "$(gettext "The key identified by %s does not exist.")" "$key"
- errors=1;
+ if ! "${GPG_PACMAN[@]}" --edit-key "$key" ; then
+ error "$(gettext "The key identified by %s could not be edited.")" "$key"
+ ret=1
fi
done
- (( errors )) && exit 1;
+ if (( ret )); then
+ exit 1
+ fi
+}
- for key in "${KEYIDS[@]}"; do
- "${GPG_PACMAN[@]}" --edit-key "$key"
- done
+export_keys() {
+ check_keyids_exist
+ if ! "${GPG_PACMAN[@]}" --armor --export "${KEYIDS[@]}" ; then
+ error "$(gettext "A specified key could not be exported from the gpg keychain.")"
+ exit 1
+ fi
+}
+
+finger_keys() {
+ check_keyids_exist
+ if ! "${GPG_PACMAN[@]}" --batch --fingerprint "${KEYIDS[@]}" ; then
+ error "$(gettext "The fingerprint of a specified key could not be determined.")"
+ exit 1
+ fi
}
import_trustdb() {
local importdir
-
+ local ret=0
for importdir in "${IMPORT_DIRS[@]}"; do
if [[ -f "${importdir}/trustdb.gpg" ]]; then
gpg --homedir "${importdir}" --export-ownertrust | \
"${GPG_PACMAN[@]}" --import-ownertrust -
+ if (( PIPESTATUS )); then
+ error "$(gettext "%s could not be imported.")" "${importdir}/trustdb.gpg"
+ ret=1
+ fi
+ else
+ error "$(gettext "File %s does not exist and could not be imported.")" "${importdir}/trustdb.gpg"
+ ret=1
fi
done
+ if (( ret )); then
+ exit 1
+ fi
}
import() {
local importdir
-
+ local ret=0
for importdir in "${IMPORT_DIRS[@]}"; do
if [[ -f "${importdir}/pubring.gpg" ]]; then
- "${GPG_PACMAN[@]}" --quiet --batch --import "${importdir}/pubring.gpg"
+ if ! "${GPG_PACMAN[@]}" --quiet --batch --import "${importdir}/pubring.gpg" ; then
+ error "$(gettext "%s could not be imported.")" "${importdir}/pubring.gpg"
+ ret=1
+ fi
+ else
+ error "$(gettext "File %s does not exist and could not be imported.")" "${importdir}/pubring.gpg"
+ ret=1
fi
done
+ if (( ret )); then
+ exit 1
+ fi
+}
+
+list_keys() {
+ check_keyids_exist
+ if ! "${GPG_PACMAN[@]}" --batch --list-keys "${KEYIDS[@]}" ; then
+ error "$(gettext "A specified key could not be listed.")"
+ exit 1
+ fi
+}
+
+list_sigs() {
+ check_keyids_exist
+ if ! "${GPG_PACMAN[@]}" --batch --list-sigs "${KEYIDS[@]}" ; then
+ error "$(gettext "A specified signature could not be listed.")"
+ exit 1
+ fi
+}
+
+lsign_keys() {
+ check_keyids_exist
+ printf 'y\ny\n' | LANG=C "${GPG_PACMAN[@]}" --command-fd 0 --quiet --batch --lsign-key "${KEYIDS[@]}" 2>/dev/null
+ if (( PIPESTATUS[1] )); then
+ error "$(gettext "A specified key could not be locally signed.")"
+ exit 1
+ fi
+}
+
+receive_keys() {
+ if ! "${GPG_PACMAN[@]}" --recv-keys "${KEYIDS[@]}" ; then
+ error "$(gettext "Remote key not fetched correctly from keyserver.")"
+ exit 1
+ fi
+}
+
+refresh_keys() {
+ check_keyids_exist
+ if ! "${GPG_PACMAN[@]}" --refresh-keys "${KEYIDS[@]}" ; then
+ error "$(gettext "A specified local key could not be updated from a keyserver.")"
+ exit 1
+ fi
+}
+
+verify_sig() {
+ if ! "${GPG_PACMAN[@]}" --verify $SIGNATURE ; then
+ error "$(gettext "The signature identified by %s could not be verified.")" "$SIGNATURE"
+ exit 1
+ fi
+}
+
+updatedb() {
+ msg "$(gettext "Updating trust database...")"
+ if ! "${GPG_PACMAN[@]}" --batch --check-trustdb ; then
+ error "$(gettext "Trust database could not be updated.")"
+ exit 1
+ fi
}
# PROGRAM START
@@ -476,27 +593,24 @@ esac
(( ! INIT )) && check_keyring
-(( ADD )) && "${GPG_PACMAN[@]}" --quiet --batch --import "${KEYFILES[@]}"
-(( DELETE )) && "${GPG_PACMAN[@]}" --quiet --batch --delete-key --yes "${KEYIDS[@]}"
+(( ADD )) && add_keys
+(( DELETE )) && delete_keys
(( EDITKEY )) && edit_keys
-(( EXPORT )) && "${GPG_PACMAN[@]}" --armor --export "${KEYIDS[@]}"
-(( FINGER )) && "${GPG_PACMAN[@]}" --batch --fingerprint "${KEYIDS[@]}"
+(( EXPORT )) && export_keys
+(( FINGER )) && finger_keys
(( IMPORT )) && import
(( IMPORT_TRUSTDB)) && import_trustdb
(( INIT )) && initialize
-(( LISTKEYS )) && "${GPG_PACMAN[@]}" --batch --list-keys "${KEYIDS[@]}"
-(( LISTSIGS )) && "${GPG_PACMAN[@]}" --batch --list-sigs "${KEYIDS[@]}"
-if (( LSIGNKEY )); then
- printf 'y\ny\n' | LANG=C "${GPG_PACMAN[@]}" --command-fd 0 --quiet --batch --lsign-key "${KEYIDS[@]}" 2>/dev/null
-fi
+(( LISTKEYS )) && list_keys
+(( LISTSIGS )) && list_sigs
+(( LSIGNKEY )) && lsign_keys
(( POPULATE )) && populate_keyring
-(( RECEIVE )) && "${GPG_PACMAN[@]}" --recv-keys "${KEYIDS[@]}"
-(( REFRESH )) && "${GPG_PACMAN[@]}" --refresh-keys "${KEYIDS[@]}"
-(( VERIFY )) && "${GPG_PACMAN[@]}" --verify "$SIGNATURE"
+(( RECEIVE )) && receive_keys
+(( REFRESH )) && refresh_keys
+(( VERIFY )) && verify_sig
-if (( UPDATEDB )); then
- msg "$(gettext "Updating trust database...")"
- "${GPG_PACMAN[@]}" --batch --check-trustdb
-fi
+(( UPDATEDB )) && updatedb
+
+exit 0
# vim: set ts=2 sw=2 noet:
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 28339e64..48eee7ac 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -4,7 +4,7 @@
# repo-remove - remove a package entry from a given repo database file
# @configure_input@
#
-# Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2006-2012 Pacman Development Team <pacman-dev@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
@@ -48,30 +48,38 @@ usage() {
printf "%s (pacman) %s\n\n" "$cmd" "$myver"
if [[ $cmd == "repo-add" ]] ; then
printf "$(gettext "Usage: repo-add [options] <path-to-db> <package|delta> ...\n")"
+ printf "\n"
printf "$(gettext "\
repo-add will update a package database by reading a package file.\n\
-Multiple packages to add can be specified on the command line.\n\n")"
+Multiple packages to add can be specified on the command line.\n")"
+ printf "\n"
printf "$(gettext "Options:\n")"
printf "$(gettext " -d, --delta generate and add delta for package update\n")"
printf "$(gettext " -f, --files update database's file list\n")"
elif [[ $cmd == "repo-remove" ]] ; then
- printf "$(gettext "Usage: repo-remove [options] <path-to-db> <packagename|delta> ...\n\n")"
+ printf "$(gettext "Usage: repo-remove [options] <path-to-db> <packagename|delta> ...\n")"
+ printf "\n"
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")"
+packages to remove can be specified on the command line.\n")"
+ printf "\n"
printf "$(gettext "Options:\n")"
+ else
+ printf "$(gettext "Please move along, there is nothing to see here.\n")"
+ return
fi
printf "$(gettext " -q, --quiet minimize output\n")"
printf "$(gettext " -s, --sign sign database with GnuPG after update\n")"
printf "$(gettext " -k, --key <key> use the specified key to sign the database\n")"
printf "$(gettext " -v, --verify verify database's signature before update\n")"
printf "$(gettext "\n\
-See %s(8) for more details and descriptions of the available options.\n\n")" $cmd
+See %s(8) for more details and descriptions of the available options.\n")" $cmd
+ printf "\n"
if [[ $cmd == "repo-add" ]] ; then
- echo "$(gettext "Example: repo-add /path/to/repo.db.tar.gz pacman-3.0.0-1-i686.pkg.tar.gz")"
+ printf "$(gettext "Example: repo-add /path/to/repo.db.tar.gz pacman-3.0.0-1-i686.pkg.tar.gz\n")"
elif [[ $cmd == "repo-remove" ]] ; then
- echo "$(gettext "Example: repo-remove /path/to/repo.db.tar.gz kernel26")"
+ printf "$(gettext "Example: repo-remove /path/to/repo.db.tar.gz kernel26\n")"
fi
}
@@ -79,7 +87,7 @@ version() {
cmd=${0##*/}
printf "%s (pacman) %s\n\n" "$cmd" "$myver"
printf "$(gettext "\
-Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>\n\n\
+Copyright (c) 2006-2012 Pacman Development Team <pacman-dev@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")"
}