diff --git a/man/dist-installer-cli.1.ronn b/man/dist-installer-cli.1.ronn index 67870af..bb9c4fc 100644 --- a/man/dist-installer-cli.1.ronn +++ b/man/dist-installer-cli.1.ronn @@ -62,7 +62,7 @@ format . `-l`, `--log-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. `-k`, `--no-boot` @@ -116,10 +116,6 @@ format . Enable dirty mode, where the program continues despite errors. -`--no-show-errors` - - Suppress error messages. - `--ci` Enable CI mode for testing within Continuous Integration (CI) environments. @@ -132,7 +128,7 @@ format . Activate development mode, which sets the default download version to an empty image. -`--noupgrade` +`--noupdate` Skip package manager list update. For development only. diff --git a/usr/bin/dist-installer-cli b/usr/bin/dist-installer-cli index 3f2a43d..1d6aed3 100755 --- a/usr/bin/dist-installer-cli +++ b/usr/bin/dist-installer-cli @@ -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 + case "${guest}" in whonix) check_vm_running_virtualbox "${guest_full_vm_name_gateway}" @@ -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? else log info "Existing VM Check: Neither '--destroy-existing-guest' nor '--import-only' option was set, ok." fi @@ -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." end_installer fi @@ -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 + return 1 } @@ -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 } 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 log info "Linux Group Configuration: Account '${id_of_user}' is already a member of the Linux group 'vboxusers'." return 0 fi @@ -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}" ;; esac @@ -3845,7 +3874,7 @@ check_hash() { shafile="${1}" dir="$(dirname -- "${shafile}")" - log info "Checking SHA512 checksum: '${shafile}" + log info "Checking SHA512 checksum: '${shafile}'" ## $checkhash needs to be executed on the same folder as the compared file. log info "Changing to directory: '${dir}'" if [ -n "${target_user}" ]; then @@ -4039,7 +4068,6 @@ User Options: -h, --help Show this help message and exit. Developer options: - --no-show-errors Suppress error messages. --allow-errors Continue execution despite errors. Dirty mode. Use with caution. --mirror= Choose a download mirror by index. Defaults to mirror 0 for clearnet and mirror 0 for onion if unspecified. @@ -4049,7 +4077,7 @@ Developer options: 2 [HU] quantum-mirror.hu --redownload Re-download the guest image, even if previously successful. --import-only= Select specific VM to import. Only if guest is Whonix. - Options: workstation, gateway. + Options: workstation, gateway, both. --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 @@ -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 if [ -z "${last_run_integer}" ] \ || ! is_whole_number "${last_run_integer}"; then last_run_integer='1' @@ -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" mkfifo -m 600 -- "$xtrace_fifo" if [ "${log_level}" = "debug" ] || test -o xtrace; then diff --git a/usr/share/bash-completion/completions/dist-installer-cli b/usr/share/bash-completion/completions/dist-installer-cli index 21ffcc1..8e6cef9 100644 --- a/usr/share/bash-completion/completions/dist-installer-cli +++ b/usr/share/bash-completion/completions/dist-installer-cli @@ -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 | \ --noupdate | --noupgrade | --virtualbox-only | --oracle-repo | \ --version | --help ) return diff --git a/usr/share/usability-misc/build-dist-installer-cli b/usr/share/usability-misc/build-dist-installer-cli index 9e676d2..7d53781 100755 --- a/usr/share/usability-misc/build-dist-installer-cli +++ b/usr/share/usability-misc/build-dist-installer-cli @@ -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 fi cp -- "${template}" "${target}" diff --git a/usr/share/zsh/vendor-completions/_dist-installer-cli b/usr/share/zsh/vendor-completions/_dist-installer-cli index 0643f90..518d778 100644 --- a/usr/share/zsh/vendor-completions/_dist-installer-cli +++ b/usr/share/zsh/vendor-completions/_dist-installer-cli @@ -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]' '(--testers)'--testers'[Set testers mode]' '(-D --dev)'{-D,--dev}'[Set dev mode]' '(--noupdate)'--noupdate'[Skip package manager list update (dev only)]'