Skip to content

Conversation

@tknerr
Copy link

@tknerr tknerr commented Oct 21, 2022

This PR adds the -n (i.e. --netrc) flag to all curl invocations across all molior-tools scripts.

With the -n flag present, curl will honor the presence of a ~/.netrc file and will read the login information from there.

  • if no ~/.netrc is present, curl will silently ignore that and continue without authentication
  • if ~/.netrc is present, but no matching "machine" entry found, curl will silently ignore that and continue without authentication
  • if ~/.netrc is present and a matching "machine" entry is found, it will authenticate with the "username" + "password" specified there

This allows you:

  • to use molior tools with a molior server / mirror which require authentication (e.g. molior-deploy -m https://my.mirror.org ...
  • to use apt sources from a mirror which requires authentication (e.g. molior -p /my/apt/mirror.list ...)

See also:
https://everything.curl.dev/usingcurl/netrc

{
URL_PATH="$1" && shift
curl $MOLIOR_URL$URL_PATH -s --retry 10 \
curl $MOLIOR_URL$URL_PATH -n -s --retry 10 \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should add the -n here, because a few lines further down we explicitly pass the $MOLIOR_USERNAME and $MOLIOR_PASSWORD to curl (matching .netrc credentials will likely override these)

{
URL_PATH="$1" && shift
curl $MOLIOR_URL$URL_PATH -s --retry 10 \
curl $MOLIOR_URL$URL_PATH -n -s --retry 10 \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should add the -n here, because a few lines further down we explicitly pass the $MOLIOR_USERNAME and $MOLIOR_PASSWORD to curl (matching .netrc credentials will likely override these)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant