From 8afa2af452605c342f24f58bc8ec77103295ebf0 Mon Sep 17 00:00:00 2001
From: Hugo Lefeuvre <hugo.lefeuvre@savoirfairelinux.com>
Date: Wed, 15 Aug 2018 17:28:12 -0400
Subject: [PATCH] packaging: fix $VER typo in ring-all package

Change-Id: Idd8ce22d24d207363f1714279afb40a7dac9f753
Reviewed-by: Sebastien Blin <sebastien.blin@savoirfairelinux.com>
---
 packaging/rules/debian/ring-all.postinst | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/packaging/rules/debian/ring-all.postinst b/packaging/rules/debian/ring-all.postinst
index dbd84ad3..cd7b8a4f 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.
-- 
GitLab