Add automatically determination of GNU/Linux distribution
This commit is contained in:
parent
a16d4b237f
commit
4893969772
1 changed files with 18 additions and 19 deletions
37
installer.sh
37
installer.sh
|
@ -15,25 +15,24 @@ if [ "$(id -u)" != "0" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##Select OS type
|
OS="$(uname -s)"
|
||||||
echo 'Select your OS type. Valid OS types:'
|
if [ "$OS" == "Linux" ]; then
|
||||||
echo '0 - Debian-based GNU/Linux (e.g. Debian, Devuan, Ubuntu Server)'
|
if [ -f /etc/redhat-release ] ; then
|
||||||
echo '1 - RHEL-based GNU/Linux (e.g. CentOS, Fedora Server, Red Hat Enterprise Linux Server)'
|
DISTRO=rhel
|
||||||
echo '2 - SUSE-based GNU/Linux (e.g. OpenSUSE Server, SLES)'
|
elif [ -f /etc/SuSE-release ] ; then
|
||||||
echo '3 - Arch-based GNU/Linux (e.g. Arch, Manjaro)'
|
DISTRO=suse
|
||||||
echo '4 - FreeBSD'
|
elif [ -f /etc/debian_version ] ; then
|
||||||
echo '5 - Other'
|
DISTRO=debian
|
||||||
echo -n 'Your OS type: '
|
elif [ -f /etc/arch-release ] ; then
|
||||||
read OSTYPE
|
DISTRO=arch
|
||||||
case $OSTYPE in
|
else
|
||||||
0) DISTRO=debian;;
|
DISTRO=other
|
||||||
1) DISTRO=rhel;;
|
fi
|
||||||
2) DISTRO=suse;;
|
elif [ "$OS" == "FreeBSD" ]; then
|
||||||
3) DISTRO=arch;;
|
DISTRO=freebsd
|
||||||
4) DISTRO=freebsd;;
|
else
|
||||||
5) DISTRO=other;;
|
DISTRO=other
|
||||||
*) echo 'Invalid OS type!'; exit 1;;
|
fi
|
||||||
esac
|
|
||||||
|
|
||||||
##Define depedency installation functions
|
##Define depedency installation functions
|
||||||
install_nodejs() {
|
install_nodejs() {
|
||||||
|
|
Loading…
Reference in a new issue