Merge pull request #5 from legowerewolf/use-provided-systemd-files

Use provided systemd files instead of bundling our own copy
This commit is contained in:
Duncan
2023-07-19 19:22:08 -04:00
committed by GitHub
4 changed files with 22 additions and 34 deletions

2
override.conf Normal file
View File

@@ -0,0 +1,2 @@
[Service]
ExtensionDirectories=/var/lib/extensions/tailscale

View File

@@ -13,10 +13,9 @@ connect through the standard SSH server instead. Suggestions for how to fix this
are welcomed. are welcomed.
1. Clone this repo to your Deck. 1. Clone this repo to your Deck.
2. Copy the `tailscaled.service` file to `/etc/systemd/system/`. 2. Run `sudo bash tailscale.sh` to install Tailscale (or update the existing
3. Run `sudo bash tailscale.sh` to install Tailscale (or update the existing
installation). installation).
4. Run `sudo tailscale up --qr --operator=deck --ssh` to have Tailscale generate 3. Run `sudo tailscale up --qr --operator=deck --ssh` to have Tailscale generate
a login QR code. Scan the code with your phone and authenticate with a login QR code. Scan the code with your phone and authenticate with
Tailscale to bring your Deck onto your network. Tailscale to bring your Deck onto your network.

View File

@@ -53,13 +53,27 @@ mkdir -p /var/lib/extensions
rm -rf /var/lib/extensions/tailscale rm -rf /var/lib/extensions/tailscale
cp -rf tailscale /var/lib/extensions/ cp -rf tailscale /var/lib/extensions/
# copy the systemd files into place
cp -rf $tar_dir/systemd/tailscaled.service /etc/systemd/system
# copy in the defaults file if it doesn't already exist
if ! test -f /etc/default/tailscaled; then
cp -rf $tar_dir/systemd/tailscaled.defaults /etc/default/tailscaled
fi
# return to our original directory (silently) and clean up # return to our original directory (silently) and clean up
popd > /dev/null popd > /dev/null
rm -rf "${dir}" 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
fi
echo "done." echo "done."
echo -n "Starting services..." echo "Starting services..."
if systemctl is-enabled --quiet systemd-sysext && systemctl is-active --quiet systemd-sysext; then if systemctl is-enabled --quiet systemd-sysext && systemctl is-active --quiet systemd-sysext; then
echo "systemd-sysext is already enabled and active" echo "systemd-sysext is already enabled and active"
@@ -71,12 +85,10 @@ systemd-sysext refresh > /dev/null 2>&1
systemctl daemon-reload > /dev/null systemctl daemon-reload > /dev/null
if systemctl is-enabled --quiet tailscaled && systemctl is-active --quiet tailscaled; then if systemctl is-enabled --quiet tailscaled && systemctl is-active --quiet tailscaled; then
echo "tailscaled is already enabled and active" echo "tailscaled is already enabled and active; restarting it..."
systemctl restart tailscaled
else else
systemctl enable tailscaled --now systemctl enable tailscaled --now
fi fi
echo "done." echo "Tailscale installed and ready."
echo "If updating, reboot or run the following to finish the process: sudo systemctl restart tailscaled"

View File

@@ -1,25 +0,0 @@
[Unit]
Description=Tailscale node agent
Documentation=https://tailscale.com/kb/
Wants=network-pre.target
After=network-pre.target NetworkManager.service systemd-resolved.service
[Service]
ExtensionDirectories=/var/lib/extensions/tailscale
ExecStartPre=/usr/sbin/tailscaled --cleanup
ExecStart=/usr/sbin/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/run/tailscale/tailscaled.sock
ExecStopPost=/usr/sbin/tailscaled --cleanup
Restart=on-failure
RuntimeDirectory=tailscale
RuntimeDirectoryMode=0755
StateDirectory=tailscale
StateDirectoryMode=0700
CacheDirectory=tailscale
CacheDirectoryMode=0750
Type=notify
[Install]
WantedBy=multi-user.target