Skip to content

Commit 75011ff

Browse files
committed
Fix distro detection for Debian-based derivatives, LMDE, OpenSUSE, and Ubuntu derivatives
1 parent ba653ab commit 75011ff

File tree

1 file changed

+44
-22
lines changed

1 file changed

+44
-22
lines changed

install.sh.in

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,21 @@ elif [ $ID == "ubuntu" ] || [ $ID == "pop" ]; then
297297
write_apt_repo ubuntu $VERSION_ID $ZT_BASE_URL_HTTP ${UBUNTU_CODENAME_MAP[${VERSION_CODENAME}]}
298298
fi
299299
elif [ $ID == "linuxmint" ]; then
300-
echo '*** Detected Linux Mint, creating /etc/apt/sources.list.d/zerotier.list'
301-
302-
# fix for non integer version number
303-
VERSION_ID=$(echo $VERSION_ID | cut -d . -f 1)
300+
# Check if this is LMDE (Linux Mint Debian Edition) - it's Debian-based, not Ubuntu-based
301+
if [ -n "$DEBIAN_CODENAME" ]; then
302+
echo '*** Detected LMDE (Linux Mint Debian Edition), creating /etc/apt/sources.list.d/zerotier.list'
303+
write_apt_repo debian 12 $ZT_BASE_URL_HTTP $DEBIAN_CODENAME
304+
else
305+
echo '*** Detected Linux Mint, creating /etc/apt/sources.list.d/zerotier.list'
304306

305-
if [[ "$VERSION_ID" -gt "$MAX_SUPPORTED_MINT_VERSION" ]]; then
306-
write_apt_repo $ID $MAX_SUPPORTED_MINT_VERSION $ZT_BASE_URL_HTTP $MAX_SUPPORTED_MINT_VERSION_NAME
307-
else
308-
write_apt_repo $ID $VERSION_ID $ZT_BASE_URL_HTTP ${MINT_CODENAME_MAP[${VERSION_CODENAME}]}
307+
# fix for non integer version number
308+
VERSION_ID=$(echo $VERSION_ID | cut -d . -f 1)
309+
310+
if [[ "$VERSION_ID" -gt "$MAX_SUPPORTED_MINT_VERSION" ]]; then
311+
write_apt_repo $ID $MAX_SUPPORTED_MINT_VERSION $ZT_BASE_URL_HTTP $MAX_SUPPORTED_MINT_VERSION_NAME
312+
else
313+
write_apt_repo $ID $VERSION_ID $ZT_BASE_URL_HTTP ${MINT_CODENAME_MAP[${VERSION_CODENAME}]}
314+
fi
309315
fi
310316
elif [ $ID == "kali" ]; then
311317
echo '*** Detected Kali Linux, creating /etc/apt/sources.list.d/zerotier.list'
@@ -322,8 +328,15 @@ elif [ $ID == "centos" ] || [ $ID == "rocky" ] || [ $ID == "almalinux" ] || [ $I
322328
baseurl="${ZT_BASE_URL_HTTP}redhat/fc/22"
323329
fi
324330
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
325-
echo "*** Found RHEL/CentOS/Rocky, creating /etc/yum.repos.d/zerotier.repo"
326-
baseurl="${ZT_BASE_URL_HTTP}redhat/el/\$releasever"
331+
echo "*** Found RHEL/CentOS/Rocky/Alma, creating /etc/yum.repos.d/zerotier.repo"
332+
# Check for EL10+ which may not have packages yet - fall back to EL9
333+
el_version="${VERSION_ID%%.*}"
334+
if [ -n "$el_version" ] && [ "$el_version" -ge 10 ] 2>/dev/null; then
335+
echo "*** Warning: EL${el_version} packages may not be available, using EL9 packages"
336+
baseurl="${ZT_BASE_URL_HTTP}redhat/el/9"
337+
else
338+
baseurl="${ZT_BASE_URL_HTTP}redhat/el/\$releasever"
339+
fi
327340
elif [ -n "`cat /etc/system-release 2>/dev/null | grep -i amazon`" ]; then
328341
echo "*** Found Amazon (CentOS/RHEL based), creating /etc/yum.repos.d/zerotier.repo"
329342
if [ -n "`cat /etc/system-release 2>/dev/null | grep -F 'Amazon Linux 2'`" ]; then
@@ -356,23 +369,32 @@ elif [ $ID == "centos" ] || [ $ID == "rocky" ] || [ $ID == "almalinux" ] || [ $I
356369
else
357370
cat /dev/null | $SUDO yum install -y zerotier-one
358371
fi
359-
elif [ $ID == "opensuse" ] || [ $ID == "suse" ]; then
360-
echo '*** Found SuSE, adding zypper YUM repo...'
361-
cat /dev/null | $SUDO zypper addrepo -t YUM -g ${ZT_BASE_URL_HTTP}redhat/el/7 zerotier
362-
cat /dev/null | $SUDO rpm --import /tmp/zt-gpg-key
363-
364-
echo
365-
echo '*** Installing zeortier-one package...'
366-
367-
cat /dev/null | $SUDO zypper install -y zerotier-one
368-
elif [ $ID == "opensuse-tumbleweed" ]; then
369-
echo '*** Found SuSE Tumbleweed/Leap, adding zypper YUM repo...'
372+
elif [ $ID == "opensuse" ] || [ $ID == "suse" ] || [ $ID == "opensuse-leap" ] || [ $ID == "opensuse-tumbleweed" ]; then
373+
echo '*** Found openSUSE/SUSE, adding zypper YUM repo...'
374+
# Use el/9 for all modern openSUSE variants (Leap 15+, Tumbleweed)
370375
cat /dev/null | $SUDO zypper addrepo -t YUM -G ${ZT_BASE_URL_HTTP}redhat/el/9 zerotier
376+
cat /dev/null | $SUDO rpm --import /tmp/zt-gpg-key
371377

372378
echo
373-
echo '*** Installing zeortier-one package...'
379+
echo '*** Installing zerotier-one package...'
374380

375381
cat /dev/null | $SUDO zypper install -y zerotier-one
382+
elif [[ "$ID_LIKE" == *"ubuntu"* ]] || [[ "$ID_LIKE" == *"debian"* ]]; then
383+
# Fallback for Ubuntu/Debian derivatives (ZorinOS, AnduinOS, elementary, etc.)
384+
# Use UBUNTU_CODENAME if available (Ubuntu derivatives), otherwise VERSION_CODENAME (Debian derivatives)
385+
fallback_codename="${UBUNTU_CODENAME:-$VERSION_CODENAME}"
386+
387+
if [[ "$ID_LIKE" == *"ubuntu"* ]] && [ -n "$fallback_codename" ]; then
388+
echo "*** Detected Ubuntu derivative ($ID), using Ubuntu repos with codename: $fallback_codename"
389+
mapped_codename="${UBUNTU_CODENAME_MAP[$fallback_codename]:-$MAX_SUPPORTED_UBUNTU_VERSION_NAME}"
390+
write_apt_repo ubuntu "$MAX_SUPPORTED_UBUNTU_VERSION" $ZT_BASE_URL_HTTP "$mapped_codename"
391+
elif [[ "$ID_LIKE" == *"debian"* ]] && [ -n "$fallback_codename" ]; then
392+
echo "*** Detected Debian derivative ($ID), using Debian repos with codename: $fallback_codename"
393+
write_apt_repo debian 12 $ZT_BASE_URL_HTTP "$fallback_codename"
394+
else
395+
echo '*** Unknown or unsupported distribution! Aborting.'
396+
exit 1
397+
fi
376398
else
377399
echo '*** Unknown or unsupported distribution! Aborting.'
378400
exit 1

0 commit comments

Comments
 (0)