X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 058F7DC7575 for ; Fri, 5 Jul 2013 04:21:49 +0000 (UTC) Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 8B0D3207DE for ; Fri, 5 Jul 2013 00:21:46 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 05 Jul 2013 00:21:46 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :in-reply-to:references; s=smtpout; bh=UnmaNSs9u/Q+h9WSb1Sh2HrCy 6Y=; b=jCTVcqL2zeo9i0G/m1sRDP28a0s986Bq3j10IpBvL6ji+78AeSMDfIf9e IQinphzSgVupjB/a/1cgtlwbzTKLIgWn0Gpw0ktz5d+C23pUxDYXtQx64LdWxodv 1bIoFtrT1sD08FF9p0gl5psGwBL1KteA0ljFaR+nmPxCrJQGyk= X-Sasl-enc: g09dhLOEEc+C8yA+lbyHG09VRYCVl9YLj/+gabtqsLl0 1372998106 Received: from localhost (unknown [69.86.161.244]) by mail.messagingengine.com (Postfix) with ESMTPA id 5D65D680204 for ; Fri, 5 Jul 2013 00:21:46 -0400 (EDT) From: Dubiousjim To: alpine-devel@lists.alpinelinux.org Subject: [alpine-devel] [PATCH 11/31] abuild_keygen: several tweaks Date: Fri, 5 Jul 2013 00:21:20 -0400 Message-Id: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: * make vars local * refactor calculation of default_name * make non_interactive=1 * tweak error message * tweak sed command --- abuild-keygen.in | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/abuild-keygen.in b/abuild-keygen.in index 34af0ee..bf9d105 100644 --- a/abuild-keygen.in +++ b/abuild-keygen.in @@ -19,6 +19,7 @@ fi # ask for privkey unless non-interactive mode # returns value in global $privkey get_privkey_file() { + local emailaddr default_name emailaddr=${PACKAGER##*<} emailaddr=${emailaddr%%>*} @@ -27,16 +28,12 @@ get_privkey_file() { emailaddr=$(git config --get user.email 2>/dev/null) fi - if [ -n "$emailaddr" ]; then - default_name="$emailaddr-$(printf "%x" $(date +%s))" - else - default_name="$USER-$(printf "%x" $(date +%s))" - fi + default_name="${emailaddr:-$USER}-$(printf "%x" $(date +%s))" privkey="$abuild_home/$default_name.rsa" - [ "$non_interactive" = "yes" ] && return 0 + [ -n "$non_interactive" ] && return 0 echo "Generating public/private rsa key pair for abuild" - echo -n "Enter file in which to save the key ($abuild_home/$default_name.rsa): " + echo -n "Enter file in which to save the key [$privkey]: " read line if [ -n "$line" ]; then @@ -73,7 +70,7 @@ do_keygen() { if [ -n "$append_config" ]; then if [ -f "$abuild_userconf" ]; then # comment out the existing values - sed -i -e 's/^\(PACKAGER_PRIVKEY=.*\)/\#\1/' "$abuild_userconf" + sed -i -e 's/^PACKAGER_PRIVKEY=/\#&/' "$abuild_userconf" fi echo "PACKAGER_PRIVKEY=\"$privkey\"" >> "$abuild_userconf" else @@ -119,7 +116,7 @@ while true; do case $1 in -a|--append) append_config=1;; -i|--install) install_pubkey=1;; - -n) non_interactive=yes;; + -n) non_interactive=1;; -q|--quiet) quiet=1;; # suppresses msg -h|--help) usage; exit;; --) shift; break;; -- 1.8.3.1 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---