#!/bin/bash

## Copyright (C) 2017 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## Copyright (C) 2024 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
## See the file COPYING for copying conditions.

#### meta start
#### project Whonix
#### category networking and firewall
#### description
## firewall starter wrapper
#### meta end

set -eu -o pipefail -o errtrace

if [ -f "/run/qubes/this-is-templatevm" ]; then
  whonix-workstation-firewall "$@"
elif [ -f "/usr/share/anon-gw-base-files/gateway" ]; then
  whonix-gateway-firewall "$@"
elif [ -f "/usr/share/anon-ws-base-files/workstation" ]; then
  whonix-workstation-firewall "$@"
elif [ -f "/usr/share/libvirt-dist/marker" ]; then
  whonix-host-firewall "$@"
else
  echo "ERROR: Neither file /usr/share/anon-gw-base-files/gateway nor file /usr/share/anon-ws-base-files/workstation exists! If this is a Whonix-Gateway, package anon-gw-base-files needs to be installed. If this is a Whonix-Workstation, package anon-ws-base-files needs to be installed." >&2
  exit 1
fi
