From c1ef60b378d4227fd7bf80c3c464cd1885fd3de4 Mon Sep 17 00:00:00 2001 From: Roy Olav Purser Date: Wed, 24 Feb 2021 18:33:43 +0100 Subject: [PATCH] add systemd service --- Makefile | 8 ++++---- {resolver => src}/resolve.c | 0 {resolver => src}/resolve.s | 0 {mount-daemon => src}/wireguard-mount.c | 0 wireguard-mount.service | 16 ++++++++++++++++ 5 files changed, 20 insertions(+), 4 deletions(-) rename {resolver => src}/resolve.c (100%) rename {resolver => src}/resolve.s (100%) rename {mount-daemon => src}/wireguard-mount.c (100%) create mode 100644 wireguard-mount.service diff --git a/Makefile b/Makefile index 85bca2c..077e48c 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,10 @@ CFLAGS = -std=gnu99 -pie -fPIC -pedantic -Wno-imports -Wunused -Wno-missing-fiel all: wireguard-mount wireguard-resolve -wireguard-mount: mount-daemon/wireguard-mount.c +wireguard-mount: src/wireguard-mount.c mkdir -p bin - gcc $(CFLAGS) -o bin/wireguard-mount mount-daemon/wireguard-mount.c -lsystemd + gcc $(CFLAGS) -o bin/wireguard-mount src/wireguard-mount.c -lsystemd -wireguard-resolve: resolver/resolve.c resolver/resolve.s +wireguard-resolve: src/resolve.c src/resolve.s mkdir -p bin - gcc -shared -o bin/wireguard-resolve.so -nostdlib -fPIC resolver/resolve.c resolver/resolve.s + gcc -shared -o bin/wireguard-resolve.so -nostdlib -fPIC src/resolve.c src/resolve.s diff --git a/resolver/resolve.c b/src/resolve.c similarity index 100% rename from resolver/resolve.c rename to src/resolve.c diff --git a/resolver/resolve.s b/src/resolve.s similarity index 100% rename from resolver/resolve.s rename to src/resolve.s diff --git a/mount-daemon/wireguard-mount.c b/src/wireguard-mount.c similarity index 100% rename from mount-daemon/wireguard-mount.c rename to src/wireguard-mount.c diff --git a/wireguard-mount.service b/wireguard-mount.service new file mode 100644 index 0000000..a6636e4 --- /dev/null +++ b/wireguard-mount.service @@ -0,0 +1,16 @@ +[Unit] +Description=Wireguard namespace mountpoint +Requires=network.target +After=network.target +RefuseManualStop=true + +[Service] +Type=notify +NotifyAccess=main +RuntimeDirectory=vpn +RuntimeDirectoryMode=0755 +ExecStart=/snacks/wireguard/bin/wireguard-mount +PrivateNetwork=true + +[Install] +WantedBy=multi-user.target