diff --git a/packaging/rules/debian/ring-all.postinst b/packaging/rules/debian/ring-all.postinst
index dbd84ad37b9f083a3494be4caedc337e0f98145c..cd7b8a4f905d89413e1eea940eef162a13bad029 100755
--- a/packaging/rules/debian/ring-all.postinst
+++ b/packaging/rules/debian/ring-all.postinst
@@ -95,23 +95,12 @@ if [ -f /etc/os-release ]; then
     . /etc/os-release
 
     # Set-up Ring repository end tag
-    if [ "$ID" = "debian" ] && [ "$VER" = "9" ]; then
-        ENDTAG="${ID}_${VERSION_ID}"
-    elif [ "$ID" = "ubuntu" ] && [ "$VER" = "16.04" ]; then
-        ENDTAG="${ID}_${VERSION_ID}"
-    elif [ "$ID" = "ubuntu" ] && [ "$VER" = "17.04" ]; then
-        ENDTAG="${ID}_${VERSION_ID}"
-    elif [ "$ID" = "ubuntu" ] && [ "$VER" = "17.10" ]; then
-        ENDTAG="${ID}_${VERSION_ID}"
-    elif [ "$ID" = "ubuntu" ] && [ "$VER" = "18.04" ]; then
-        ENDTAG="${ID}_${VERSION_ID}"
-    elif [ "$ID" = "linuxmint" ] && [ "$UBUNTU_CODENAME" = "xenial" ]; then
+    if [ "${DEBIAN_CODENAME}" = "stretch" ] || [ "${ID}_${VERSION_ID}" = "debian_9" ]; then
+        ENDTAG="debian_9"
+    elif [ "${UBUNTU_CODENAME}" = "xenial" ] || [ "${ID}_${VERSION_ID}" = "ubuntu_16.04" ]; then
         ENDTAG="ubuntu_16.04"
-    elif [ "$ID" = "linuxmint" ] && [ "$UBUNTU_CODENAME" = "bionic" ]; then
+    elif [ "${UBUNTU_CODENAME}" = "bionic" ] || [ "${ID}_${VERSION_ID}" = "ubuntu_18.04" ]; then
         ENDTAG="ubuntu_18.04"
-    elif [ "$ID" = "linuxmint" ] && [ "$DEBIAN_CODENAME" = "stretch" ]; then
-        # LMDE3
-        ENDTAG="debian_9"
     else
         # Distribution is not supported. Don't provide automatic updates.
         CAN_ADD_DEB_SOURCE=false
@@ -132,7 +121,7 @@ case "$1" in
             CAN_ADD_DEB_SOURCE=false
         fi
 
-        if [ "$CAN_ADD_DEB_SOURCE" = "true" ]; then
+        if [ "${CAN_ADD_DEB_SOURCE}" = "true" ]; then
             RING_REPO="${RING_REPO_BASE}/${ENDTAG}"
 
             # We first add the key to the trusted keyring.