2021-02-24 16:46:27 +00:00
|
|
|
CFLAGS = -std=gnu99 -pie -fPIC -pedantic -Wno-imports -Wunused -Wno-missing-field-initializers -Wextra -Wunreachable-code -O3
|
2021-02-24 08:13:25 +00:00
|
|
|
|
2024-02-09 18:57:33 +00:00
|
|
|
all: wireguard_mount wireguard_resolve vpn
|
2021-02-24 08:13:25 +00:00
|
|
|
|
2024-02-07 21:55:12 +00:00
|
|
|
wireguard_mount: src/wireguard-mount.c
|
2021-02-24 08:13:25 +00:00
|
|
|
mkdir -p bin
|
2021-02-24 17:33:43 +00:00
|
|
|
gcc $(CFLAGS) -o bin/wireguard-mount src/wireguard-mount.c -lsystemd
|
2021-02-24 08:13:25 +00:00
|
|
|
|
2024-02-07 21:55:12 +00:00
|
|
|
wireguard_resolve: src/resolve.c src/resolve.s
|
2021-02-24 08:13:25 +00:00
|
|
|
mkdir -p bin
|
2021-02-24 17:33:43 +00:00
|
|
|
gcc -shared -o bin/wireguard-resolve.so -nostdlib -fPIC src/resolve.c src/resolve.s
|
2024-02-07 21:55:12 +00:00
|
|
|
|
2024-02-09 18:57:33 +00:00
|
|
|
vpn: src/vpn.c
|
2024-02-09 18:49:10 +00:00
|
|
|
mkdir -p bin
|
2024-02-09 18:57:33 +00:00
|
|
|
gcc $(CFLAGS) -o bin/vpn src/vpn.c
|
2024-02-09 18:49:10 +00:00
|
|
|
|
|
|
|
format: src scripts
|
|
|
|
clang-format -i src/*.c
|
|
|
|
ruff --fix scripts
|
|
|
|
black scripts
|
|
|
|
|
|
|
|
install_mount: systemd bin
|
2024-02-08 23:21:40 +00:00
|
|
|
mkdir -p /snacks/wireguard/bin
|
|
|
|
cp bin/wireguard-mount /snacks/wireguard/bin/wireguard-mount
|
|
|
|
cp systemd/wireguard-mount.service /etc/systemd/system/wireguard-mount.service
|
|
|
|
chmod -R 755 /snacks/wireguard
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl enable wireguard-mount
|
|
|
|
systemctl start wireguard-mount
|
|
|
|
|
2024-02-07 21:55:12 +00:00
|
|
|
install_basic: systemd scripts bin
|
|
|
|
mkdir -p /snacks/wireguard/bin
|
|
|
|
mkdir -p /snacks/wireguard/scripts
|
|
|
|
cp systemd/vpnclient-wg-basic.service /etc/systemd/system/vpnclient-wg-basic.service
|
|
|
|
cp scripts/connect_basic.py /snacks/wireguard/scripts/connect_basic.py
|
|
|
|
cp scripts/inner_basic.sh /snacks/wireguard/scripts/inner_basic.sh
|
2024-02-09 19:38:42 +00:00
|
|
|
cp scripts/is_root_namespace.py /snacks/wireguard/scripts/is_root_namespace.py
|
2024-02-10 00:02:54 +00:00
|
|
|
cp scripts/dns.nft /snacks/wireguard/scripts/dns.nft
|
2024-02-10 16:58:50 +00:00
|
|
|
cp scripts/create_conf.py /snacks/wireguard/scripts/create_conf.py
|
2024-02-09 20:12:13 +00:00
|
|
|
cat scripts/vpn_prompt.sh >> /etc/zsh/zshrc
|
2024-02-09 18:57:33 +00:00
|
|
|
cp bin/vpn /usr/local/bin/vpn
|
|
|
|
setcap cap_sys_admin,cap_sys_ptrace=ep /usr/local/bin/vpn
|
2024-02-07 21:55:12 +00:00
|
|
|
chmod -R 755 /snacks/wireguard
|
|
|
|
systemctl daemon-reload
|