mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-10-29 11:10:09 +00:00
happy-ish with the Makefile...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
44307bfec7
commit
f6fbb2eec4
@ -1,3 +1,6 @@
|
|||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
INTERFACE := wg0
|
INTERFACE := wg0
|
||||||
|
|
||||||
@ -21,6 +24,8 @@ ALLOWED_IPS ?= ${ALLOWED_IPS}
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
%_id:
|
%_id:
|
||||||
@ mkdir -p $$(dirname $@)
|
@ mkdir -p $$(dirname $@)
|
||||||
wg genkey 2> /dev/null > $@
|
wg genkey 2> /dev/null > $@
|
||||||
@ -48,8 +53,6 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
|
|||||||
wg-quick up $(INTERFACE)
|
wg-quick up $(INTERFACE)
|
||||||
|
|
||||||
|
|
||||||
# XXX need to figure out a way to link this to the .config file without
|
|
||||||
# conflicting with the server's wg0.conf
|
|
||||||
.PRECIOUS: %.wg
|
.PRECIOUS: %.wg
|
||||||
%.wg: $(CLIENT_TPL) $(SERVER_CLIENT_TPL) \
|
%.wg: $(CLIENT_TPL) $(SERVER_CLIENT_TPL) \
|
||||||
%_id %_id.pub %_ip \
|
%_id %_id.pub %_ip \
|
||||||
@ -73,9 +76,9 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
|
|||||||
-e 's/\$${\CLIENT_PUBLIC_KEY}/$(shell sed -e 's/\//\\\//g' "$*_id.pub")/g' \
|
-e 's/\$${\CLIENT_PUBLIC_KEY}/$(shell sed -e 's/\//\\\//g' "$*_id.pub")/g' \
|
||||||
-e 's/\$${\SERVER_PUBLIC_KEY}/$(shell sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")/g' \
|
-e 's/\$${\SERVER_PUBLIC_KEY}/$(shell sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")/g' \
|
||||||
>> "$(SERVER_CONF)"
|
>> "$(SERVER_CONF)"
|
||||||
make update $*.show
|
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: %.show
|
||||||
%.show: %.wg
|
%.show: %.wg
|
||||||
@ [ "$(QRCODE)" == "1" ] \
|
@ [ "$(QRCODE)" == "1" ] \
|
||||||
&& ( echo "# Profile: $*" \
|
&& ( echo "# Profile: $*" \
|
||||||
@ -84,15 +87,21 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
|
|||||||
@ echo
|
@ echo
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: %.client
|
||||||
%.client: $(CLIENT_DIR)/%.wg update $(CLIENT_DIR)/%.show
|
%.client: $(CLIENT_DIR)/%.wg update $(CLIENT_DIR)/%.show
|
||||||
@
|
@
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
.PHONY: update
|
||||||
update:
|
update:
|
||||||
wg syncconf $(INTERFACE) <(wg-quick strip $(INTERFACE))
|
wg syncconf $(INTERFACE) <(wg-quick strip $(INTERFACE))
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: server
|
||||||
server: $(SERVER_CONF)
|
server: $(SERVER_CONF)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user