#!/bin/bash

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

#### meta start
#### project Whonix
#### category tor and usability
#### description
#### gateway_only yes
## Tor apt sources and version info command line tool.
#### meta end

set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
shopt -s inherit_errexit
shopt -s shift_verbose

if [ ! -e /etc/apt/sources.list.d/torproject.sources ]; then
   printf '%s\n' "INFO: /etc/apt/sources.list.d/torproject.sources does not exist."
else
   uncommented_lines="$(grep -v '^[[:space:]]*#' /etc/apt/sources.list.d/torproject.sources | grep deb)" || true
   printf '%s\n' "INFO: /etc/apt/sources.list.d/torproject.sources uncommented lines:
${uncommented_lines}"
fi

tor_version="$(dpkg-query --show --showformat='${Version}' "tor")" || true
printf '%s\n' "INFO: version of the 'tor' package: ${tor_version}"
