Save tailscale state between reboots

This commit is contained in:
Konstantin Koshelev 2022-06-27 17:48:35 -07:00
parent 2e2e575528
commit 8b99615484
No known key found for this signature in database
GPG key ID: 51CA6748A7A4A97F
3 changed files with 6 additions and 17 deletions

View file

@ -1,11 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present kkoshelev (https://github.com/kkoshelev)
. /etc/profile
if [ "$(get_setting tailscale.up)" == "1" ]
then
set_setting tailscale.up 0
nohup tailscale down &
fi

View file

@ -16,9 +16,9 @@ pre_unpack() {
}
makeinstall_target() {
mkdir -p ${INSTALL}/usr/bin/
cp ${PKG_BUILD}/tailscale ${INSTALL}/usr/bin/
cp ${PKG_BUILD}/tailscaled ${INSTALL}/usr/bin/
mkdir -p ${INSTALL}/usr/sbin/
cp ${PKG_BUILD}/tailscale ${INSTALL}/usr/sbin/
cp ${PKG_BUILD}/tailscaled ${INSTALL}/usr/sbin/
mkdir -p ${INSTALL}/usr/config
cp -R ${PKG_DIR}/config/tailscaled.defaults ${INSTALL}/usr/config

View file

@ -6,9 +6,9 @@ After=network-pre.target
[Service]
EnvironmentFile=/storage/.config/tailscaled.defaults
ExecStartPre=/usr/bin/tailscaled --cleanup
ExecStart=/usr/bin/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/run/tailscale/tailscaled.sock --port $PORT $FLAGS
ExecStopPost=/usr/bin/tailscaled --cleanup
ExecStartPre=/usr/sbin/tailscaled --cleanup
ExecStart=/usr/sbin/tailscaled --state=/storage/.cache/tailscale/tailscaled.state --socket=/run/tailscale/tailscaled.sock --port $PORT $FLAGS
ExecStopPost=/usr/sbin/tailscaled --cleanup
Restart=on-failure