Skip to content

Commit

Permalink
✨ Lazyloading tailscale scripts instead of softlinks.
Browse files Browse the repository at this point in the history
  • Loading branch information
adyanth committed Jan 20, 2021
1 parent afe5912 commit a83567f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tailscale-enabler*.tgz
Empty file modified etc/init.d/tailscale
100644 → 100755
Empty file.
5 changes: 5 additions & 0 deletions generate-tar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

# Falls back to busybox tar syntax if running on openwrt busybox tar rather than GNU tar
filename="tailscale-enabler-$(git rev-parse HEAD | cut -c1-5).tgz"
tar -czvf $filename usr/ etc/ || tar c -zvf $filename usr/ etc/
23 changes: 23 additions & 0 deletions usr/bin/tailscale
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

version='1.2.10_mips'

if [ ! -f /tmp/tailscale ]; then
echo "Downloading Tailscale ${version} .."

echo -e "tailscale_${version}/tailscale" > /tmp/tailscale_${version}_files.txt

if [ ! -f /tmp/tailscaled ]; then
echo -e "tailscale_${version}/tailscaled" >> /tmp/tailscale_${version}_files.txt
fi

wget -O- https://pkgs.tailscale.com/stable/tailscale_${version}.tgz | tar x -zvf - -C /tmp -T /tmp/tailscale_${version}_files.txt

mv /tmp/tailscale_$version/* /tmp
rm -rf /tmp/tailscale_${version}*

echo "Done!"

fi

/tmp/tailscale "$@"
19 changes: 19 additions & 0 deletions usr/bin/tailscaled
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

version='1.2.10_mips'

if [ ! -f /tmp/tailscaled ]; then
echo "Downloading Tailscale ${version} .."

echo -e "tailscale_${version}/tailscaled" > /tmp/tailscale_${version}_files.txt

wget -O- https://pkgs.tailscale.com/stable/tailscale_${version}.tgz | tar x -zvf - -C /tmp -T /tmp/tailscale_${version}_files.txt

mv /tmp/tailscale_$version/* /tmp
rm -rf /tmp/tailscale_${version}*

echo "Done!"

fi

/tmp/tailscaled "$@"

0 comments on commit a83567f

Please sign in to comment.