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 974286f commit e6ae6cf
Showing 1 changed file with 27 additions and 45 deletions.
72 changes: 27 additions & 45 deletions usr/bin/dist-installer-cli
Original file line number Diff line number Diff line change
Expand Up @@ -2870,13 +2870,6 @@ get_transfer_cmd(){
esac
}

## Get utilities from a pool of known utilities and use the first one found.
get_utilities(){
get_su_cmd
get_checkhash_cmd
get_transfer_cmd
}


## Set default traps
set_trap(){
Expand Down Expand Up @@ -3007,40 +3000,6 @@ $df_output"
}


## Sanity checks that should be called before execution of main
pre_check(){
get_os
get_distro
get_installer_version
check_not_qubes_template
get_system_stat
need_reboot_check_first
get_host_pkgs
need_reboot_check_second
get_independent_host_pkgs
kernel_modules_check
nested_virtualization_test
secure_boot_test
kernel_modules_load
kernel_modules_signed_only

## 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

## Functions below are difficult to emulate
if test "${dry_run}" = "1"; then
log info "Skipping rest or pre_check() because via '--dry-run' option."
return 0
fi

get_virtualization
}


## Generate SOCKS credentials for stream isolation
get_proxy_cred(){
test "${transfer_utility}" != "curl" && return 0
Expand Down Expand Up @@ -3744,8 +3703,6 @@ main(){
## The license function sleeps for some seconds to give time to abort
check_license || die 100 "${underline}License Check:${nounderline} User declined the license."

pre_check

log_time

#############
Expand Down Expand Up @@ -4216,10 +4173,35 @@ run_installer(){
## Logging mechanism.
log_term_and_file

get_utilities
get_os
get_distro
get_installer_version
check_not_qubes_template
get_system_stat
need_reboot_check_first
get_su_cmd
get_host_pkgs
need_reboot_check_second
get_independent_host_pkgs
kernel_modules_check
nested_virtualization_test
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_virtualization
get_checkhash_cmd
get_transfer_cmd
get_download_links

## Start main function.
main
}

Expand Down

0 comments on commit e6ae6cf

Please sign in to comment.