tailscale.sh aktualisiert
This commit is contained in:
47
tailscale.sh
47
tailscale.sh
@@ -4,6 +4,8 @@
|
|||||||
#
|
#
|
||||||
# For more information see:
|
# For more information see:
|
||||||
# https://github.com/ich777/tailscale-container-script/blob/master/README.md
|
# https://github.com/ich777/tailscale-container-script/blob/master/README.md
|
||||||
|
#
|
||||||
|
# tailscale.sh version: 2024-09-25
|
||||||
|
|
||||||
error_handler() {
|
error_handler() {
|
||||||
echo
|
echo
|
||||||
@@ -65,21 +67,18 @@ if [[ ! -f /usr/bin/tailscale || ! -f /usr/bin/tailscaled ]]; then
|
|||||||
echo "Tailscale not found, downloading..."
|
echo "Tailscale not found, downloading..."
|
||||||
echo "Please wait..."
|
echo "Please wait..."
|
||||||
|
|
||||||
TAILSCALE_JSON=$(wget -qO- 'https://pkgs.tailscale.com/stable/?mode=json')
|
TAILSCALE_VERSION=$(wget -qO- 'https://pkgs.tailscale.com/stable/?mode=json' | jq -r '.TarballsVersion')
|
||||||
|
|
||||||
if [ -z "${TAILSCALE_JSON}" ]; then
|
if [ -z "${TAILSCALE_VERSION}" ]; then
|
||||||
echo "ERROR: Can't get Tailscale JSON"
|
echo "ERROR: Can't get Tailscale JSON"
|
||||||
error_handler
|
error_handler
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TAILSCALE_TARBALL=$(echo "${TAILSCALE_JSON}" | jq -r .Tarballs.amd64)
|
|
||||||
TAILSCALE_VERSION=$(echo "${TAILSCALE_JSON}" | jq -r .TarballsVersion)
|
|
||||||
|
|
||||||
if [ ! -d /tmp/tailscale ]; then
|
if [ ! -d /tmp/tailscale ]; then
|
||||||
mkdir -p /tmp/tailscale
|
mkdir -p /tmp/tailscale
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if wget -q -nc --show-progress --progress=bar:force:noscroll -O /tmp/tailscale/tailscale.tgz "https://pkgs.tailscale.com/stable/${TAILSCALE_TARBALL}" ; then
|
if wget -q -nc --show-progress --progress=bar:force:noscroll -O /tmp/tailscale/tailscale.tgz "https://pkgs.tailscale.com/stable/tailscale_${TAILSCALE_VERSION}_amd64.tgz" ; then
|
||||||
echo "Download from Tailscale version ${TAILSCALE_VERSION} successful!"
|
echo "Download from Tailscale version ${TAILSCALE_VERSION} successful!"
|
||||||
else
|
else
|
||||||
echo "ERROR: Download from Tailscale version ${TAILSCALE_VERSION} failed!"
|
echo "ERROR: Download from Tailscale version ${TAILSCALE_VERSION} failed!"
|
||||||
@@ -93,8 +92,42 @@ if [[ ! -f /usr/bin/tailscale || ! -f /usr/bin/tailscaled ]]; then
|
|||||||
cp /tmp/tailscale/tailscale_${TAILSCALE_VERSION}_amd64/tailscaled /usr/bin/tailscaled
|
cp /tmp/tailscale/tailscale_${TAILSCALE_VERSION}_amd64/tailscaled /usr/bin/tailscaled
|
||||||
rm -rf /tmp/tailscale
|
rm -rf /tmp/tailscale
|
||||||
|
|
||||||
echo "Done"
|
echo "Installation Done"
|
||||||
|
|
||||||
|
elif [ "${TAILSCALE_UPDATE}" == "true" ]; then
|
||||||
|
echo "Version Check enabled, please wait..."
|
||||||
|
CUR_V="$(tailscale version --json | jq -r '.short')"
|
||||||
|
LAT_V="$(timeout 5 tailscale version --upstream --json | jq -r '.upstream')"
|
||||||
|
if [ -z "${LAT_V}" ]; then
|
||||||
|
echo "ERROR: Can't grab latest version from Tailscale, continuing..."
|
||||||
|
else
|
||||||
|
if [ "${CUR_V}" == "${LAT_V}" ]; then
|
||||||
|
echo "Tailscale version ${CUR_V} up-to-date, continuing..."
|
||||||
|
else
|
||||||
|
echo "Found new Tailscale version ${LAT_V}, updating, please wait..."
|
||||||
|
if [ ! -d /tmp/tailscale ]; then
|
||||||
|
mkdir -p /tmp/tailscale
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset EXIT_STATUS
|
||||||
|
if wget -q -nc --show-progress --progress=bar:force:noscroll -O /tmp/tailscale/tailscale.tgz "https://pkgs.tailscale.com/stable/tailscale_${LAT_V}_amd64.tgz" ; then
|
||||||
|
echo "Download from Tailscale version ${LAT_V} successful!"
|
||||||
|
else
|
||||||
|
echo "ERROR: Download from Tailscale version ${LAT_V} failed!"
|
||||||
|
echo " Falling back to installed version ${CUR_V}"
|
||||||
|
rm -rf /tmp/tailscale
|
||||||
|
EXIT_STATUS="failed"
|
||||||
|
fi
|
||||||
|
if [ "${EXIT_STATUS}" != "failed" ]; then
|
||||||
|
cd /tmp/tailscale
|
||||||
|
tar -xf /tmp/tailscale/tailscale.tgz
|
||||||
|
cp /tmp/tailscale/tailscale_${TAILSCALE_VERSION}_amd64/tailscale /usr/bin/tailscale
|
||||||
|
cp /tmp/tailscale/tailscale_${TAILSCALE_VERSION}_amd64/tailscaled /usr/bin/tailscaled
|
||||||
|
rm -rf /tmp/tailscale
|
||||||
|
echo "Update Done"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Tailscale found, continuing..."
|
echo "Tailscale found, continuing..."
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user