Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add check version each arch #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions usr/bin/tailscale
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@ set -e

if [ ! -f /tmp/tailscale ]; then
arch=`uname -m`
if [ "$arch" == "mips" ]; then
endianness=`echo -n I | hexdump -o | awk '{ print (substr($2,6,1)=="1") ? "le" : ""; exit }'`
elif [ "$arch" == "armv7l" ]; then
arch=arm
elif [ "$arch" == "aarch64" ]; then
arch=arm64
elif [ "$arch" == "x86_64" ]; then
arch=amd64
case "$arch" in
mips)
endianness=`echo -n I | hexdump -o | awk '{ print (substr($2,6,1)=="1") ? "le" : ""; exit }'`
;;
armv7l)
arch=arm
;;
aarch64)
arch=arm64
;;
x86_64)
arch=amd64
;;
esac

latest_version=`wget -O- https://pkgs.tailscale.com/stable/ | grep -o "tailscale_[0-9.]*_${arch}.tgz" | grep -o '[0-9.]*' | head -n 1`

if [ -z "$latest_version" ]; then
echo "Error: Failed to fetch the latest Tailscale version for $arch architecture."
exit 1
fi

tailscale_version="1.46.0"

latest_version=`wget -O- https://pkgs.tailscale.com/stable/ | grep tailscale_ | head -1 | cut -d'_' -f 2`
tailscale_version="1.46.0" # Your desired version (fallback if fetching the latest fails)

if [ "$tailscale_version" != "$latest_version" ]; then
tailscale_version=$latest_version
fi
Expand Down
33 changes: 22 additions & 11 deletions usr/bin/tailscaled
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@ set -e

if [ ! -f /tmp/tailscaled ]; then
arch=`uname -m`
if [ "$arch" == "mips" ]; then
endianness=`echo -n I | hexdump -o | awk '{ print (substr($2,6,1)=="1") ? "le" : ""; exit }'`
elif [ "$arch" == "armv7l" ]; then
arch=arm
elif [ "$arch" == "aarch64" ]; then
arch=arm64
elif [ "$arch" == "x86_64" ]; then
arch=amd64
case "$arch" in
mips)
endianness=`echo -n I | hexdump -o | awk '{ print (substr($2,6,1)=="1") ? "le" : ""; exit }'`
;;
armv7l)
arch=arm
;;
aarch64)
arch=arm64
;;
x86_64)
arch=amd64
;;
esac

latest_version=`wget -O- https://pkgs.tailscale.com/stable/ | grep -o "tailscale_[0-9.]*_${arch}.tgz" | grep -o '[0-9.]*' | head -n 1`

if [ -z "$latest_version" ]; then
echo "Error: Failed to fetch the latest Tailscale version for $arch architecture."
exit 1
fi

tailscale_version="1.46.0"
tailscale_version="1.46.0" # Your desired version (fallback if fetching the latest fails)

latest_version=`wget -O- https://pkgs.tailscale.com/stable/ | grep tailscale_ | head -1 | cut -d'_' -f 2`
if [ "$tailscale_version" != "$latest_version" ]; then
tailscale_version=$latest_version
fi
Expand All @@ -25,7 +36,7 @@ if [ ! -f /tmp/tailscaled ]; then

echo "Downloading Tailscale ${version} .."

echo -e "tailscale_${version}/tailscaled" > /tmp/tailscale_${version}_files.txt
echo -e "tailscale_${version}/tailscale\ntailscale_${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

Expand Down