From f87d98dfd6fc9517dca870088d19664681b28136 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Tue, 14 Nov 2023 23:25:25 -0500 Subject: [PATCH] git works --- bin/config.awk | 2 +- bin/mkwgconfig.sh | 2 +- inet2.initd | 11 +++++++++++ setup.sh | 32 +++++++++++++++----------------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/bin/config.awk b/bin/config.awk index f4833ae..9d0a117 100755 --- a/bin/config.awk +++ b/bin/config.awk @@ -1,4 +1,4 @@ -#!/run/current-system/profile/bin/awk -f +#!/usr/bin/awk -f BEGIN { FS = "[ ]"; # use a single space as field separator and don't trim input diff --git a/bin/mkwgconfig.sh b/bin/mkwgconfig.sh index 3afa221..dcbb98f 100755 --- a/bin/mkwgconfig.sh +++ b/bin/mkwgconfig.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # args: /path/to/interface-config /path/to/output.conf inter="$1" diff --git a/inet2.initd b/inet2.initd index 7824bdc..5fe8c7c 100755 --- a/inet2.initd +++ b/inet2.initd @@ -25,7 +25,18 @@ runscripts() { fi } + + start() { + + for file in /sys/class/net/*; do # Clear all wireguard interfaces + type=$(cat "$file/type") + if [ "$type" = "65534" ]; then + ifname="$(basename $file)" + ip link del "$ifname" + fi + done + rm -rf /run/inet2/config 2>/dev/null rm -rf /run/inet2/wg 2>/dev/null cp /config/inet2.conf /run/inet2/inet2.conf diff --git a/setup.sh b/setup.sh index c03fb10..64d5142 100755 --- a/setup.sh +++ b/setup.sh @@ -39,7 +39,7 @@ run sysctl net.ipv6.conf.all.disable_ipv6=0 net.ipv6.conf.default.disable_ipv6=0 ospf="$(haskey OSPF)" escapebird() { - sed -e 's/\\/\\\\/g;s/"/\\"/g' + sed -e 's/\\/\\\\/g;s/"/\\"/g' } if [ -n "$ospf" ]; then @@ -47,7 +47,7 @@ if [ -n "$ospf" ]; then touch /var/log/bird.log chown bird:bird /var/log/bird.log - + selfas=$(getval AS) ( cat < /etc/bird.conf + fi +) > /etc/bird.conf + chown root:bird /etc/bird.conf chmod 640 /etc/bird.conf