Properly detect all supported Debian GNU/Linux derivatives

This commit is contained in:
Denys Havrysh 2017-04-28 12:34:58 +03:00
parent 82b96bc573
commit 8edfcf33b3
2 changed files with 20 additions and 16 deletions

View file

@ -225,6 +225,7 @@ You also may need to disable repository configuration and allow ``pip`` installa
Debian and derivatives Debian and derivatives
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
- Cumulus Linux 2/3
- Debian GNU/Linux 7/8 - Debian GNU/Linux 7/8
- Linux Mint Debian Edition 1 (based on Debian 8) - Linux Mint Debian Edition 1 (based on Debian 8)
- Kali Linux 1.0 (based on Debian 7) - Kali Linux 1.0 (based on Debian 7)
@ -255,11 +256,11 @@ Ubuntu and derivatives
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
- Elementary OS 0.2 (based on Ubuntu 12.04) - Elementary OS 0.2 (based on Ubuntu 12.04)
- KDE neon (based on Ubuntu 16.04)
- Linaro 12.04 - Linaro 12.04
- Linux Mint 13/17/18 - Linux Mint 13/17/18
- Trisquel GNU/Linux 6 (based on Ubuntu 12.04) - Trisquel GNU/Linux 6 (based on Ubuntu 12.04)
- Ubuntu 12.04/14.04/16.04 - Ubuntu 12.04/14.04/16.04 and subsequent non-TLS releases (see below)
- KDE neon
Ubuntu Best Effort Support: Non-LTS Releases Ubuntu Best Effort Support: Non-LTS Releases
******************************************** ********************************************

View file

@ -975,10 +975,6 @@ __gather_linux_system_info() {
elif [ "${DISTRO_NAME}" = "Arch" ]; then elif [ "${DISTRO_NAME}" = "Arch" ]; then
DISTRO_NAME="Arch Linux" DISTRO_NAME="Arch Linux"
return return
elif [ "${DISTRO_NAME}" = "Raspbian" ]; then
DISTRO_NAME="Debian"
elif [ "${DISTRO_NAME}" = "Cumulus Linux" ]; then
DISTRO_NAME="Debian"
fi fi
rv=$(lsb_release -sr) rv=$(lsb_release -sr)
[ "${rv}" != "" ] && DISTRO_VERSION=$(__parse_version_string "$rv") [ "${rv}" != "" ] && DISTRO_VERSION=$(__parse_version_string "$rv")
@ -1089,6 +1085,7 @@ __gather_linux_system_info() {
done done
} }
#--- FUNCTION ------------------------------------------------------------------------------------------------------- #--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __install_python_and_deps() # NAME: __install_python_and_deps()
# DESCRIPTION: Install a different version of python and its dependencies on a host. Currently this has only been # DESCRIPTION: Install a different version of python and its dependencies on a host. Currently this has only been
@ -1243,6 +1240,7 @@ __gather_system_info() {
} }
#--- FUNCTION ------------------------------------------------------------------------------------------------------- #--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __get_dpkg_architecture # NAME: __get_dpkg_architecture
# DESCRIPTION: Determine primary architecture for packages to install on Debian and derivatives # DESCRIPTION: Determine primary architecture for packages to install on Debian and derivatives
@ -1258,6 +1256,7 @@ __get_dpkg_architecture() {
return 0 return 0
} }
#--- FUNCTION ------------------------------------------------------------------------------------------------------- #--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __ubuntu_derivatives_translation # NAME: __ubuntu_derivatives_translation
# DESCRIPTION: Map Ubuntu derivatives to their Ubuntu base versions. # DESCRIPTION: Map Ubuntu derivatives to their Ubuntu base versions.
@ -1303,6 +1302,7 @@ __ubuntu_derivatives_translation() {
fi fi
} }
#--- FUNCTION ------------------------------------------------------------------------------------------------------- #--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __ubuntu_codename_translation # NAME: __ubuntu_codename_translation
# DESCRIPTION: Map Ubuntu major versions to their corresponding codenames # DESCRIPTION: Map Ubuntu major versions to their corresponding codenames
@ -1346,6 +1346,7 @@ __ubuntu_codename_translation() {
esac esac
} }
#--- FUNCTION ------------------------------------------------------------------------------------------------------- #--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __debian_derivatives_translation # NAME: __debian_derivatives_translation
# DESCRIPTION: Map Debian derivatives to their Debian base versions. # DESCRIPTION: Map Debian derivatives to their Debian base versions.
@ -1354,25 +1355,26 @@ __ubuntu_codename_translation() {
#---------------------------------------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------------------------------------
# shellcheck disable=SC2034 # shellcheck disable=SC2034
__debian_derivatives_translation() { __debian_derivatives_translation() {
# If the file does not exist, return # If the file does not exist, return
[ ! -f /etc/os-release ] && return [ ! -f /etc/os-release ] && return
DEBIAN_DERIVATIVES="(kali|linuxmint|cumulus-linux)" DEBIAN_DERIVATIVES="(cumulus_.+|kali|linuxmint|raspbian)"
# Mappings # Mappings
kali_1_debian_base="7.0"
linuxmint_1_debian_base="8.0"
cumulus_2_debian_base="7.0" cumulus_2_debian_base="7.0"
cumulus_3_debian_base="8.0" cumulus_3_debian_base="8.0"
kali_1_debian_base="7.0"
# Detect derivates, Cumulus Linux, Kali and LinuxMint *only* for now linuxmint_1_debian_base="8.0"
rv=$(grep ^ID= /etc/os-release | sed -e 's/.*=//') raspbian_8_debian_base="8.0"
# Translate Debian derivatives to their base Debian version # Translate Debian derivatives to their base Debian version
match=$(echo "$rv" | egrep ${DEBIAN_DERIVATIVES}) match=$(echo "$DISTRO_NAME_L" | egrep ${DEBIAN_DERIVATIVES})
if [ "${match}" != "" ]; then if [ "${match}" != "" ]; then
case $match in case $match in
cumulus_*)
_major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')
_debian_derivative="cumulus"
;;
kali) kali)
_major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g') _major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')
_debian_derivative="kali" _debian_derivative="kali"
@ -1381,9 +1383,9 @@ __debian_derivatives_translation() {
_major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g') _major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')
_debian_derivative="linuxmint" _debian_derivative="linuxmint"
;; ;;
cumulus-linux) raspbian)
_major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g') _major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')
_debian_derivative="cumulus" _debian_derivative="raspbian"
;; ;;
esac esac
@ -1413,6 +1415,7 @@ __check_and_refresh_suse_pkg_repo() {
fi fi
} }
__gather_system_info __gather_system_info
echo echo