#!/bin/bash

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

#set -x
set -e

## Useful when xtrace ("set -x") is enabled and running in the background
## (such as if started as GUI from start menu) to log all xtrace to a log file.
#[[ -v TMP ]] || TMP="/TMP"
#safe-rm -f -- "/$TMP/systemcheck-debug.txt"
#exec 5>&1 1>> "/$TMP/systemcheck-debug.txt"
#exec 6>&2 2>> "/$TMP/systemcheck-debug.txt"

#source /usr/libexec/helper-scripts/lockfile.sh

if [ -o xtrace ]; then
  ## NOTE: Not using 'bash -x' as this would disable AppArmor.
  ## XXX: Might add a superfluous ':xtrace'.
  env SHELLOPTS="${SHELLOPTS-}:xtrace" /usr/libexec/systemcheck/systemcheck "$@"
else
  /usr/libexec/systemcheck/systemcheck "$@"
fi
