mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [RFC] ptxd_make_get_http: Specify the username and password
Date: Sat, 7 Jan 2017 22:58:14 +0100	[thread overview]
Message-ID: <20170107215814.hys72xvielpnuvry@lenoch> (raw)

Hi there,

I need to pass username and password to download mercurial snapshot from
server, so something like this now works:
package_URL := https://mercurial.site.com/hg/package/archive/$(package_VERSION).$(package_SUFFIX);user=<username>:<password>

Is it acceptable to support it in upstream PTXdist?
(it could be probably rewritten some nicer way, but I'm not too good at shell scripting)

	ladis

diff --git a/scripts/lib/ptxd_make_get.sh b/scripts/lib/ptxd_make_get.sh
index 2bac97817..e392e8b0c 100644
--- a/scripts/lib/ptxd_make_get.sh
+++ b/scripts/lib/ptxd_make_get.sh
@@ -25,6 +25,7 @@ ptxd_make_get_http() {
 	# scan for valid options
 	#
 	while [ ${#} -ne 0 ]; do
+		local cred
 		local opt="${1}"
 		shift
 
@@ -45,6 +46,13 @@ ptxd_make_get_http() {
 				curl_opts[${#curl_opts[@]}]="--cookie"
 				curl_opts[${#curl_opts[@]}]="${opt#cookie:}"
 				;;
+			user=*)
+				cred="${opt#user=}"
+				cred=(${cred//:/ })
+				opts[${#opts[@]}]="--user=${cred[0]}"
+				opts[${#opts[@]}]="--password=${cred[1]}"
+				curl_opts[${#curl_opts[@]}]="${opt#user=}"
+				;;
 			*)
 				ptxd_bailout "invalid option '${opt}' to ${FUNCNAME}"
 				;;

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

             reply	other threads:[~2017-01-07 21:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-07 21:58 Ladislav Michl [this message]
2017-01-08  0:10 ` Roland Hieber
2017-01-08 19:55   ` Ladislav Michl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170107215814.hys72xvielpnuvry@lenoch \
    --to=ladis@linux-mips.org \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox