[pacman-dev] [PATCH] Only try to create keyring directory when root

Ray Kohler ataraxia937 at gmail.com
Mon Mar 28 13:34:34 EDT 2011


If we try and fail to create it, the -e flag to bash will make --help
and --version break.

Signed-off-by: Ray Kohler <ataraxia937 at gmail.com>
---
 scripts/pacman-key.sh.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 89e52fc..057b3bb 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -249,7 +249,7 @@ GPG_PACMAN="gpg --homedir ${PACMAN_KEYRING_DIR} --no-permission-warning"
 # Try to create $PACMAN_KEYRING_DIR if non-existent
 # Check for simple existence rather than for a directory as someone may want
 # to use a symlink here
-[[ -e ${PACMAN_KEYRING_DIR} ]] || mkdir -p -m 755 "${PACMAN_KEYRING_DIR}"
+(( EUID != 0 )) || [[ -e ${PACMAN_KEYRING_DIR} ]] || mkdir -p -m 755 "${PACMAN_KEYRING_DIR}"
 
 # Parse and execute command
 command="$1"
-- 
1.7.4.2



More information about the pacman-dev mailing list