You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
693 B
43 lines
693 B
#!/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 $?
|
|
}
|