From ec1c828a03e3582d427b6845a55aebc7b7e8b3a5 Mon Sep 17 00:00:00 2001
From: Peter Tandler
Date: Sat, 15 Aug 2020 23:01:06 +0200
Subject: [PATCH 1/3] feat issue #134: support linux mint by checking
/etc/os-release for ID_LIKE and UBUNTU_CODENAME
Signed-off-by: Peter Tandler
---
install.sh | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/install.sh b/install.sh
index c391b033..3acd083a 100644
--- a/install.sh
+++ b/install.sh
@@ -112,7 +112,15 @@ get_distribution() {
lsb_dist=""
# Every system that we officially support has /etc/os-release
if [ -r /etc/os-release ]; then
- lsb_dist="$(. /etc/os-release && echo "$ID")"
+ # lsb_dist="$(. /etc/os-release && echo "$ID")"
+ # linux mint provides the information that it is "like" ubuntu
+ # if this is present, use $ID_LIKE
+ lsb_dist="$(. /etc/os-release &&
+ if [ -n "$ID_LIKE" ];
+ then echo "$ID_LIKE"
+ else echo "$ID"
+ fi
+ )"
fi
# Returning an empty string here should be alright since the
# case statements don't act unless you provide an actual value
@@ -305,7 +313,12 @@ do_install() {
case "$lsb_dist" in
ubuntu)
- if command_exists lsb_release; then
+ # check also for ubuntu-like distros, such as linux mint
+ # if they do pass the `UBUNTU_CODENAME`
+ if [ -r /etc/os-release ]; then
+ dist_version=$(. /etc/os-release && echo "$UBUNTU_CODENAME")
+ fi
+ if [ -z "$dist_version" ] && command_exists lsb_release; then
dist_version="$(lsb_release --codename | cut -f2)"
fi
if [ -z "$dist_version" ] && [ -r /etc/lsb-release ]; then
@@ -348,6 +361,8 @@ do_install() {
# Check if this is a forked Linux distro
check_forked
+ echo "Detected distribution to use for installation: $lsb_dist and version $dist_version"
+
# Run setup for each distro accordingly
case "$lsb_dist" in
ubuntu|debian|raspbian)
From 3ba1a938b36563a8b1bad52b04fd92efd5c500e7 Mon Sep 17 00:00:00 2001
From: Peter Tandler
Date: Sat, 15 Aug 2020 23:32:31 +0200
Subject: [PATCH 2/3] fix: next try, using `check_forked()` to check for
ubuntu-based distros
Signed-off-by: Peter Tandler
---
install.sh | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/install.sh b/install.sh
index 3acd083a..8fb24f51 100644
--- a/install.sh
+++ b/install.sh
@@ -112,15 +112,7 @@ get_distribution() {
lsb_dist=""
# Every system that we officially support has /etc/os-release
if [ -r /etc/os-release ]; then
- # lsb_dist="$(. /etc/os-release && echo "$ID")"
- # linux mint provides the information that it is "like" ubuntu
- # if this is present, use $ID_LIKE
- lsb_dist="$(. /etc/os-release &&
- if [ -n "$ID_LIKE" ];
- then echo "$ID_LIKE"
- else echo "$ID"
- fi
- )"
+ lsb_dist="$(. /etc/os-release && echo "$ID")"
fi
# Returning an empty string here should be alright since the
# case statements don't act unless you provide an actual value
@@ -197,6 +189,15 @@ check_forked() {
else
# We're Debian and don't even know it!
lsb_dist=debian
+
+ # now, we can check /etc/os-release for ID_LIKE and UBUNTU_CODENAME
+ if [ -r /etc/os-release ]; then
+ id_like="$(. /etc/os-release && echo "$ID_LIKE")"
+ if [ "$id_like" = "ubuntu" ]; then
+ lsb_dist="$id_like"
+ dist_version="$(. /etc/os-release && echo "$UBUNTU_CODENAME")"
+ fi
+ fi
fi
dist_version="$(sed 's/\/.*//' /etc/debian_version | sed 's/\..*//')"
case "$dist_version" in
@@ -313,12 +314,7 @@ do_install() {
case "$lsb_dist" in
ubuntu)
- # check also for ubuntu-like distros, such as linux mint
- # if they do pass the `UBUNTU_CODENAME`
- if [ -r /etc/os-release ]; then
- dist_version=$(. /etc/os-release && echo "$UBUNTU_CODENAME")
- fi
- if [ -z "$dist_version" ] && command_exists lsb_release; then
+ if command_exists lsb_release; then
dist_version="$(lsb_release --codename | cut -f2)"
fi
if [ -z "$dist_version" ] && [ -r /etc/lsb-release ]; then
From 0ad412a40189081f744c7bb3c776b4125188633f Mon Sep 17 00:00:00 2001
From: Peter Tandler
Date: Sat, 15 Aug 2020 23:39:01 +0200
Subject: [PATCH 3/3] fix: renamed local id_like to base_dist to make
shellcheck happy see https://www.shellcheck.net/wiki/SC2153
Signed-off-by: Peter Tandler
---
install.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/install.sh b/install.sh
index 8fb24f51..91102ab9 100644
--- a/install.sh
+++ b/install.sh
@@ -192,9 +192,9 @@ check_forked() {
# now, we can check /etc/os-release for ID_LIKE and UBUNTU_CODENAME
if [ -r /etc/os-release ]; then
- id_like="$(. /etc/os-release && echo "$ID_LIKE")"
- if [ "$id_like" = "ubuntu" ]; then
- lsb_dist="$id_like"
+ base_dist="$(. /etc/os-release && echo "$ID_LIKE")"
+ if [ "$base_dist" = "ubuntu" ]; then
+ lsb_dist="$base_dist"
dist_version="$(. /etc/os-release && echo "$UBUNTU_CODENAME")"
fi
fi