From e6db5af777e73c346275b9d2f9aab481a4ac1963 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 17 Jan 2022 13:28:24 +0100 Subject: [PATCH] bin/walli: ignore invalid EUID --- .local/bin/scripts/walli | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.local/bin/scripts/walli b/.local/bin/scripts/walli index a3cc4db..f2f1979 100755 --- a/.local/bin/scripts/walli +++ b/.local/bin/scripts/walli @@ -1,10 +1,9 @@ -#!/bin/sh +#!/bin/sh -e # Blocks internet at night using iptables and enables it only upon request # TODO Migrate to nftables # Auto-elevate -test "$EUID" -eq 0 || exec sudo "$0" "$@" -set -e +test ${EUID:-0} -eq 0 || exec sudo "$0" "$@" # https://askubuntu.com/a/124512 and https://blog.sleeplessbeastie.eu/2018/06/21/how-to-create-iptables-firewall-using-custom-chains/ iptables --new-chain chain-times 2>/dev/null || iptables --flush chain-times