Fix to issue #72 - add Ubuntu and Centos choices (#73)

* POSIX sh empty value check compatibility - part 2

* added Ubuntu choice with minimal version check
This commit is contained in:
erxspin 2017-02-24 22:29:42 +06:00 committed by FusionPBX
parent 7f8b12dcb1
commit 4c4d0cda55
1 changed files with 49 additions and 19 deletions

View File

@ -47,6 +47,7 @@ chmod +x $0
os_check=$(lsb_release -is) os_check=$(lsb_release -is)
real_os=$os_check real_os=$os_check
check_major_release=$(lsb_release -rs | cut -d. -f1) check_major_release=$(lsb_release -rs | cut -d. -f1)
check_codename=$(lsb_release -cs)
os_unsupported () { os_unsupported () {
echo " Your Operating System appears to be: " echo " Your Operating System appears to be: "
@ -55,18 +56,18 @@ os_unsupported () {
exit 2; exit 2;
} }
if [ $os_check = 'Raspbian' ]; then os_debian_common () {
echo "${yellow}Detected Raspbian, using Debian for compatibility${normal}"
os_check="Debian"
fi
if [ $os_check = 'Debian' ]; then
if [ $check_major_release -ge 8 ]; then
verbose "Removing the CD image from /etc/apt/sources.list" verbose "Removing the CD image from /etc/apt/sources.list"
sed -i '/cdrom:/d' /etc/apt/sources.list sed -i '/cdrom:/d' /etc/apt/sources.list
verbose "Updating system before starting." verbose "Updating system before starting."
apt-get update && apt-get -y upgrade apt-get update && apt-get -y upgrade
verbose "Installing Git" verbose "Installing Git"
apt-get install -y git apt-get install -y git
}
os_fetch_installer () {
if [ ! -d /usr/src ]; then
mkdir -vp /usr/src
fi
cd /usr/src cd /usr/src
verbose "Fetching Installer" verbose "Fetching Installer"
if [ -d /usr/src/fusionpbx-install.sh ]; then if [ -d /usr/src/fusionpbx-install.sh ]; then
@ -75,13 +76,42 @@ if [ $os_check = 'Debian' ]; then
else else
git clone https://github.com/fusionpbx/fusionpbx-install.sh git clone https://github.com/fusionpbx/fusionpbx-install.sh
fi fi
cd /usr/src/fusionpbx-install.sh/debian }
./install.sh $@
if [ .$os_check = .'Raspbian' ]; then
echo "${yellow}Detected Raspbian, using Debian for compatibility${normal}"
os_check="Debian"
fi
if [ .$os_check = .'Ubuntu' ]; then
echo "${yellow}Detected Ubuntu, using Debian for compatibility${normal}"
os_check="Debian"
fi
if [ .$os_check = .'Debian' ]; then
if [ .$real_os = .'Debian' ]; then
echo "${yellow}Detected Debian${normal}"
if [ $check_major_release -ge 8 ]; then
os_debian_continue='true'
else else
os_debian_continue='false'
error "Although you are running $real_os we require version >= 8" error "Although you are running $real_os we require version >= 8"
os_unsupported os_unsupported
fi fi
fi
if [ .$real_os = .'Ubuntu' ]; then
if [ $check_major_release -ge 14 ]; then
os_debian_continue='true'
else
os_debian_continue='false'
error "Although you are running $real_os we require version >= 14"
os_unsupported
fi
fi
if [ .$os_debian_continue = .'true' ]; then
os_debian_common
os_fetch_installer
cd /usr/src/fusionpbx-install.sh/debian
./install.sh $@
fi
else else
os_unsupported os_unsupported
fi fi