Skip to content

Commit

Permalink
feat issue #134: support linux mint by checking /etc/os-release for I…
Browse files Browse the repository at this point in the history
…D_LIKE and UBUNTU_CODENAME

Signed-off-by: Peter Tandler <[email protected]>
  • Loading branch information
ptandler committed Aug 15, 2020
1 parent 2639a23 commit ec1c828
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ec1c828

Please sign in to comment.