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

Deployed script appears to be from master, not main branch #85

Closed
Squelch opened this issue Aug 30, 2024 · 5 comments
Closed

Deployed script appears to be from master, not main branch #85

Squelch opened this issue Aug 30, 2024 · 5 comments

Comments

@Squelch
Copy link

Squelch commented Aug 30, 2024

Whilst testing #76 and #74 I noted that the fetched script from https://install.zerotier.com/ was unchanged. Seeing that further work was also done regarding deployment, I checked again at each new commit.

Expected:

The script fetched with the curl command from https://www.zerotier.com/download/#entry-5 to reflect the changes made and be fixed.
Going directly to https://install.zerotier.com/ to reflect the changes made.

Observed:

The same error shown in console output on Issue #76 when using the curl command.

An unchanged file download from https://install.zerotier.com/ #!/bin/bash <ENDOFSIGSTART=

export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin

ZeroTier install script

All this script does is determine your OS and/or distribution and then add the correct

repository or download the correct package and install it. It then starts the service

and prints your device's ZeroTier address.

Base URL for download.zerotier.com tree; see https://github.com/zerotier/download.zerotier.com if you want to mirror.

Some things want http, some https, so we must specify both. Must include trailing /

ZT_BASE_URL_HTTPS='https://download.zerotier.com/'
ZT_BASE_URL_HTTP='http://download.zerotier.com/'

##########################################################

Maximum Supported Distribution Versions and Codenames

##########################################################

Debian

MAX_SUPPORTED_DEBIAN_VERSION=12
MAX_SUPPORTED_DEBIAN_VERSION_NAME=bookworm

Ubuntu

MAX_SUPPORTED_UBUNTU_VERSION=24.04
MAX_SUPPORTED_UBUNTU_VERSION_NAME=noble

We only do builds for Ubuntu LTS releases. Map non-LTS releases to the nearest previous LTS release.

declare -A UBUNTU_CODENAME_MAP
UBUNTU_CODENAME_MAP["trusty"]="trusty"
UBUNTU_CODENAME_MAP["utopic"]="trusty"
UBUNTU_CODENAME_MAP["vivid"]="trusty"
UBUNTU_CODENAME_MAP["wily"]="trusty"
UBUNTU_CODENAME_MAP["xenial"]="xenial"
UBUNTU_CODENAME_MAP["yakkety"]="xenial"
UBUNTU_CODENAME_MAP["zesty"]="xenial"
UBUNTU_CODENAME_MAP["artful"]="xenial"
UBUNTU_CODENAME_MAP["bionic"]="bionic"
UBUNTU_CODENAME_MAP["cosmic"]="bionic"
UBUNTU_CODENAME_MAP["disco"]="bionic"
UBUNTU_CODENAME_MAP["eoan"]="bionic"
UBUNTU_CODENAME_MAP["focal"]="focal"
UBUNTU_CODENAME_MAP["groovy"]="focal"
UBUNTU_CODENAME_MAP["hirsute"]="focal"
UBUNTU_CODENAME_MAP["impish"]="focal"
UBUNTU_CODENAME_MAP["jammy"]="jammy"
UBUNTU_CODENAME_MAP["kinetic"]="jammy"
UBUNTU_CODENAME_MAP["lunar"]="jammy"
UBUNTU_CODENAME_MAP["mantic"]="jammy"
UBUNTU_CODENAME_MAP["noble"]="noble"

Mint

MAX_SUPPORTED_MINT_VERSION=21.3
MAX_SUPPORTED_MINT_VERSION_NAME=virginia

Map Mint codenames to Ubuntu codenames (and sometimes Debian)

declare -A MINT_CODENAME_MAP
MINT_CODENAME_MAP["virginia"]="jammy"
MINT_CODENAME_MAP["victoria"]="jammy"
MINT_CODENAME_MAP["vera"]="jammy"
MINT_CODENAME_MAP["vanessa"]="jammy"
MINT_CODENAME_MAP["una"]="focal"
MINT_CODENAME_MAP["uma"]="focal"
MINT_CODENAME_MAP["ulyssa"]="focal"
MINT_CODENAME_MAP["ulyana"]="focal"
MINT_CODENAME_MAP["faye"]="bookworm"

##########################################################

End

##########################################################

echo
echo '*** ZeroTier Service Quick Install for Unix-like Systems'
echo
echo '*** Tested OSes / distributions:'
echo
echo '*** MacOS (10.13+) (just installs ZeroTier One.pkg)'
echo '*** Debian Linux (7+)'
echo '*** RedHat/CentOS Linux (6+)'
echo '*** Fedora Linux (16+)'
echo '*** SuSE Linux (12+)'
echo '*** Mint Linux (20+)'
echo '*** Kali Linux (2024.1+)'
echo
echo '*** Supported architectures vary by OS / distribution. We try to support'
echo '*** every system architecture supported by the target.'
echo
echo '*** Please report problems by opening a GitHub issue or Pull Request at: '
echo '*** https://github.com/zerotier/install.zerotier.com'
echo '*** Please include the content of /etc/os-release for your distribution.'
echo

SUDO=
if [ "$UID" != "0" ]; then
if [ -e /usr/bin/sudo -o -e /bin/sudo ]; then
SUDO=sudo
else
echo '*** This quick installer script requires root privileges.'
exit 0
fi
fi

Detect MacOS and install .pkg file there

if [ -e /usr/bin/uname ]; then
if [ "/usr/bin/uname -s" = "Darwin" ]; then
echo '*** Detected MacOS / Darwin, downloading and installing Mac .pkg...'
$SUDO rm -f "/tmp/ZeroTier One.pkg"
curl -s ${ZT_BASE_URL_HTTPS}dist/ZeroTier%20One.pkg >"/tmp/ZeroTier One.pkg"
$SUDO installer -pkg "/tmp/ZeroTier One.pkg" -target /

	echo
	echo '*** Waiting for identity generation...'

	while [ ! -f "/Library/Application Support/ZeroTier/One/identity.secret" ]; do
		sleep 1
	done

	echo
	echo "*** Success! You are connected to port `cat '/Library/Application Support/ZeroTier/One/identity.public' | cut -d : -f 1` of Earth's planetary smart switch."
	echo

	exit 0
fi

fi

Detect already-installed on Linux

if [ -f /usr/sbin/zerotier-one ]; then
echo '*** ZeroTier appears to already be installed.'
exit 0
fi

rm -f /tmp/zt-gpg-key
echo '-----BEGIN PGP PUBLIC KEY BLOCK-----' >/tmp/zt-gpg-key
cat >>/tmp/zt-gpg-key << END_OF_KEY
Comment: GPGTools - https://gpgtools.org

mQINBFdQq7oBEADEVhyRiaL8dEjMPlI/idO8tA7adjhfvejxrJ3Axxi9YIuIKhWU
5hNjDjZAiV9iSCMfJN3TjC3EDA+7nFyU6nDKeAMkXPbaPk7ti+Tb1nA4TJsBfBlm
CC14aGWLItpp8sI00FUzorxLWRmU4kOkrRUJCq2kAMzbYWmHs0hHkWmvj8gGu6mJ
WU3sDIjvdsm3hlgtqr9grPEnj+gA7xetGs3oIfp6YDKymGAV49HZmVAvSeoqfL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iQo+RFdUdaD2Rpq+yUjQHHbj92mlk6Cmaon46wU+5bAWGYpV1Uf+o
wbKw1Xv83Uj9uHo7zv9WDtOUXUiTe/S792icTfRYrKbwkfI8iCltgNhTQNX0lFX/
Sr2y1/dGCTCMEuA/ClqGKCm9lIYdu+4z32V9VXTSX85DsUjLOCO/hl9SHaelJgmi
IJzRY1XLbNDK4IH5eWtbaprkTNIGt00QhsnM5w+rn1tO80giSxXFpKBE+/pAx8PQ
RdVFzxHtTUGMCkZcgOJolk8y+DJWtX8fP+3a4Vq11a3qKJ19VXk3qnuC1aeW7OQF
j6ISyHsNNsnBw5BRaS5tdrpLXw6Z7TKr1eq+FylmoOK0pIw5xOdRmSVoFm4lVcI5
e5EwB7IIRF00IFqrXe8dCT0oDT9RXc6CNh6GIs9D9YKwDPRD/NKQlYoegfa13Jz7
S3RIXtOXudT1+A1kaBpGKnpXOYD3w7jW2l0zAd6a53AAGy4SnL1ac4cml76NIWiF
m2KYzvMJZBk5dAtFa0SgLK4fg8X6Ygoo9E0JsXxSrW9I1JVfo6Ia//YOBMtt4XuN
Awqahjkq87yxOYYTnJmr2OZtQuFboymfMhNqj3G2DYmZ/ZIXXPgwHx0fnd3R0Q==
=JgAv
END_OF_KEY
echo '-----END PGP PUBLIC KEY BLOCK-----' >>/tmp/zt-gpg-key

echo '*** Detecting Linux Distribution'
echo

_old_apt_signing() {
URL=$1
CODENAME=$2
if [ -d /etc/apt/trusted.gpg.d ]; then
$SUDO gpg --dearmor < /tmp/zt-gpg-key > /etc/apt/trusted.gpg.d/zerotier-debian-package-key.gpg
else
$SUDO apt-key add /tmp/zt-gpg-key
fi
echo "deb ${URL}debian/$CODENAME $CODENAME main" >/tmp/zt-sources-list
}

_new_apt_signing() {
URL=$1
CODENAME=$2
$SUDO gpg --dearmor < /tmp/zt-gpg-key > /usr/share/keyrings/zerotier-debian-package-key.gpg
echo "deb [signed-by=/usr/share/keyrings/zerotier-debian-package-key.gpg] ${URL}debian/$CODENAME $CODENAME main" >/tmp/zt-sources-list
}

write_apt_repo() {
DISTRIBUTION=$1
VERSION=$2
URL=$3
CODENAME=$4

if [ ! -d /usr/share/keyrings ]; then
	$SUDO mkdir -p /usr/share/keyrings
fi

$SUDO apt-get update -y
$SUDO apt-get install -y gpg
$SUDO chmod a+r /tmp/zt-gpg-key

if   [[ "$DISTRIBUTION" == "ubuntu" && "$VERSION" < "22.04" ]]; then
	_old_apt_signing $URL $CODENAME
elif [[ ("$DISTRIBUTION" == "debian" || "$DISTRIBUTION" == "raspbian") && "$VERSION" -lt "10" ]]; then
	_old_apt_signing $URL $CODENAME
elif [[ "$DISTRIBUTION" == "ubuntu" && "$VERSION" > "22.03" ]]; then  # comparison to 22.03 is intentional
	_new_apt_signing $URL $CODENAME
elif [[ ("$DISTRIBUTION" == "debian" || "$DISTRIBUTION" == "raspbian") && "$VERSION" -ge "10" ]]; then
	_new_apt_signing $URL $CODENAME
elif [[ "$DISTRIBUTION" == "kali" ]]; then
	_new_apt_signing $URL $CODENAME
elif [[ "$DISTRIBUTION" == "linuxmint" && "$VERSION" == "6" ]]; then
	_new_apt_signing $URL $CODENAME
elif [[ "$DISTRIBUTION" == "linuxmint" && ( "$VERSION" == "21" || "$VERSION" > "21" ) ]]; then
	_new_apt_signing $URL $CODENAME
elif [[ "$DISTRIBUTION" == "linuxmint" && ( "$VERSION" == "20" || ("$VERSION" > "20" && "$VERSION" < "21" ) ) ]]; then
	_old_apt_signing $URL $CODENAME
else
	echo "Unsupported distribution $DISTRIBUTION $VERSION"
	exit 1
fi

$SUDO mv -f /tmp/zt-sources-list /etc/apt/sources.list.d/zerotier.list
$SUDO chown 0 /etc/apt/sources.list.d/zerotier.list
$SUDO chgrp 0 /etc/apt/sources.list.d/zerotier.list

echo
echo '*** Installing zerotier-one package...'

# Pre-1.1.6 Debian package did not properly enumerate its files, causing
# problems when we try to replace it. So just delete them to force.
if [ -d /var/lib/zerotier-one ]; then
	$SUDO rm -f /etc/init.d/zerotier-one /etc/systemd/system/multi-user.target.wants/zerotier-one.service /var/lib/zerotier-one/zerotier-one /usr/local/bin/zerotier-cli /usr/bin/zerotier-cli /usr/local/bin/zero
fi

cat /dev/null | $SUDO apt-get update
cat /dev/null | $SUDO apt-get install -y zerotier-one

}

if [ ! -f /etc/os-release ]; then
echo '*** Cannot detect Linux distribution! Aborting.'
exit 1
fi

source /etc/os-release

if [ $ID == "debian" ] || [ $ID == "raspbian" ]; then
echo '*** Detected Debian Linux, creating /etc/apt/sources.list.d/zerotier.list'

# Debian testing/sid does not declare a VERSION_ID in /etc/os-release
if [ -z "$VERSION_ID" ] || [ $VERSION_ID -gt $MAX_SUPPORTED_DEBIAN_VERSION ]; then
	write_apt_repo $ID $MAX_SUPPORTED_DEBIAN_VERSION $ZT_BASE_URL_HTTP $MAX_SUPPORTED_DEBIAN_VERSION_NAME
else 
	write_apt_repo $ID $VERSION_ID $ZT_BASE_URL_HTTP $VERSION_CODENAME
fi

elif [ $ID == "ubuntu" ] || [ $ID == "pop" ]; then
echo '*** Detected Ubuntu Linux, creating /etc/apt/sources.list.d/zerotier.list'

if [[ "$VERSION_ID" > "$MAX_SUPPORTED_UBUNTU_VERSION" ]]; then
	write_apt_repo ubuntu $MAX_SUPPORTED_UBUNTU_VERSION $ZT_BASE_URL_HTTP $MAX_SUPPORTED_UBUNTU_VERSION_NAME
else 
	write_apt_repo ubuntu $VERSION_ID $ZT_BASE_URL_HTTP ${UBUNTU_CODENAME_MAP[${VERSION_CODENAME}]}
fi

elif [ $ID == "linuxmint" ]; then
echo '*** Detected Linux Mint, creating /etc/apt/sources.list.d/zerotier.list'

if [[ "$VERSION_ID" > "$MAX_SUPPORTED_MINT_VERSION" ]]; then
	write_apt_repo $ID $MAX_SUPPORED_MINT_VERSION $ZT_BASE_URL_HTTP $MAX_SUPPORTED_MINT_VERSION_NAME
else 
	write_apt_repo $ID $VERSION_ID $ZT_BASE_URL_HTTP ${MINT_CODENAME_MAP[${VERSION_CODENAME}]}
fi

elif [ $ID == "kali" ]; then
echo '*** Detected Kali Linux, creating /etc/apt/sources.list.d/zerotier.list'

write_apt_repo $ID $VERSION_ID $ZT_BASE_URL_HTTP $MAX_SUPPORTED_DEBIAN_VERSION_NAME

elif [ $ID == "centos" ] || [ $ID == "rocky" ] || [ $ID == "almalinux" ] || [ $ID == "rhel" ] || [ $ID == "fedora" ] || [ $ID == "amzn" ] || [ $ID == "sangoma" ] || [ $ID == "ol" ]; then
baseurl="${ZT_BASE_URL_HTTP}redhat/el/7"
if [ -n "cat /etc/redhat-release 2>/dev/null | grep -i fedora" ]; then
echo "*** Found Fedora, creating /etc/yum.repos.d/zerotier.repo"
fedora_release="cat /etc/os-release | grep -F VERSION_ID= | cut -d = -f 2"
if [ -n "$fedora_release" ]; then
baseurl="${ZT_BASE_URL_HTTP}redhat/fc/$fedora_release"
else
baseurl="${ZT_BASE_URL_HTTP}redhat/fc/22"
fi
elif [ -n "cat /etc/redhat-release 2>/dev/null | grep -i centos" -o -n "cat /etc/redhat-release 2>/dev/null | grep -i enterprise" -o -n "cat /etc/redhat-release 2>/dev/null | grep -i rocky" -o -n "cat /etc/redhat-release 2>/dev/null | grep -i alma" ]; then
echo "*** Found RHEL/CentOS/Rocky, creating /etc/yum.repos.d/zerotier.repo"
baseurl="${ZT_BASE_URL_HTTP}redhat/el/$releasever"
elif [ -n "cat /etc/system-release 2>/dev/null | grep -i amazon" ]; then
echo "*** Found Amazon (CentOS/RHEL based), creating /etc/yum.repos.d/zerotier.repo"
if [ -n "cat /etc/system-release 2>/dev/null | grep -F 'Amazon Linux 2'" ]; then
baseurl="${ZT_BASE_URL_HTTP}redhat/el/7"
else
baseurl="${ZT_BASE_URL_HTTP}redhat/amzn1/2016.03"
fi
else
echo "*** Found unknown yum-based repo, using el/7, creating /etc/yum.repos.d/zerotier.repo"
fi

$SUDO rpm --import /tmp/zt-gpg-key

$SUDO rm -f /tmp/zerotier.repo
echo '[zerotier]' >/tmp/zerotier.repo
echo 'name=ZeroTier, Inc. RPM Release Repository' >>/tmp/zerotier.repo
echo "baseurl=$baseurl" >>/tmp/zerotier.repo
echo 'enabled=1' >>/tmp/zerotier.repo
echo 'gpgcheck=1' >>/tmp/zerotier.repo

$SUDO mv -f /tmp/zerotier.repo /etc/yum.repos.d/zerotier.repo
$SUDO chown 0 /etc/yum.repos.d/zerotier.repo
$SUDO chgrp 0 /etc/yum.repos.d/zerotier.repo

echo
echo '*** Installing ZeroTier service package...'

if [ -e /usr/bin/dnf ]; then
	cat /dev/null | $SUDO dnf install -y zerotier-one
else
	cat /dev/null | $SUDO yum install -y zerotier-one
fi

elif [ $ID == "opensuse" ] || [ $ID == "suse" ]; then
echo '*** Found SuSE, adding zypper YUM repo...'
cat /dev/null | $SUDO zypper addrepo -t YUM -g ${ZT_BASE_URL_HTTP}redhat/el/7 zerotier
cat /dev/null | $SUDO rpm --import /tmp/zt-gpg-key

echo
echo '*** Installing zeortier-one package...'

cat /dev/null | $SUDO zypper install -y zerotier-one

elif [ $ID == "opensuse-tumbleweed" ]; then
echo '*** Found SuSE Tumbleweed/Leap, adding zypper YUM repo...'
cat /dev/null | $SUDO zypper addrepo -t YUM -G ${ZT_BASE_URL_HTTP}redhat/el/9 zerotier

echo
echo '*** Installing zeortier-one package...'

cat /dev/null | $SUDO zypper install -y zerotier-one

else
echo '*** Unknown or unsupported distribution! Aborting.'
exit 1
fi

$SUDO rm -f /tmp/zt-gpg-key

if [ ! -e /usr/sbin/zerotier-one ]; then
echo
echo '*** Package installation failed! Unfortunately there may not be a package'
echo '*** for your architecture or distribution. For the source go to:'
echo '*** https://github.com/zerotier/ZeroTierOne'
echo
exit 1
fi

echo
echo '*** Enabling and starting ZeroTier service...'

if [ -e /usr/bin/systemctl -o -e /usr/sbin/systemctl -o -e /sbin/systemctl -o -e /bin/systemctl ]; then
$SUDO systemctl enable zerotier-one
$SUDO systemctl start zerotier-one
if [ "$?" != "0" ]; then
echo
echo '*** Package installed but cannot start service! You may be in a Docker'
echo '*** container or using a non-standard init service.'
echo
exit 1
fi
else
if [ -e /sbin/update-rc.d -o -e /usr/sbin/update-rc.d -o -e /bin/update-rc.d -o -e /usr/bin/update-rc.d ]; then
$SUDO update-rc.d zerotier-one defaults
else
$SUDO chkconfig zerotier-one on
fi
$SUDO /etc/init.d/zerotier-one start
fi

echo
echo '*** Waiting for identity generation...'

while [ ! -f /var/lib/zerotier-one/identity.secret ]; do
sleep 1
done

echo
echo "*** Success! You are ZeroTier address [ cat /var/lib/zerotier-one/identity.public | cut -d : -f 1 ]."
echo

exit 0
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEdKXpxFjhpDHx2lenFlcZiCPlKmEFAmZZ8xIVHGNvbnRhY3RA
emVyb3RpZXIuY29tAAoJEBZXGYgj5SphsdMP/ig91AIAjDPDiQJDlDA0D2S3sDVG
NzwGgqJY+kzmtb24FZJbpcP7XgZLp016OPlYyATvagWyfZ37fOwo6d8PJ0G7Onyd
gBnatTvsvqAhKc3OX+4opYEqYc5NtjHfgEuVZfsXQFM5m9AfGoJo/T6JXDYkeaMm
+P8TXdRO4bVotUyOJI6GIzkIIH7Ul7YtwVa4D20MYH0rC32kGORNJwg2OmJrclZP
Yt5qA4qsBrIepPz3axrst8m7mEzWmpT6OTHJuSmJ1NWirMWjGqF8yozftMoCTddo
pQKVkl7/2oHNiorntyulkYT4VYzjOuWBPn/iPwCBi0r7ZEDCteeY937kMZEshgCM
ZZd7w+dfrcdJhSZFigkFOEWf32Jc0NfiyY9GzgWBGVIAZcOCX+tsO+0JUWRp6IHP
r96AIIATOTkxUHbjS4YEpceSKfyt8Xr+ASHfdbqf8cvXEU7tjbsg/LtPCICg4JN7
t3kXKf+hXIXJF8LbRgRN3xMjrrH1yPJwUqd11HR+qjBL/HoFeyRJLht8AegTh33r
TPhkcbUInDkvJauNDd7fAi5QKHVzLeWlFMaOyRS1svoe5CrwynJNzCb33RRnDdSs
ZBar7tuKZJUCmucKeBlKbzCxfCHZM98nCXfNxgebqgh7WKW6YKvZ8SyzH3jwzlYm
yFfswoyCCP/zzRsV
=X16V
-----END PGP SIGNATURE-----

This appears to be install.sh.in from the Master branch (which I asume to have been dropped as the default branch) and not install.sh.in from main branch as expected.

Reproduction:

  1. Execute either curl command given on https://www.zerotier.com/download/#entry-5 on eg. Linux Mint 22 and observe console output.
  2. Go directly to https://install.zerotier.com/ ,download the script and compare to the one on main branch
Diff output 1,5c1 < #!/bin/bash < < # shellcheck disable=SC2148 65,66c61,62 < MAX_SUPPORTED_MINT_VERSION=21.3 < MAX_SUPPORTED_MINT_VERSION_NAME=virginia --- > MAX_SUPPORTED_MINT_VERSION=22 > MAX_SUPPORTED_MINT_VERSION_NAME=wilma 69a66 > MINT_CODENAME_MAP["wilma"]="noble" 222a220 > # shellcheck disable=SC2072 237c235 < if [[ "$DISTRIBUTION" == "ubuntu" && "$VERSION" < "22.04" ]]; then --- > if [[ "$DISTRIBUTION" == "ubuntu" && "$VERSION" < "22.04" ]]; then 249c247 < elif [[ "$DISTRIBUTION" == "linuxmint" && ( "$VERSION" == "21" || "$VERSION" > "21" ) ]]; then --- > elif [[ "$DISTRIBUTION" == "linuxmint" && ( "$VERSION" == "21" || "$VERSION" -gt "21" ) ]]; then 251c249 < elif [[ "$DISTRIBUTION" == "linuxmint" && ( "$VERSION" == "20" || ("$VERSION" > "20" && "$VERSION" < "21" ) ) ]]; then --- > elif [[ "$DISTRIBUTION" == "linuxmint" && ( "$VERSION" == "20" || ("$VERSION" -gt "20" && "$VERSION" -lt "21" ) ) ]]; then 303,304c301,302 < if [[ "$VERSION_ID" > "$MAX_SUPPORTED_MINT_VERSION" ]]; then < write_apt_repo $ID $MAX_SUPPORED_MINT_VERSION $ZT_BASE_URL_HTTP $MAX_SUPPORTED_MINT_VERSION_NAME --- > if [[ "$VERSION_ID" -gt "$MAX_SUPPORTED_MINT_VERSION" ]]; then > write_apt_repo $ID $MAX_SUPPORTED_MINT_VERSION $ZT_BASE_URL_HTTP $MAX_SUPPORTED_MINT_VERSION_NAME 394,396c392,402 < $SUDO systemctl enable zerotier-one < $SUDO systemctl start zerotier-one &lt; if [ "$?" != "0" ]; then --- > if [[ -d /run/systemd/system ]]; then > $SUDO systemctl enable zerotier-one > $SUDO systemctl start zerotier-one &gt; if [ "$?" != "0" ]; then > echo > echo '*** Package installed but cannot start service! You may be in a Docker' > echo '*** container or using a non-standard init service.' > echo > exit 1 > fi > else 398,399c404,405 < echo '*** Package installed but cannot start service! You may be in a Docker' < echo '*** container or using a non-standard init service.' --- > echo '*** Package installed but cannot start service! You may be in a Docker container' > echo '*** or using a non-standard init service.' 401c407 < exit 1 --- > exit 0 424,440d429 < -----BEGIN PGP SIGNATURE----- < < iQJJBAEBCAAzFiEEdKXpxFjhpDHx2lenFlcZiCPlKmEFAmZZ8xIVHGNvbnRhY3RA < emVyb3RpZXIuY29tAAoJEBZXGYgj5SphsdMP/ig91AIAjDPDiQJDlDA0D2S3sDVG < NzwGgqJY+kzmtb24FZJbpcP7XgZLp016OPlYyATvagWyfZ37fOwo6d8PJ0G7Onyd < gBnatTvsvqAhKc3OX+4opYEqYc5NtjHfgEuVZfsXQFM5m9AfGoJo/T6JXDYkeaMm < +P8TXdRO4bVotUyOJI6GIzkIIH7Ul7YtwVa4D20MYH0rC32kGORNJwg2OmJrclZP < Yt5qA4qsBrIepPz3axrst8m7mEzWmpT6OTHJuSmJ1NWirMWjGqF8yozftMoCTddo < pQKVkl7/2oHNiorntyulkYT4VYzjOuWBPn/iPwCBi0r7ZEDCteeY937kMZEshgCM < ZZd7w+dfrcdJhSZFigkFOEWf32Jc0NfiyY9GzgWBGVIAZcOCX+tsO+0JUWRp6IHP < r96AIIATOTkxUHbjS4YEpceSKfyt8Xr+ASHfdbqf8cvXEU7tjbsg/LtPCICg4JN7 < t3kXKf+hXIXJF8LbRgRN3xMjrrH1yPJwUqd11HR+qjBL/HoFeyRJLht8AegTh33r < TPhkcbUInDkvJauNDd7fAi5QKHVzLeWlFMaOyRS1svoe5CrwynJNzCb33RRnDdSs < ZBar7tuKZJUCmucKeBlKbzCxfCHZM98nCXfNxgebqgh7WKW6YKvZ8SyzH3jwzlYm < yFfswoyCCP/zzRsV < =X16V < -----END PGP SIGNATURE-----

ZT-install.diff.txt

Additional information

Consulting the output from Git-Workflow checks on the most recent pull #84, the following hint caught my eye.
Git-workfolw-hint

Temporarily overriding HOME='/home/runner/work/_temp/c77558e5-f7b2-4765-9711-baca33d6496b' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /home/runner/work/install.zerotier.com/install.zerotier.com
Deleting the contents of '/home/runner/work/install.zerotier.com/install.zerotier.com'
Initializing the repository
/usr/bin/git init /home/runner/work/install.zerotier.com/install.zerotier.com
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m
Initialized empty Git repository in /home/runner/work/install.zerotier.com/install.zerotier.com/.git/
/usr/bin/git remote add origin https://github.com/zerotier/install.zerotier.com

If I'm understaning that correctly, a new git config is written for the safe directory, and this ends up referencing Master branch without explicitly setting the init.defaultBranch variable. Cloning the repo and checking status shows that main is the default branch:

/install.zerotier.com$ git status
On branch main
Your branch is up-to-date with 'origin/main'.

nothing to commit, working tree clean

/install.zerotier.com/.git/config reveals that main is indeed the referenced branch for a clone as expected, but there is no init.defaultBranch entry.

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = https://github.com/zerotier/install.zerotier.com.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
	remote = origin
	merge = refs/heads/main

I am unable to simulate a fix for this by adding the init variable to git config with my current workspace and environment, but I suspect that hint will produce the correct results.

@glimberg
Copy link
Contributor

It is most certainly built off the main branch, and https://install.zerotier.com is serving what's currently on the main branch

diff <(curl -s https://install.zerotier.com) <(curl -s https://raw.githubusercontent.com/zerotier/install.zerotier.com/main/htdocs/install.sh)

returns no output because there is no difference

@glimberg
Copy link
Contributor

 docker run -it linuxmintd/mint22-amd64:latest bash
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
root@2ba02cdd5728:/# apt update && apt install -y curl

<snip>
...
</snip>

Preparing to unpack .../curl_8.5.0-2ubuntu10.3_amd64.deb ...
Unpacking curl (8.5.0-2ubuntu10.3) ...
Setting up libcurl4t64:amd64 (8.5.0-2ubuntu10.3) ...
Setting up curl (8.5.0-2ubuntu10.3) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.1) ...

root@2ba02cdd5728:/# curl https://install.zerotier.com | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
*** ZeroTier Service Quick Install for Unix-like Systems

*** Tested OSes / distributions:

***   MacOS (10.13+) (just installs ZeroTier One.pkg)
***   Debian Linux (7+)
***   RedHat/CentOS Linux (6+)
***   Fedora Linux (16+)
***   SuSE Linux (12+)
***   Mint Linux (20+)
***   Kali Linux (2024.1+)

*** Supported architectures vary by OS / distribution. We try to support
*** every system architecture supported by the target.

*** Please report problems by opening a GitHub issue or Pull Request at:
*** https://github.com/zerotier/install.zerotier.com
*** Please include the content of `/etc/os-release` for your distribution.

100 17262  100 17262    0     0  45839      0 --:--:-- --:--:-- --:--:-- 46278
*** Detecting Linux Distribution

*** Detected Ubuntu Linux, creating /etc/apt/sources.list.d/zerotier.list
Ign:1 http://packages.linuxmint.com wilma InRelease
Hit:2 http://packages.linuxmint.com wilma Release
Hit:3 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:4 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:5 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gpg is already the newest version (2.4.4-2ubuntu17).
gpg set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 171 not upgraded.

*** Installing zerotier-one package...
Get:1 http://download.zerotier.com/debian/noble noble InRelease [20.5 kB]
Ign:2 http://packages.linuxmint.com wilma InRelease
Hit:3 http://packages.linuxmint.com wilma Release
Hit:4 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:5 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:6 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:7 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Get:8 http://download.zerotier.com/debian/noble noble/main amd64 Packages [587 B]
Fetched 21.1 kB in 5s (4,411 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  zerotier-one
0 upgraded, 1 newly installed, 0 to remove and 171 not upgraded.
Need to get 3,534 kB of archives.
After this operation, 11.1 MB of additional disk space will be used.
Get:1 http://download.zerotier.com/debian/noble noble/main amd64 zerotier-one amd64 1.14.0 [3,534 kB]
Fetched 3,534 kB in 0s (16.3 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package zerotier-one.
(Reading database ... 90223 files and directories currently installed.)
Preparing to unpack .../zerotier-one_1.14.0_amd64.deb ...
Unpacking zerotier-one (1.14.0) ...
Setting up zerotier-one (1.14.0) ...
Created symlink /etc/systemd/system/multi-user.target.wants/zerotier-one.service → /usr/lib/systemd/system/zerotier-one.service.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for man-db (2.12.0-4build2) ...

*** Enabling and starting ZeroTier service...

*** Package installed but cannot start service! You may be in a Docker container
*** or using a non-standard init service.

@Squelch
Copy link
Author

Squelch commented Aug 30, 2024

That is reallt bizarre. A fresh download from https://install.zerotier.com/ is still fetching an old file with the following Mint entries, not the new.

# Mint

MAX_SUPPORTED_MINT_VERSION=21.3
MAX_SUPPORTED_MINT_VERSION_NAME=virginia

# Map Mint codenames to Ubuntu codenames (and sometimes Debian)
declare -A MINT_CODENAME_MAP
MINT_CODENAME_MAP["virginia"]="jammy"
MINT_CODENAME_MAP["victoria"]="jammy"
MINT_CODENAME_MAP["vera"]="jammy"
MINT_CODENAME_MAP["vanessa"]="jammy"
MINT_CODENAME_MAP["una"]="focal"
MINT_CODENAME_MAP["uma"]="focal"
MINT_CODENAME_MAP["ulyssa"]="focal"
MINT_CODENAME_MAP["ulyana"]="focal"
MINT_CODENAME_MAP["faye"]="bookworm"`

However, your command does indeed return no diff.

I can only presume there must be some weird caching issue my end. Would you please humour me and directly download from https://install.zerotier.com/ and check for the same?

@Squelch
Copy link
Author

Squelch commented Aug 30, 2024

Would you credit it!? Now it's working...

*** Installing zerotier-one package...
Hit:1 http://mirror.plusserver.com/ubuntu/ubuntu noble InRelease
Hit:2 http://mirror.plusserver.com/ubuntu/ubuntu noble-updates InRelease       
Hit:3 http://security.ubuntu.com/ubuntu noble-security InRelease               
Hit:4 http://mirror.plusserver.com/ubuntu/ubuntu noble-backports InRelease     
Get:5 http://download.zerotier.com/debian/noble noble InRelease [20.5 kB]      
Hit:6 https://brave-browser-apt-release.s3.brave.com stable InRelease          
Hit:7 https://packages.microsoft.com/repos/code stable InRelease               
Ign:8 https://fastly.linuxmint.io wilma InRelease
Hit:9 https://fastly.linuxmint.io wilma Release
Get:11 http://download.zerotier.com/debian/noble noble/main i386 Packages [615 B]
Get:12 http://download.zerotier.com/debian/noble noble/main amd64 Packages [619 B]
Fetched 21.8 kB in 2s (10.9 kB/s)  
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed
  zerotier-one
0 to upgrade, 1 to newly install, 0 to remove and 1 not to upgrade.
Need to get 0 B/3,534 kB of archives.
After this operation, 11.1 MB of additional disk space will be used.
Selecting previously unselected package zerotier-one.
(Reading database ... 442745 files and directories currently installed.)
Preparing to unpack .../zerotier-one_1.14.0_amd64.deb ...
Unpacking zerotier-one (1.14.0) ...
Setting up zerotier-one (1.14.0) ...
Processing triggers for man-db (2.12.0-4build2) ...

*** Enabling and starting ZeroTier service...
Created symlink /etc/systemd/system/multi-user.target.wants/zerotier-one.service → /usr/lib/systemd/system/zerotier-one.service.

*** Waiting for identity generation...

*** Success! You are ZeroTier address ,,,

This issue was a waste of effort despite me running the install and fetching the file numerous times. Oh well, practice makes perfect I guess.

The direct link is still giving me the old file fwiw.

@Squelch Squelch closed this as completed Aug 30, 2024
@Squelch
Copy link
Author

Squelch commented Aug 30, 2024

As a follow up, and for full documentaion:
$ curl https://install.zerotier.com
fetches the correct file.

Following the link https://install.zerotier.com in a browser (Brave - chromium based) fetches the old file.

This appears to be an internet cache problem that is apparently slowly resolving itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants