diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 2c5e97b..074acd4 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -3,7 +3,7 @@ name: docker build on: push: paths: - - 'usr/bin/installer-dist' + - 'usr/bin/dist-installer-cli' - '.github/workflows/builds.yml' jobs: @@ -21,7 +21,7 @@ jobs: with: filters: | installer: - - 'usr/bin/installer-dist' + - 'usr/bin/dist-installer-cli' builds: - '.github/workflows/builds.yml' @@ -79,14 +79,14 @@ jobs: else exit 1 fi - - name: Run default installer-dist - #run: su -s /bin/bash user -- usr/bin/installer-dist --non-interactive --log-level=debug --no-boot --dev --ci - run: sudo -u user -- usr/bin/installer-dist --non-interactive --log-level=debug --no-boot --dev --ci + - name: Run default dist-installer-cli + #run: su -s /bin/bash user -- usr/bin/dist-installer-cli --non-interactive --log-level=debug --no-boot --dev --ci + run: sudo -u user -- usr/bin/dist-installer-cli --non-interactive --log-level=debug --no-boot --dev --ci - name: Run VirtualBox Installer - default repository - run: sudo -u user -- usr/bin/installer-dist --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only + run: sudo -u user -- usr/bin/dist-installer-cli --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only - name: Run VirtualBox Installer - Oracle repository - run: sudo -u user -- usr/bin/installer-dist --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only --oracle-repo + run: sudo -u user -- usr/bin/dist-installer-cli --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only --oracle-repo - name: Run VirtualBox Installer - back to default repository - run: sudo -u user -- usr/bin/installer-dist --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only + run: sudo -u user -- usr/bin/dist-installer-cli --non-interactive --log-level=debug --no-boot --dev --ci --virtualbox-only - name: Run Installer ShellCheck - run: shellcheck usr/bin/installer-dist + run: shellcheck usr/bin/dist-installer-cli diff --git a/COPYING b/COPYING index f76b3f1..d89d354 100644 --- a/COPYING +++ b/COPYING @@ -4,7 +4,7 @@ Files: * Copyright: 2012-2023 ENCRYPTED SUPPORT LP License: GPL-3+-with-additional-terms-1 -Files: usr/bin/installer-dist +Files: usr/bin/dist-installer Copyright: 2022-2023 ENCRYPTED SUPPORT LP 2022-2022 grass 2021-2022 nyxnor @@ -12,9 +12,9 @@ Copyright: 2022-2023 ENCRYPTED SUPPORT LP 2008-2010 Canonical Ltd. License: GPL-3+-with-additional-terms-1 -Files: usr/share/bash-completion/completions/installer-dist - usr/share/zsh/vendor-completions/_installer-dist - man/installer-dist.1.ronn +Files: usr/share/bash-completion/completions/dist-installer + usr/share/zsh/vendor-completions/_dist-installer + man/dist-installer.1.ronn Copyright: 2022-2023 ENCRYPTED SUPPORT LP 2022-2022 grass License: GPL-3+-with-additional-terms-1 diff --git a/auto-generated-man-pages/dist-installer-cli.1 b/auto-generated-man-pages/dist-installer-cli.1 new file mode 100644 index 0000000..35961f5 --- /dev/null +++ b/auto-generated-man-pages/dist-installer-cli.1 @@ -0,0 +1,281 @@ +.\" generated with Ronn-NG/v0.9.1 +.\" http://github.com/apjanke/ronn-ng/tree/0.9.1 +.TH "DIST\-INSTALLER\-CLI" "1" "January 2020" "usability-misc" "usability-misc Manual" +.SH "NAME" +\fBdist\-installer\-cli\fR \- download and import Whonix/Kicksecure VMs +.SH "SYNOPSIS" +\fBdist\-installer\-cli\fR \fIoptions\fR +.SH "DESCRIPTION" +\fBdist\-installer\-cli\fR is an installer that automates the download and import of Kicksecure and Whonix VMs\. It supports interfaces CLI or Xfce, and allows users to choose their preferred hypervisor, such as KVM or VirtualBox\. +.SH "OPTIONS" +Options start with one or two dashes\. Both long and short options that require arguments can be separated by either spaces or an equal sign\. +.P +If an option is specified multiple times, the last assignment takes precedence\. +.P +The guest and interface can also be set by renaming the script following the format \fIguest\-interface\-installer\fR\. +.P +\fB\-g\fR, \fB\-\-guest\fR=\fIguest\fR +.IP "" 4 +.nf + Set the guest operating system\. Options: kicksecure, whonix (default)\. +.fi +.IP "" 0 +.P +\fB\-u\fR, \fB\-\-guest\-version\fR=\fIversion\fR +.IP "" 4 +.nf + Specify the guest version\. If none is provided, the default is to query the API\. +.fi +.IP "" 0 +.P +\fB\-i\fR, \fB\-\-interface\fR=\fIinterface\fR +.IP "" 4 +.nf + Define the guest interface\. Options: cli, xfce (default)\. +.fi +.IP "" 0 +.P +\fB\-m\fR, \fB\-\-hypervisor\fR=\fIhypervisor\fR +.IP "" 4 +.nf + Choose the hypervisor for the guest\. Options: kvm, virtualbox (default)\. +.fi +.IP "" 0 +.P +\fB\-\-oracle\-repo\fR +.IP "" 4 +.nf + Use the Oracle repository for VirtualBox\. This is the default for Fedora\-based + distributions\. It's optional for Debian\-based ones but may be set by developers + in the future if the Debian repository discontinues the VirtualBox package\. +.fi +.IP "" 0 +.P +\fB\-o\fR, \fB\-\-onion\fR +.IP "" 4 +.nf + Route requests through the Tor onion network whenever possible\. +.fi +.IP "" 0 +.P +\fB\-s\fR, \fB\-\-socks\-proxy\fR=\fIproxy\fR +.IP "" 4 +.nf + Define a TCP SOCKS proxy for requests in the format "host:addr"\. If not specified + and Tor onion routing is enabled, it defaults to TOR_SOCKS_HOST:TOR_SOCKS_PORT\. + If this fails, it defaults to host 127\.0\.0\.1 and checks for TBB on port 9151 + or the system's tor on port 9050\. +.fi +.IP "" 0 +.P +\fB\-l\fR, \fB\-\-log\-level\fR=\fIlevel\fR +.IP "" 4 +.nf + Define the logging level\. Options: debug, info, notice (default), warn, error\. + Log messages below the specified level are displayed\. +.fi +.IP "" 0 +.P +\fB\-k\fR, \fB\-\-no\-boot\fR +.IP "" 4 +.nf + Prevent the guest from booting after the installation\. By default, the installer prompts + to start the guest\. In non\-interactive mode, the guest starts automatically\. +.fi +.IP "" 0 +.P +\fB\-\-no\-import\fR +.IP "" 4 +.nf + Skip the importation of the guest\. By default, if the guest hasn't been imported, it will be\. +.fi +.IP "" 0 +.P +\fB\-\-import\-only\fR=\fIvm\fR +.IP "" 4 +.nf + Import only a specific Virtual Machine when the guest is Whonix\. + Options: gateway, workstation\. +.fi +.IP "" 0 +.P +\fB\-\-redownload\fR +.IP "" 4 +.nf + Force a new download even if a flag indicates a previous successful download\. +.fi +.IP "" 0 +.P +\fB\-\-reimport\fR +.IP "" 4 +.nf + Re\-import the guest into the hypervisor\. The installer will attempt to import + any existing files if found\. This option requires the \-\-destroy\-existing\-guest pledge\. +.fi +.IP "" 0 +.P +\fB\-\-destroy\-existing\-guest\fR +.IP "" 4 +.nf + This option is a prerequisite pledge for \-\-reimport\. +.fi +.IP "" 0 +.P +\fB\-P\fR, \fB\-\-directory\-prefix\fR=\fIdirectory\fR +.IP "" 4 +.nf + Define the absolute path directory to store downloaded files\. Defaults to + $HOME/dist\-installer\-cli\-download\. The directory must exist and be writable by the user\. + Changing this directory without moving the previously downloaded files triggers a new download\. +.fi +.IP "" 0 +.P +\fB\-n\fR, \fB\-\-non\-interactive\fR +.IP "" 4 +.nf + Enable non\-interactive mode\. In this mode, all default options are assumed, + including accepting the license and starting the guest\. +.fi +.IP "" 0 +.P +\fB\-\-mirror\fR=\fInumber\fR +.IP "" 4 +.nf + Select a mirror based on its index number\. For faster downloads, choose the + mirror closest to you unless using the onion network\. If no mirror is selected, + the default is whonix\.org for clearnet and dotsrc\.org for onion\. + Mirror indices: + 0 [DE] download\.whonix\.org (onion available) + 1 [DK] mirrors\.dotsrc\.org (onion available) + 2 [DE] mirror\.koljasagorski\.de + 3 [HU] quantum\-mirror\.hu + 4 [PL] ftp\.icm\.edu\.pl + 5 [US] mirrors\.gigenet\.com +.fi +.IP "" 0 +.P +\fB\-\-virtualbox\-only\fR +.IP "" 4 +.nf + Only download and install VirtualBox\. +.fi +.IP "" 0 +.P +\fB\-\-allow\-errors\fR +.IP "" 4 +.nf + Enable dirty mode, where the program continues despite errors\. +.fi +.IP "" 0 +.P +\fB\-\-no\-show\-errors\fR +.IP "" 4 +.nf + Suppress error messages\. +.fi +.IP "" 0 +.P +\fB\-\-ci\fR +.IP "" 4 +.nf + Enable CI mode for testing within Continuous Integration (CI) environments\. +.fi +.IP "" 0 +.P +\fB\-\-testers\fR +.IP "" 4 +.nf + Download the tester's version\. +.fi +.IP "" 0 +.P +\fB\-D\fR, \fB\-\-dev\fR +.IP "" 4 +.nf + Activate development mode, which sets the default download version to an empty image\. +.fi +.IP "" 0 +.P +\fB\-d\fR, \fB\-\-dry\-run\fR +.IP "" 4 +.nf + Simulate a run without executing impactful actions\. +.fi +.IP "" 0 +.P +\fB\-t\fR, \fB\-\-getopt\fR +.IP "" 4 +.nf + Display parsed options and exit\. +.fi +.IP "" 0 +.P +\fB\-V\fR, \fB\-\-version\fR +.IP "" 4 +.nf + Display the version number and exit\. +.fi +.IP "" 0 +.P +\fB\-h\fR, \fB\-\-help\fR +.IP "" 4 +.nf + Display help for commands and exit\. +.fi +.IP "" 0 +.SH "EXAMPLES" +To install Whonix Xfce for KVM: +.IP "" 4 +.nf + $ dist\-installer\-cli \-\-guest=whonix \-\-interface=xfce \-\-hypervisor=kvm +.fi +.IP "" 0 +.P +To install the default configuration using Tor onion routing and a SOCKS proxy: +.IP "" 4 +.nf + $ dist\-installer\-cli \-\-onion \-\-socks\-proxy=127\.0\.0\.1:9050 +.fi +.IP "" 0 +.P +To install the default configuration non\-interactively and display info messages: +.IP "" 4 +.nf + $ dist\-installer\-cli \-\-non\-interactive \-\-log\-level=info +.fi +.IP "" 0 +.SH "EXIT CODES" +The installer returns the exit code of the last command executed\. Some command exit codes might clash with the script's exit code, which would be considered a bug\. Exit codes for \fIcurl\fR and \fIrsync\fR are reserved to avoid conflicts and simplify debugging\. +.IP "" 4 +.nf +1 General error\. + +2 Unrecognized option or incorrect usage\. + +3\-35 Rsync errors\. + +3\-96 Curl errors\. + +100 License declined by the user\. + +101 Unsupported system\. + +102 Virtual machines already exist\. + +103 Download failure\. + +104 Digital signature verification failure\. + +105 Virtual machine import failure\. + +106 Failed to start virtual machines due to anticipated virtualization issues\. + +107 Failed to start virtual machines due to unforeseen issues\. +.fi +.IP "" 0 +.SH "AUTHOR" +This man page was authored by grass (grass@danwin1210\.de)\. +.SH "WWW" +For more information, visit: https://www\.whonix\.org/wiki/Dev/Linux_Installer +.SH "SEE ALSO" +curl(1), sha512sum(1), signify\-openbsd(1), qemu(1), kvm(1) diff --git a/debian/copyright b/debian/copyright index f76b3f1..d89d354 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,7 +4,7 @@ Files: * Copyright: 2012-2023 ENCRYPTED SUPPORT LP License: GPL-3+-with-additional-terms-1 -Files: usr/bin/installer-dist +Files: usr/bin/dist-installer Copyright: 2022-2023 ENCRYPTED SUPPORT LP 2022-2022 grass 2021-2022 nyxnor @@ -12,9 +12,9 @@ Copyright: 2022-2023 ENCRYPTED SUPPORT LP 2008-2010 Canonical Ltd. License: GPL-3+-with-additional-terms-1 -Files: usr/share/bash-completion/completions/installer-dist - usr/share/zsh/vendor-completions/_installer-dist - man/installer-dist.1.ronn +Files: usr/share/bash-completion/completions/dist-installer + usr/share/zsh/vendor-completions/_dist-installer + man/dist-installer.1.ronn Copyright: 2022-2023 ENCRYPTED SUPPORT LP 2022-2022 grass License: GPL-3+-with-additional-terms-1 diff --git a/debian/usability-misc.links b/debian/usability-misc.links index 9676c6f..f7d0d33 100644 --- a/debian/usability-misc.links +++ b/debian/usability-misc.links @@ -7,8 +7,8 @@ /usr/share/man/man1/curl-download.1.gz /usr/share/man/man1/curlget.1.gz /usr/share/man/man1/scurl-download.1.gz /usr/share/man/man1/scurlget.1.gz -/usr/bin/installer-dist /usr/bin/virtualbox-installer -/usr/bin/installer-dist /usr/bin/kicksecure-installer-cli -/usr/bin/installer-dist /usr/bin/kicksecure-installer-xfce -/usr/bin/installer-dist /usr/bin/whonix-installer-cli -/usr/bin/installer-dist /usr/bin/whonix-installer-xfce +/usr/bin/dist-installer-cli /usr/bin/virtualbox-installer-cli +/usr/bin/dist-installer-cli /usr/bin/kicksecure-cli-installer-cli +/usr/bin/dist-installer-cli /usr/bin/kicksecure-xfce-installer-cli +/usr/bin/dist-installer-cli /usr/bin/whonix-cli-installer-cli +/usr/bin/dist-installer-cli /usr/bin/whonix-xfce-installer-cli diff --git a/man/installer-dist.1.ronn b/man/dist-installer-cli.1.ronn similarity index 91% rename from man/installer-dist.1.ronn rename to man/dist-installer-cli.1.ronn index d73b04e..19ca6c5 100644 --- a/man/installer-dist.1.ronn +++ b/man/dist-installer-cli.1.ronn @@ -1,4 +1,4 @@ -installer-dist(1) -- download and import Whonix/Kicksecure VMs +dist-installer-cli(1) -- download and import Whonix/Kicksecure VMs ============================================= ## SYNOPSIS -`installer-dist` [options] +`dist-installer-cli` [options] ## DESCRIPTION -**installer-dist** is an installer that automates the download and import +**dist-installer-cli** is an installer that automates the download and import of Kicksecure and Whonix VMs. It supports interfaces CLI or Xfce, and allows users to choose their preferred hypervisor, such as KVM or VirtualBox. @@ -24,7 +24,7 @@ arguments can be separated by either spaces or an equal sign. If an option is specified multiple times, the last assignment takes precedence. The guest and interface can also be set by renaming the script following the -format . +format . `-g`, `--guest`= @@ -94,7 +94,7 @@ format . `-P`, `--directory-prefix`= Define the absolute path directory to store downloaded files. Defaults to - $HOME/installer-dist-download. The directory must exist and be writable by the user. + $HOME/dist-installer-cli-download. The directory must exist and be writable by the user. Changing this directory without moving the previously downloaded files triggers a new download. `-n`, `--non-interactive` @@ -159,15 +159,15 @@ format . To install Whonix Xfce for KVM: - $ installer-dist --guest=whonix --interface=xfce --hypervisor=kvm + $ dist-installer-cli --guest=whonix --interface=xfce --hypervisor=kvm To install the default configuration using Tor onion routing and a SOCKS proxy: - $ installer-dist --onion --socks-proxy=127.0.0.1:9050 + $ dist-installer-cli --onion --socks-proxy=127.0.0.1:9050 To install the default configuration non-interactively and display info messages: - $ installer-dist --non-interactive --log-level=info + $ dist-installer-cli --non-interactive --log-level=info ## EXIT CODES The installer returns the exit code of the last command executed. diff --git a/usr/bin/installer-dist b/usr/bin/dist-installer-cli similarity index 97% rename from usr/bin/installer-dist rename to usr/bin/dist-installer-cli index b40974a..4ed1a3f 100755 --- a/usr/bin/installer-dist +++ b/usr/bin/dist-installer-cli @@ -156,7 +156,6 @@ Y3B83Y34PxuSIq2kokIGo8JhqfqPB/ohtTLHg/o9RhP8xmfvALRD =Rv7/ -----END PGP PUBLIC KEY BLOCK-----" -virtualbox_version="7.0" virtualbox_linux_user_group="vboxusers" ######################## @@ -773,34 +772,30 @@ claim_unsupported_distro(){ ## Get necessary packages for your host system to be able to set the guest. get_host_pkgs(){ + true "distro: ${distro}" case "${os}" in Linux*) case "${distro}" in - "Debian"*|"Tails"*|"Kicksecure"|"Whonix") - true "distro: ${distro}" + "Debian"*|"Kali"*|"Tails"*|"Kicksecure"|"Whonix") + log notice "Preparing to install packages required for the hypervisor usage, this may take some time." install_package_debian_common install_virtualbox_debian ;; - "Kali") - log error "Kali Linux support is disabled, reason: legal liability" - log error " https://www.kicksecure.com/wiki/Limitations_on_Free_Speech_on_Website_and_Chat#Banned_Subjects" - claim_unsupported_distro known - ;; "Linux Mint"*|"LinuxMint"*|"mint"*) - true "distro: ${distro}" + log notice "Preparing to install packages required for the hypervisor usage, this may take some time." install_package_debian_common install_virtualbox_ubuntu ;; *"buntu"*) - true "distro: ${distro}" if [ "${distro_version_without_dot}" -lt 2204 ]; then die 101 "${underline}Distribution Check:${nounderline} Minimal '${distro}' required version is '22.04', yours is '${distro_version}'." fi + log notice "Preparing to install packages required for the hypervisor usage, this may take some time." install_package_debian_common install_virtualbox_ubuntu ;; "Fedora"*|"CentOS"*|"rhel"*|"Redhat"*|"Red hat") - true "${distro}" + log notice "Preparing to install packages required for the hypervisor usage, this may take some time." install_package_fedora_common install_virtualbox_fedora ;; @@ -901,6 +896,25 @@ secure_boot_test() { } +update_sources(){ + log notice "Updating package list." + # shellcheck disable=SC2086 + root_cmd ${pkg_mngr_update} || + die 1 "${underline}Package List Update:${nounderline} Could not update package lists. + - This issue is most likely not caused by this installer. + - This is most likely a package manager configuration or network issue. + +This is the command which the installer has just run that failed: + +$command_without_extrarenous_spaces + +The user is advised to attempt to debug this with the following steps: +1. Run above command. +2. If there is an issue, use search engines, documentation and if needed + contact the support of your operating system. +3. Once this has been fixed fixed, re-run this installer." +} + ## Install package only if not installed already. install_pkg(){ pkgs="${*}" @@ -925,23 +939,8 @@ install_pkg(){ log notice "Skipping installing the following packages because dry_run is set: '${pkg_not_installed}'" return 0 fi - log notice "Installing package(s): '${pkg_not_installed}'" - log notice "Updating package list." - # shellcheck disable=SC2086 - root_cmd ${pkg_mngr_update} || - die 1 "${underline}Package List Update:${nounderline} Could not update package lists. - - This issue is most likely not caused by this installer. - - This is most likely a package manager configuration or network issue. - -This is the command which the installer has just run that failed: - -$command_without_extrarenous_spaces -The user is advised to attempt to debug this with the following steps: -1. Run above command. -2. If there is an issue, use search engines, documentation and if needed - contact the support of your operating system. -3. Once this has been fixed fixed, re-run this installer." + update_sources log notice "Installing package(s): '${pkg_not_installed}'" # shellcheck disable=SC2086 root_cmd ${pkg_mngr_install} ${pkg_not_installed} || @@ -1131,7 +1130,33 @@ check_vm_exists(){ check_guest_boot(){ if test "${virtualbox_only}" = "1"; then log notice "${underline}VirtualBox Installation Result:${nounderline} ${green}${bold}'SUCCESS'${nobold}${nocolor}" - return 0 + + if test "${no_boot}" = "1"; then + log info "no_boot is set." + log notice "${underline}VirtualBox Startup Check:${nounderline} User declined to start VirtualBox via command line." + log notice "VirtualBox can be started manually." + exit + fi + ## Default to start guest without interaction + if test "${non_interactive}" = "1"; then + log notice "${underline}VirtualBox Startup Check:${nounderline} VirtualBox start agreed by the user by setting non_interactive." + virtualbox + exit + fi + log notice "${bold}Question:${nobold} Do you want to start VirtualBox now? [y/n] (default: yes): " + printf '%s' "Your answer: " + read -r response + log notice "User replied '${response}'" + case ${response} in + ""|[Yy]|[Yy][Ee][Ss]) + log notice "${underline}VirtualBox Startup Check:${nounderline} User accepted to start VirtualBox." + virtualbox + ;; + *) + log notice "${underline}VirtualBox Startup Check:${nounderline} User declined to start VirtualBox." + ;; + esac + exit fi log info "Virtual Machine(s) already exist." @@ -1270,18 +1295,22 @@ start_guest(){ } ## Start the hypervisor with the desired guest -start_virtualbox(){ +start_virtualbox()L{ log notice "Starting Virtual Machine(s)." + ## 'virtualbox' is called after 'vboxmanage' because it hangs till the app + ## is closed, while 'vboxmanage startvm' exits after starting the VMs. case "${guest}" in whonix) log_run notice vboxmanage startvm \ "${guest_pretty}-Gateway-${interface_name}" || virtualbox_start_failed log_run notice vboxmanage startvm \ "${guest_pretty}-Workstation-${interface_name}" || virtualbox_start_failed + virtualbox ;; kicksecure) log_run notice vboxmanage startvm \ "${guest_pretty}-${interface_name}" || virtualbox_start_failed + virtualbox ;; esac log notice "${underline}Virtual Machine Startup Result:${nounderline} ${green}${bold}'SUCCESS'${nobold}${nocolor}" @@ -1560,6 +1589,7 @@ install_repositories_for_virtualbox_on_debian(){ ;; esac + update_sources die 1 "${underline}Repository Add:${nounderline} Unsupported distribution codename: '${distro_codename_real}'!" } @@ -1666,17 +1696,22 @@ install_backports_and_fasttrack_repository_debian() { ## Install VirtualBox on Fedora install_virtualbox_fedora(){ - virtualbox_qt_package_name=VirtualBox-"${virtualbox_version}" + install_pkg kernel-headers kernel-devel dkms + get_virtualbox_version_fedora(){ + virtualbox_version="$(dnf search "virtualbox-*" | grep "^VirtualBox-[[:digit:]]\{1,2\}\.[[:digit:]]\{1,2\}\." | tail -1 | cut -d " " -f1 | cut -d "-" -f2- | cut -d "." -f1)" + virtualbox_qt_package_name=VirtualBox-"${virtualbox_version}" + } + + get_virtualbox_version_fedora has_virtualbox_qt=0 test_pkg "${virtualbox_qt_package_name}" 2>/dev/null && has_virtualbox_qt=1 - install_pkg kernel-headers kernel-devel dkms - ## Guard against adding extraneous repositories. if test "${has_virtualbox_qt}" != "1"; then log notice "VirtualBox Installation: Preparing to install VirtualBox..." install_oracle_repository_fedora + get_virtualbox_version_fedora fi ## This is to make sure loglevel info message is shown: @@ -1690,8 +1725,13 @@ install_virtualbox_fedora(){ ## Install VirtualBox on Debian ## See also comments for install_virtualbox_fedora. install_virtualbox_debian(){ - if test "${oracle_repo}" = "1"; then + get_virtualbox_version_debian(){ + virtualbox_version="$(apt-cache search --names-only --quiet "^virtualbox-[[:digit:]]{1,2}\.[[:digit:]]{1,2}$" | tail -1 | cut -d " " -f1 | cut -d "-" -f2-)" virtualbox_qt_package_name=virtualbox-"${virtualbox_version}" + } + + get_virtualbox_version_debian + if test "${oracle_repo}" = "1"; then ## udev: ## https://www.virtualbox.org/ticket/21804 ## @@ -1712,6 +1752,7 @@ install_virtualbox_debian(){ if test "${has_virtualbox_qt}" != "1"; then log notice "VirtualBox Installation: Preparing to install VirtualBox..." install_repositories_for_virtualbox_on_debian + get_virtualbox_version_debian fi install_pkg "$virtualbox_qt_package_name" @@ -2894,7 +2935,7 @@ Developer options: write capabilities for the calling user. If you change this directory, but the previously downloaded files are not changed to the new directory, the download - start again. \$HOME/installer-dist-download (default). + start again. \$HOME/dist-installer-cli-download (default). -n, --non-interactive Set non-interactive mode, license will be accepted. -D, --dev Set development mode. Empty image to download. @@ -2904,7 +2945,7 @@ Developer options: --virtualbox-only Only downloads and installs VirtualBox. -t, --getopt Show parsed options and quit. File name: - The default file name is installer-dist. Some basic options can be set as + The default file name is dist-installer-cli. Some basic options can be set as the file name if they follow the format 'guest-installer-interface'. Anything different than the default name or the allowed format is rejected. Command line options override the file name definition. @@ -2919,7 +2960,7 @@ set_default(){ get_colors xtrace="" directory_prefix="" - set_arg directory_prefix "${HOME}/installer-dist-download" + set_arg directory_prefix "${HOME}/dist-installer-cli-download" guest="" set_arg guest whonix hypervisor="" @@ -2956,11 +2997,11 @@ set_default(){ ## Parse script name. parse_name(){ ## if using default file name, ignore the rest - test "${me}" = "installer-dist" && return 0 + test "${me}" = "dist-installer-cli" && return 0 ## check if file name is valid case "${me}" in - whonix-installer-xfce | whonix-installer-cli | \ - kicksecure-installer-xfce | kicksecure-installer-cli ) + whonix-xfce-installer-cli | whonix-cli-installer-cli | \ + kicksecure-xfce-installer-cli | kicksecure-cli-installer-cli ) log info "Valid script name to set options: '${me}'" ;; virtualbox-installer ) @@ -2972,13 +3013,12 @@ parse_name(){ *) log error "Invalid script name: '${me}'" log error "If you don't know why this happened, rename this script to" - log error " installer-dist and use command-line options instead." + log error " dist-installer-cli and use command-line options instead." return 2 esac ## assign values according to script name set_arg guest "$(echo "${me}" | cut -d "-" -f1)" - set_arg interface "$(echo "${me}" | cut -d "-" -f3)" - #set_arg hypervisor "$(echo "${me}" | cut -d "-" -f3)" + set_arg interface "$(echo "${me}" | cut -d "-" -f2)" log info "Assigned guest and interface according to script name: '${me}'" return 0 } diff --git a/usr/share/bash-completion/completions/installer-dist b/usr/share/bash-completion/completions/dist-installer-cli similarity index 85% rename from usr/share/bash-completion/completions/installer-dist rename to usr/share/bash-completion/completions/dist-installer-cli index b0211ff..1611739 100644 --- a/usr/share/bash-completion/completions/installer-dist +++ b/usr/share/bash-completion/completions/dist-installer-cli @@ -1,9 +1,9 @@ -# installer-dist(8) completion -*- shell-script -*- +# dist-installer-cli(8) completion -*- shell-script -*- ## Copyright (C) 2023 ENCRYPTED SUPPORT LP ## See the file COPYING for copying conditions. -_installer_dist() +_dist_installer_cli() { local cur prev words cword _init_completion -s || return @@ -57,9 +57,9 @@ _installer_dist() fi } && - complete -F _installer_dist installer-dist \ - kicksecure-installer-cli kicksecure-installer-xfce \ - whonix-installer-cli whonix-installer-xfce \ + complete -F _dist_installer_cli dist-installer-cli \ + kicksecure-cli-installer-cli kicksecure-xfce-installer-cli \ + whonix-cli-installer-cli whonix-xfce-installer-cli \ virtualbox-installer # ex: filetype=sh diff --git a/usr/share/zsh/vendor-completions/_installer-dist b/usr/share/zsh/vendor-completions/_dist-installer similarity index 95% rename from usr/share/zsh/vendor-completions/_installer-dist rename to usr/share/zsh/vendor-completions/_dist-installer index 5fe9147..e0eae26 100644 --- a/usr/share/zsh/vendor-completions/_installer-dist +++ b/usr/share/zsh/vendor-completions/_dist-installer @@ -1,4 +1,4 @@ -#compdef installer-dist kicksecure-installer-cli kicksecure-installer-xfce whonix-installer-cli whonix-installer-xfce virtualbox-installer +#compdef dist-installer-cli kicksecure-cli-installer-cli kicksecure-xfce-installer-cli whonix-cli-installer-cli whonix-xfce-installer-cli virtualbox-installer # vim: set sw=2 sts=2 ts=2 et : ## Copyright (C) 2022 grass ## Copyright (C) 2023 ENCRYPTED SUPPORT LP