feat(bash): support for derivated distro + refactor conf (#3259)

* feat(bash): support for derivated distro

* refactor: refactoring for dist files
This commit is contained in:
Yehonal 2020-08-06 02:37:14 +02:00 committed by GitHub
parent a37ea1b60e
commit ad6ad094de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 39 additions and 9 deletions

View file

@ -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"