Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions man/dist-installer-cli.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ format <guest-interface-installer>.
`-l`, `--log-level`=<level>

Define the logging level. Options: debug, info, notice (default), warn, error.
Log messages below the specified level are displayed.
Log messages at or above the specified level are displayed.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted.


`-k`, `--no-boot`

Expand Down Expand Up @@ -116,10 +116,6 @@ format <guest-interface-installer>.

Enable dirty mode, where the program continues despite errors.

`--no-show-errors`

Suppress error messages.

Comment on lines -119 to -122
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done in an earlier commit.

`--ci`

Enable CI mode for testing within Continuous Integration (CI) environments.
Expand All @@ -132,7 +128,7 @@ format <guest-interface-installer>.

Activate development mode, which sets the default download version to an empty image.

`--noupgrade`
`--noupdate`
Comment on lines -135 to +131
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted. (Typo was my fault.)


Skip package manager list update. For development only.

Expand Down
50 changes: 39 additions & 11 deletions usr/bin/dist-installer-cli
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,13 @@ test_pkg() {


check_vm_running_general() {
if [ "${virtualbox_only}" = "1" ]; then
return 0
fi
if [ "${hypervisor}" = "kvm" ]; then
return 0
fi

Comment on lines +987 to +993
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted with tweaks.

case "${guest}" in
whonix)
check_vm_running_virtualbox "${guest_full_vm_name_gateway}"
Expand Down Expand Up @@ -1178,8 +1185,9 @@ vm_delete_maybe() {
die 1 "${underline}Existing VM Check Result:${nounderline} '--import-only' option was set to 'gateway', but it already exists and '--destroy-existing-guest' option was not set."
elif [ "${workstation_exists}" = "1" ] && [ "${import_only}" = "workstation" ] ; then
die 1 "${underline}Existing VM Check Result:${nounderline} '--import-only' option was set to 'workstation', but it already exists and '--destroy-existing-guest' option was not set."
elif [ "${import_only}" = "both" ] && [ "${gateway_exists}" = "1" ] && [ "${workstation_exists}" = "1" ]; then
die 1 "${underline}Existing VM Check Result:${nounderline} '--import-only' option was set to 'both', but both VMs already exist and '--destroy-existing-guest' option was not set."
fi
## FIXME: Shouldn't import_only=both be handled here?
Comment on lines +1188 to -1182
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mostly accepted, but the gateway_exists && workstation_exists logic needs to use ||, not &&, because import_virtualbox bails out if either VM exists, and we're trying to match the logic there.

else
log info "Existing VM Check: Neither '--destroy-existing-guest' nor '--import-only' option was set, ok."
fi
Expand Down Expand Up @@ -1356,7 +1364,7 @@ import_guest() {
fi

if [ "${no_import}" = "1" ]; then
log notice "VM Import: Not importing guest via '--import-only' option."
log notice "VM Import: Not importing guest via '--no-import' option."
Comment on lines -1359 to +1367
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted.

end_installer
fi

Expand Down Expand Up @@ -1635,6 +1643,26 @@ get_pattern_sources_deb822_debian() {
fi
done < "${file}"

## Check the last stanza in case the file does not end with an empty line.
match_hit='yes'
if [ -n "${types_pattern}" ] \
&& ! [[ "${current_types}" =~ ${types_pattern} ]]; then
match_hit='no'
elif [ -n "${uris_pattern}" ] \
&& ! [[ "${current_uris}" =~ ${uris_pattern} ]]; then
match_hit='no'
elif [ -n "${suites_pattern}" ] \
&& ! [[ "${current_suites}" =~ ${suites_pattern} ]]; then
match_hit='no'
elif [ -n "${components_pattern}" ] \
&& ! [[ "${current_components}" =~ ${components_pattern} ]]; then
match_hit='no'
fi

if [ "${match_hit}" = 'yes' ]; then
return 0
fi

Comment on lines +1646 to +1665
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Idea accepted, but there's an easier way to do this; just read the file into memory, append an extra blank line at the end, then parse that.

return 1
}

Expand Down Expand Up @@ -1917,12 +1945,13 @@ If that doesn't resolve the issue, consider reaching out to your operating syste
#install_pkg torsocks
#fi

install_signify signify-openbsd torsocks
install_signify signify-openbsd
install_pkg torsocks
Comment on lines -1920 to +1949
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted.

}


add_user_to_vbox_group() {
if id --name --groups "${id_of_user}" | grep -w -- "${virtualbox_linux_user_group}\$" >/dev/null; then
if id --name --groups "${id_of_user}" | grep -w -- "${virtualbox_linux_user_group}" >/dev/null; then
Comment on lines -1925 to +1954
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted.

log info "Linux Group Configuration: Account '${id_of_user}' is already a member of the Linux group 'vboxusers'."
return 0
fi
Expand Down Expand Up @@ -3670,8 +3699,8 @@ get_download_links() {
;;
*)
## Variables need to be set for --virtualbox-only.
site_clearnet="${site_onion_kicksecure}"
site_onion="${site_clearnet_kicksecure}"
site_clearnet="${site_clearnet_kicksecure}"
site_onion="${site_onion_kicksecure}"
Comment on lines -3673 to +3703
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted.

;;
esac

Expand Down Expand Up @@ -3845,7 +3874,7 @@ check_hash() {

shafile="${1}"
dir="$(dirname -- "${shafile}")"
log info "Checking SHA512 checksum: '${shafile}"
log info "Checking SHA512 checksum: '${shafile}'"
Comment on lines -3848 to +3877
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted.

## $checkhash needs to be executed on the same folder as the compared file.
log info "Changing to directory: '${dir}'"
if [ -n "${target_user}" ]; then
Expand Down Expand Up @@ -4039,7 +4068,6 @@ User Options:
-h, --help Show this help message and exit.

Developer options:
--no-show-errors Suppress error messages.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done in an earlier commit.

--allow-errors Continue execution despite errors. Dirty mode. Use with caution.
--mirror=<number> Choose a download mirror by index. Defaults to mirror 0 for
clearnet and mirror 0 for onion if unspecified.
Expand All @@ -4049,7 +4077,7 @@ Developer options:
2 [HU] quantum-mirror.hu
--redownload Re-download the guest image, even if previously successful.
--import-only=<vm> Select specific VM to import. Only if guest is Whonix.
Options: workstation, gateway.
Options: workstation, gateway, both.
Comment on lines -4052 to +4080
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted.

--no-import Skip guest import. Default behavior is to import.
--destroy-existing-guest Deletes any existing virtual machine(s) and re-imports them.
Warning: This action poses a risk of data loss as it involves
Expand Down Expand Up @@ -4497,7 +4525,7 @@ Reboot into sysmaint session and rerun this installer."
else
local log_entries
log_entries=( "${log_dir_main}"/* )
last_run_integer="$(printf '%s\0' "${log_entries[@]}" | sort -zrn | tr '\0' '\n' | head --lines=1)" || true
last_run_integer="$(printf '%s\n' "${log_entries[@]##*/}" | sort -rn | head --lines=1)" || true
Comment on lines -4500 to +4528
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted. (Didn't realize the log_entries array was going to end up containing a list of paths rather than basenames.)

if [ -z "${last_run_integer}" ] \
|| ! is_whole_number "${last_run_integer}"; then
last_run_integer='1'
Expand Down Expand Up @@ -4594,7 +4622,7 @@ log_term_and_file() {
2> >(run_as_target_user tee -a -- "${log_file_debug}" >&2)

temp_folder="$(mktemp --directory)"
xtrace_fifo="/${temp_folder}/xtrace_fifo"
xtrace_fifo="${temp_folder}/xtrace_fifo"
Comment on lines -4597 to +4625
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted.

mkfifo -m 600 -- "$xtrace_fifo"

if [ "${log_level}" = "debug" ] || test -o xtrace; then
Expand Down
2 changes: 1 addition & 1 deletion usr/share/bash-completion/completions/dist-installer-cli
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ _dist_installer_cli()
--guest-version | --socks-proxy | --onion | --non-interactive | \
--no-import | --no-boot | --redownload | \
--destroy-existing-guest | --dev | --ci | --dry-run | \
--getopt | --no-show-errors | --allow-errors | --testers | \
--getopt | --allow-errors | --testers | \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done in an earlier commit.

--noupdate | --noupgrade | --virtualbox-only | --oracle-repo | \
--version | --help )
return
Expand Down
1 change: 1 addition & 0 deletions usr/share/usability-misc/build-dist-installer-cli
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ helper_path="/usr/libexec/helper-scripts/"

if ! test -d "$helper_path" ; then
echo "$0: ERROR: directory helper_path '$helper_path' does not exist!" >&2
exit 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Accepted.

fi

cp -- "${template}" "${target}"
Expand Down
1 change: 0 additions & 1 deletion usr/share/zsh/vendor-completions/_dist-installer-cli
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ args=(
'(--destroy-existing-guest)'--destroy-existing-guest'[Delete and re-import. Danger! Risk of data loss!]'
'(-n --non-interactive)'{-n,--non-interactive}'[Set non-interactive mode]'
'(--allow-errors)'--allow-errors'[Set dirty mode]'
'(--no-show-errors)'--no-show-errors'[Hide errors]'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done in an earlier commit.

'(--testers)'--testers'[Set testers mode]'
'(-D --dev)'{-D,--dev}'[Set dev mode]'
'(--noupdate)'--noupdate'[Skip package manager list update (dev only)]'
Expand Down