diff --git a/override.conf b/override.conf index 6d52022..bf4279a 100644 --- a/override.conf +++ b/override.conf @@ -1,2 +1,7 @@ [Service] -ExtensionDirectories=/var/lib/extensions/tailscale +ExecStartPre= +ExecStartPre=/opt/tailscale/tailscaled --cleanup +ExecStart= +ExecStart=/opt/tailscale/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/run/tailscale/tailscaled.sock --port=${PORT} $FLAGS +ExecStopPost= +ExecStopPost=/opt/tailscale/tailscaled --cleanup diff --git a/tailscale.sh b/tailscale.sh index 2110bd8..f66d621 100644 --- a/tailscale.sh +++ b/tailscale.sh @@ -78,13 +78,15 @@ if ! test -f /etc/default/tailscaled; then cp -rf $tar_dir/systemd/tailscaled.defaults /etc/default/tailscaled fi -# update paths in the unit file -sed -i 's@/usr/sbin/tailscaled@/opt/tailscale/tailscaled@g' /etc/systemd/system/tailscaled.service - # return to our original directory (silently) and clean up popd > /dev/null rm -rf "${dir}" +# copy in our overrides file if it doesn't already exist +if ! test -f /etc/systemd/system/tailscaled.service.d/override.conf; then + mkdir -p /etc/systemd/system/tailscaled.service.d + cp -rf override.conf /etc/systemd/system/tailscaled.service.d/override.conf + echo "done." echo -n "Starting required services..."