main
parent
2256f13979
commit
64283e97f3
@ -0,0 +1,42 @@
|
|||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
description="WireGuard VPN tunnel"
|
||||||
|
required_dirs="/etc/wireguard"
|
||||||
|
|
||||||
|
WIREGUARD=
|
||||||
|
name=$RC_SVCNAME
|
||||||
|
command="/usr/bin/wg-quick"
|
||||||
|
extra_started_commands="up down"
|
||||||
|
command_user="root"
|
||||||
|
pidfile="/run/$RC_SVCNAME/$RC_SVCNAME.pid"
|
||||||
|
command_background="yes"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need localmount
|
||||||
|
need net
|
||||||
|
}
|
||||||
|
|
||||||
|
start_pre() {
|
||||||
|
checkpath --directory --owner $command_user:$command_user --mode 0775 \
|
||||||
|
/run/$RC_SVCNAME /var/log/$RC_SVCNAME
|
||||||
|
}
|
||||||
|
|
||||||
|
up() {
|
||||||
|
${command} up $WIREGUARD
|
||||||
|
}
|
||||||
|
|
||||||
|
down() {
|
||||||
|
${command} down $WIREGUARD
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ebegin "Starting wireguard"
|
||||||
|
up
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping wireguard"
|
||||||
|
down
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
Loading…
Reference in new issue