From ff68e7393de6e0bbbc8e4c8b7be239189ae2c691 Mon Sep 17 00:00:00 2001 From: dazller4554328 <105602852+dazller4554328@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:15:57 +0200 Subject: [PATCH] Update wg_install.sh --- wg_install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wg_install.sh b/wg_install.sh index 7213699..62794d3 100644 --- a/wg_install.sh +++ b/wg_install.sh @@ -16,6 +16,13 @@ fi # Install WireGuard write_log "Starting WireGuard installation..." +# Remove any existing wg0 interface +if ip link show wg0 > /dev/null 2>&1; then + write_log "Removing existing wg0 interface..." + wg-quick down wg0 >> "$LOGFILE" 2>&1 || write_log "ERROR: Failed to bring down wg0 interface." + ip link del dev wg0 >> "$LOGFILE" 2>&1 || write_log "ERROR: Failed to delete wg0 interface." +fi + apt-get update -y >> "$LOGFILE" 2>&1 || write_log "ERROR: Failed to update package list." apt-get install -y wireguard >> "$LOGFILE" 2>&1 || write_log "ERROR: WireGuard installation failed."