Skip to content

Commit caa821b

Browse files
silentJET85philclifford
authored andcommitted
fix: accurately detect Debian Sid
1 parent e5aaf8c commit caa821b

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

deb-get

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,22 +1357,24 @@ if ! [[ ' ubuntu debian ' =~ " ${UPSTREAM_ID} " ]]; then
13571357
fi
13581358
fi
13591359

1360-
local codename
1361-
for codename in UBUNTU_CODENAME DEBIAN_CODENAME VERSION_CODENAME; do
1362-
UPSTREAM_CODENAME=$(sed -n -e "s/^$codename=//p" "${OS_RELEASE}")
1363-
[ -z "${UPSTREAM_CODENAME}" ] || break
1364-
done
1365-
1366-
# Debian 12+
1367-
if [ -z "${UPSTREAM_CODENAME}" ] && [ -e /etc/debian_version ]; then
1368-
UPSTREAM_CODENAME=$(cut -d / -f 1 /etc/debian_version)
1360+
# Debian Sid doesn't have it's own unique os-release file. It is the same as Debian stable.
1361+
# So we first check /etc/debian_version to see if we're running sid. If not, we will trust what os-release says.
1362+
if [[ "${UPSTREAM_ID}" == "debian" ]] && grep -q "sid" /etc/debian_version; then
1363+
UPSTREAM_CODENAME="sid"
1364+
OS_CODENAME="sid"
1365+
else
1366+
local codename
1367+
for codename in UBUNTU_CODENAME DEBIAN_CODENAME VERSION_CODENAME; do
1368+
UPSTREAM_CODENAME=$(sed -n -e "s/^$codename=//p" "${OS_RELEASE}")
1369+
[ -z "${UPSTREAM_CODENAME}" ] || break
1370+
done
13691371
fi
13701372

13711373
case "${UPSTREAM_CODENAME}" in
13721374
buster) UPSTREAM_RELEASE="10";;
13731375
bullseye) UPSTREAM_RELEASE="11";;
13741376
bookworm) UPSTREAM_RELEASE="12";;
1375-
trixie) UPSTREAM_CODENAME="13";;
1377+
trixie) UPSTREAM_RELEASE="13";;
13761378
sid) UPSTREAM_RELEASE="unstable";;
13771379
focal) UPSTREAM_RELEASE="20.04";;
13781380
jammy) UPSTREAM_RELEASE="22.04";;

0 commit comments

Comments
 (0)