#!/bin/bash

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

#### meta start
#### project Whonix
#### category firewall and usability
#### description
## wrapper to open firewall examples
#### meta end

set -x

source /usr/libexec/helper-scripts/use_sudo.sh
sudo_error_exit_if_unavailable

## https://bugzilla.xfce.org/show_bug.cgi?id=15282
## https://github.com/lxqt/lxqt-sudo/issues/114
## https://forums.whonix.org/t/use-sudoedit-in-whonix-documentation-and-whonix-software/7599/30

if [ -f "/usr/share/anon-gw-base-files/gateway" ]; then
  gsudoedit /etc/whonix_firewall.d/30_whonix_gateway_default.conf
elif [ -f "/usr/share/anon-ws-base-files/workstation" ]; then
  gsudoedit /etc/whonix_firewall.d/30_whonix_workstation_default.conf
elif [ -f "/usr/share/libvirt-dist/marker" ]; then
  gsudoedit /etc/whonix_firewall.d/30_whonix_host_default.conf
else
  printf '%s\n' "ERROR: Running system does not appear to be Whonix-Gateway, Whonix-Workstation, or Whonix-Host!"
fi
