Touchup nix-install.sh (#53)

* Remove rustup's help from the nix script

* Handle --no-confirm with no tty
This commit is contained in:
Ana Hobden 2022-11-16 11:36:47 -08:00 committed by GitHub
parent 6f64bb0092
commit 0ba6ffe32c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,32 +96,11 @@ main() {
local need_tty=yes
for arg in "$@"; do
case "$arg" in
--help)
usage
exit 0
--no-confirm)
need_tty=no
;;
*)
OPTIND=1
if [ "${arg%%--*}" = "" ]; then
# Long option (other than --help);
# don't attempt to interpret it.
continue
fi
while getopts :hy sub_arg "$arg"; do
case "$sub_arg" in
h)
usage
exit 0
;;
y)
# user wants to skip the prompt --
# we don't need /dev/tty
need_tty=no
;;
*)
;;
esac
done
continue
;;
esac
done
@ -499,7 +478,11 @@ downloader() {
get_ciphersuites_for_curl
_ciphersuites="$RETVAL"
if [ -n "$_ciphersuites" ]; then
_err=$(curl $_retry --proto '=https' --tlsv1.2 --ciphers "$_ciphersuites" --silent --show-error --fail --location "$1" --output "$2" 2>&1)
if [ -n "$NIX_INSTALL_FORCE_ALLOW_HTTP" ]; then
_err=$(curl $_retry --silent --show-error --fail --location "$1" --output "$2" 2>&1)
else
_err=$(curl $_retry --proto '=https' --tlsv1.2 --ciphers "$_ciphersuites" --silent --show-error --fail --location "$1" --output "$2" 2>&1)
fi
_status=$?
else
echo "Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure"