projects
/
apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'donkult/debian/sid' into debian/sid
[apt.git]
/
cmdline
/
apt-key
diff --git
a/cmdline/apt-key
b/cmdline/apt-key
index 97d6e03235ea6738dd2074d58e27f508fa3c9c91..2c087acbc667c6da58363d3de35d0d8cb28f3561 100755
(executable)
--- a/
cmdline/apt-key
+++ b/
cmdline/apt-key
@@
-11,7
+11,8
@@
GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-k
if [ "$(id -u)" -eq 0 ]; then
# we could use a tmpfile here too, but creation of this tends to be time-consuming
if [ "$(id -u)" -eq 0 ]; then
# we could use a tmpfile here too, but creation of this tends to be time-consuming
- GPG_CMD="$GPG_CMD --trustdb-name /etc/apt/trustdb.gpg"
+ eval $(apt-config shell TRUSTDBDIR Dir::Etc/d)
+ GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg"
fi
GPG="$GPG_CMD"
fi
GPG="$GPG_CMD"
@@
-31,6
+32,16
@@
requires_root() {
fi
}
fi
}
+# gpg defaults to mode 0600 for new keyrings. Create one with 0644 instead.
+init_keyring() {
+ for path; do
+ if ! [ -e "$path" ]; then
+ touch -- "$path"
+ chmod 0644 -- "$path"
+ fi
+ done
+}
+
add_keys_with_verify_against_master_keyring() {
ADD_KEYRING=$1
MASTER=$2
add_keys_with_verify_against_master_keyring() {
ADD_KEYRING=$1
MASTER=$2
@@
-152,7
+163,7
@@
if [ "$1" = "--keyring" ]; then
#echo "keyfile given"
shift
TRUSTEDFILE="$1"
#echo "keyfile given"
shift
TRUSTEDFILE="$1"
- if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ]; then
+ if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ]
|| [ "$2" = 'adv' ]
; then
GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
else
echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"
GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
else
echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"
@@
-197,33
+208,42
@@
fi
case "$command" in
add)
requires_root
case "$command" in
add)
requires_root
+ init_keyring "$TRUSTEDFILE"
$GPG --quiet --batch --import "$1"
echo "OK"
;;
del|rm|remove)
requires_root
$GPG --quiet --batch --import "$1"
echo "OK"
;;
del|rm|remove)
requires_root
+ init_keyring "$TRUSTEDFILE"
$GPG --quiet --batch --delete-key --yes "$1"
echo "OK"
;;
update)
$GPG --quiet --batch --delete-key --yes "$1"
echo "OK"
;;
update)
+ init_keyring "$TRUSTEDFILE"
update
;;
net-update)
update
;;
net-update)
+ init_keyring "$TRUSTEDFILE"
net_update
;;
list)
net_update
;;
list)
+ init_keyring "$TRUSTEDFILE"
$GPG --batch --list-keys
;;
finger*)
$GPG --batch --list-keys
;;
finger*)
+ init_keyring "$TRUSTEDFILE"
$GPG --batch --fingerprint
;;
export)
$GPG --batch --fingerprint
;;
export)
+ init_keyring "$TRUSTEDFILE"
$GPG --armor --export "$1"
;;
exportall)
$GPG --armor --export "$1"
;;
exportall)
+ init_keyring "$TRUSTEDFILE"
$GPG --armor --export
;;
adv*)
$GPG --armor --export
;;
adv*)
+ init_keyring "$TRUSTEDFILE"
echo "Executing: $GPG $*"
$GPG $*
;;
echo "Executing: $GPG $*"
$GPG $*
;;