diff options
author | Dave Reisner <dreisner@archlinux.org> | 2011-09-25 20:34:36 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-09-26 23:02:19 +0200 |
commit | b6ccae2d182899eaf199e868963646b3a14f7e8b (patch) | |
tree | 89740b577603d0e48bc3b756a2c64010d52a9487 | |
parent | dd82b8d09f554d709f92fcdc7f873cb551b2d205 (diff) | |
download | pacman-b6ccae2d182899eaf199e868963646b3a14f7e8b.tar.gz pacman-b6ccae2d182899eaf199e868963646b3a14f7e8b.tar.xz |
pacman-key: simplify writing to config file
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | scripts/pacman-key.sh.in | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index d0f338f6..cf63be87 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -131,13 +131,11 @@ secret_keys_available() { # Note that if we find it commented out, we won't add the option. # args: $1 conffile, $2 option-name, $3 (optional) option-value add_gpg_conf_option() { - local confline + local conffile=$1; shift # looking for the option 'bare', only leading spaces or # chars allowed, # followed by at least one space and any other text or the end of line. - if ! grep -q "^[[:space:]#]*$2\([[:space:]].*\)*$" "$1" &>/dev/null; then - confline="$2" - [[ -n $3 ]] && confline="$2 $3" - echo "$confline" >> "$1" + if ! grep -q "^[[:space:]#]*$1\([[:space:]].*\)*$" "$conffile" &>/dev/null; then + printf '%s\n' "$*" >> "$conffile" fi } |