diff --git a/setup-qbittorent.zsh b/setup-qbittorent.zsh index aa7cb40..e27b4e0 100755 --- a/setup-qbittorent.zsh +++ b/setup-qbittorent.zsh @@ -23,8 +23,15 @@ printf 'Using interface: %s\n' "${iface}" # <-A|-D> function do_rules { emulate -L zsh + function handle_error { + setopt noxtrace + echo Failed to add iptables rules + rm -f "${save_file}" + exit 1 + } + [[ "${1}" = -A ]] && trap handle_error INT ZERR PS4='Run: ' - setopt errexit xtrace + setopt xtrace doas iptables -t filter "${1}" FORWARD -i "${iface}" -o wg0-mullvad -j ACCEPT doas iptables -t nat "${1}" PREROUTING -d "${2}"/32 -p tcp -m tcp --dport 62000 \