#!/bin/bash

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

## Keep the command trace: it is this script's diagnostic output.
set -x
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
shopt -s inherit_errexit
shopt -s shift_verbose
export LC_ALL=C

apt-get-noninteractive update

apt-get-noninteractive --no-install-recommends --yes install tb-updater tb-starter

## sets: boot_session
# shellcheck source=../../../../helper-scripts/usr/libexec/helper-scripts/boot-session-detection.bsh
source "${HELPER_SCRIPTS_PATH:-}"/usr/libexec/helper-scripts/boot-session-detection.bsh

## Assigned by the sourced fragment above, which shellcheck cannot follow in an
## isolated checkout.
# shellcheck disable=SC2154
if [ "${boot_session}" = "sysmaint_session" ]; then
  printf '%s\n' "
------------------------------------------------------------------------------
Done installing tb-updater and tb-starter. Reboot into
\"PERSISTENT Mode | USER Session\", then launch \"Tor Browser (AnonDist)\"
from the application menu to download and run Tor Browser.
------------------------------------------------------------------------------
"
else
  printf '%s\n' "
------------------------------------------------------------------------------
INFO: Done installing tb-updater and tb-starter. Launch \"Tor Browser
(AnonDist)\" from the application menu to download and run Tor Browser.
------------------------------------------------------------------------------
"
fi
