#!/usr/bin/openrc-run
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

name="tailscaled"
description="Tailscale node agent"
command=/usr/bin/tailscaled
command_args="--state=/var/lib/tailscale/tailscaled.state --socket=/run/tailscale/tailscaled.sock --port ${tailscaled_port:-41641} ${tailscaled_args}"
supervisor=supervise-daemon

depend() {
	need net
	use logger
}

start_pre() {
	if [ ! -d /run/tailscale ]; then
		mkdir /run/tailscale
	fi
}
