#!/bin/bash

## Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

## Feel free to delete this file.

set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
shopt -s inherit_errexit
shopt -s shift_verbose
export LC_ALL=C

# shellcheck source=../../../../helper-scripts/usr/libexec/helper-scripts/has.sh
source "${HELPER_SCRIPTS_PATH:-}"/usr/libexec/helper-scripts/has.sh

if test -f /usr/share/anon-gw-base-files/gateway ; then
   name_machine=Whonix-Gateway
   name_lower_case=whonix
   name_regular_case=Whonix
elif test -f /usr/share/anon-ws-base-files/workstation ; then
   name_machine=Whonix-Workstation
   name_lower_case=whonix
   name_regular_case=Whonix
elif test -f /usr/share/libvirt-dist/marker ; then
   name_machine=Whonix-Host
   name_lower_case=whonix
   name_regular_case=Whonix
elif test -f /usr/share/kicksecure/marker ; then
   name_machine=Kicksecure
   name_lower_case=kicksecure
   name_regular_case=Kicksecure
else
   ## Fallback.
   name_machine=dist-base-files
   name_lower_case=dist
   name_regular_case=Dist
fi

if test -f /usr/share/whonix/marker ; then
   project_website="https://www.whonix.org"
else
   project_website="https://www.kicksecure.com"
fi

printf '%s\n' "Welcome to ${name_machine} (TM)!"
printf '%s\n' "${project_website}"
printf '%s\n' "
${name_regular_case} Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC
${name_regular_case} is Freedom Software, and you are welcome to redistribute it under
certain conditions; type \"${name_lower_case}-license\" <enter> for details.
${name_regular_case} is a compilation of software packages, each under its own copyright and
license. The exact license terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

${name_regular_case} GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law; for details type \"${name_lower_case}-disclaimer\" <enter>.
"
if test -f /usr/share/whonix/marker ; then
   printf '%s\n' "${name_regular_case} is a derivative of Debian GNU/Linux and based on Tor.

${name_regular_case} is produced independently from the Tor (r) anonymity software and
carries no guarantee from The Tor Project about quality, suitability or
anything else."
else
   printf '%s\n' "${name_regular_case} is a derivative of Debian GNU/Linux."
fi
printf '%s\n' "
${name_regular_case} is a research project.
"

if has qubesdb-read ; then
   ## Skip Qubes default password until Qubes sudo gets implemented.
   ## https://github.com/QubesOS/qubes-issues/issues/2695
   true
else
   printf '%s\n' "default user account: user
default password: No password required. (Passwordless login.)
"
fi

printf '%s\n' "Type: \"${name_lower_case}\" <enter> for help."
