Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
adrelanos committed May 17, 2024
1 parent e6ae6cf commit c2df77b
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions usr/bin/dist-installer-cli
Original file line number Diff line number Diff line change
Expand Up @@ -3078,7 +3078,17 @@ set_transfer_proxy(){

## Useful to test if it is a SOCKS proxy before attempting to make requests.
## If connection to proxy fails, abort to avoid leaks.
torify_conn(){
torify_conn_maybe(){
## onion=1 -- Always torify onion connections.
## onion=* -- Only torify clearnet if SOCKS proxy is specified.
if [ ! "${onion}" = "1" ]; then
if ! test -n "${socks_proxy:-}"; then
## TODO: lower log level
log notice "Not torifying connection, because socks_proxy envrionment variable is unset nor using '--onion'."
return 0
fi
fi

if ! has tor; then
log warn "System tor binary (little-t-tor) was not found on the system."
log warn "Unless your SOCKS connection is made available by the Tor Browser"
Expand Down Expand Up @@ -4188,18 +4198,10 @@ run_installer(){
secure_boot_test
kernel_modules_load
kernel_modules_signed_only

## TODO: move to a function
## onion=1 -- Always torify onion connections.
## onion=* -- Only torify clearnet if SOCKS proxy is specified.
case "${onion}" in
1) torify_conn;;
*) test -n "${socks_proxy}" && torify_conn;;
esac

get_transfer_cmd
torify_conn_maybe
get_virtualization
get_checkhash_cmd
get_transfer_cmd
get_download_links

main
Expand Down

0 comments on commit c2df77b

Please sign in to comment.