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,33 +56,62 @@ os_unsupported () {
exit 2; exit 2;
} }
if [ $os_check = 'Raspbian' ]; then os_debian_common () {
verbose "Removing the CD image from /etc/apt/sources.list"
sed -i '/cdrom:/d' /etc/apt/sources.list
verbose "Updating system before starting."
apt-get update && apt-get -y upgrade
verbose "Installing Git"
apt-get install -y git
}
os_fetch_installer () {
if [ ! -d /usr/src ]; then
mkdir -vp /usr/src
fi
cd /usr/src
verbose "Fetching Installer"
if [ -d /usr/src/fusionpbx-install.sh ]; then
cd /usr/src/fusionpbx-install.sh
git pull
else
git clone https://github.com/fusionpbx/fusionpbx-install.sh
fi
}
if [ .$os_check = .'Raspbian' ]; then
echo "${yellow}Detected Raspbian, using Debian for compatibility${normal}" echo "${yellow}Detected Raspbian, using Debian for compatibility${normal}"
os_check="Debian" os_check="Debian"
fi fi
if [ $os_check = 'Debian' ]; then if [ .$os_check = .'Ubuntu' ]; then
if [ $check_major_release -ge 8 ]; then echo "${yellow}Detected Ubuntu, using Debian for compatibility${normal}"
verbose "Removing the CD image from /etc/apt/sources.list" os_check="Debian"
sed -i '/cdrom:/d' /etc/apt/sources.list fi
verbose "Updating system before starting." if [ .$os_check = .'Debian' ]; then
apt-get update && apt-get -y upgrade if [ .$real_os = .'Debian' ]; then
verbose "Installing Git" echo "${yellow}Detected Debian${normal}"
apt-get install -y git if [ $check_major_release -ge 8 ]; then
cd /usr/src os_debian_continue='true'
verbose "Fetching Installer"
if [ -d /usr/src/fusionpbx-install.sh ]; then
cd /usr/src/fusionpbx-install.sh
git pull
else else
git clone https://github.com/fusionpbx/fusionpbx-install.sh os_debian_continue='false'
error "Although you are running $real_os we require version >= 8"
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 cd /usr/src/fusionpbx-install.sh/debian
./install.sh $@ ./install.sh $@
else
error "Although you are running $real_os we require version >= 8"
os_unsupported
fi fi
else else
os_unsupported os_unsupported
fi fi