* POSIX sh empty value check compatibility - part 2 * added Ubuntu choice with minimal version check
This commit is contained in:
parent
7f8b12dcb1
commit
4c4d0cda55
68
install.sh
68
install.sh
|
|
@ -47,6 +47,7 @@ chmod +x $0
|
|||
os_check=$(lsb_release -is)
|
||||
real_os=$os_check
|
||||
check_major_release=$(lsb_release -rs | cut -d. -f1)
|
||||
check_codename=$(lsb_release -cs)
|
||||
|
||||
os_unsupported () {
|
||||
echo " Your Operating System appears to be: "
|
||||
|
|
@ -55,33 +56,62 @@ os_unsupported () {
|
|||
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}"
|
||||
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"
|
||||
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
|
||||
cd /usr/src
|
||||
verbose "Fetching Installer"
|
||||
if [ -d /usr/src/fusionpbx-install.sh ]; then
|
||||
cd /usr/src/fusionpbx-install.sh
|
||||
git pull
|
||||
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
|
||||
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
|
||||
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 $@
|
||||
else
|
||||
error "Although you are running $real_os we require version >= 8"
|
||||
os_unsupported
|
||||
fi
|
||||
else
|
||||
os_unsupported
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue