diff options
author | Yehonal <yehonal.azeroth@gmail.com> | 2020-08-06 02:37:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 02:37:14 +0200 |
commit | ad6ad094ded60e25358d1f324b9f0e6ca5bb796e (patch) | |
tree | 1551e982de63041ae306c8e968d8a687feafead8 /apps/installer | |
parent | a37ea1b60ee2e42a3953687bae3237d400e6fabf (diff) |
feat(bash): support for derivated distro + refactor conf (#3259)
* feat(bash): support for derivated distro
* refactor: refactoring for dist files
Diffstat (limited to 'apps/installer')
-rw-r--r-- | apps/installer/includes/functions.sh | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/installer/includes/functions.sh b/apps/installer/includes/functions.sh index 365afb6a3b..ca9cfe1c98 100644 --- a/apps/installer/includes/functions.sh +++ b/apps/installer/includes/functions.sh @@ -4,14 +4,34 @@ function inst_configureOS() { solaris*) echo "Solaris is not supported yet" ;; darwin*) source "$AC_PATH_INSTALLER/includes/os_configs/osx.sh" ;; linux*) + # If $OSDISTRO is set, use this value (from config.sh) + if [ ! -z "$OSDISTRO" ]; then + DISTRO=$OSDISTRO # If available, use LSB to identify distribution - if [ -f /etc/lsb-release -o -d /etc/lsb-release.d ]; then + elif [ -f /etc/lsb-release -o -d /etc/lsb-release.d ]; then DISTRO=$(lsb_release -i | cut -d: -f2 | sed s/'^\t'//) # Otherwise, use release info file else DISTRO=$(ls -d /etc/[A-Za-z]*[_-][rv]e[lr]* | grep -v "lsb" | cut -d'/' -f3 | cut -d'-' -f1 | cut -d'_' -f1) fi + case $DISTRO in + # add here distro that are debian or ubuntu based + # TODO: find a better way, maybe checking the existance + # of a package manager + "neon" | "ubuntu") + DISTRO="ubuntu" + ;; + "debian") + DISTRO="debian" + ;; + *) + echo "Distro: $DISTRO, is not supported. If your distribution is based on debian or ubuntu, + please set the 'OSDISTRO' environment variable to one of these distro (you can use config.sh file)" + ;; + esac + + DISTRO=${DISTRO,,} echo "Distro: $DISTRO" |