install.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. # check to confirm running as root.
  3. if [ "$(id -u)" -ne "0" ]; then
  4. echo "$(basename "$0") must be run as root";
  5. exit 1
  6. fi
  7. echo
  8. #Os/Distro Check
  9. check_OS=$(lsb_release -is)
  10. check_Release_Major=$(lsb_release -rs | cut -d. -f1)
  11. lsb_release -c | grep -i jessie > /dev/null
  12. unsupported_OS () {
  13. echo " Your OS appears to be: "
  14. lsb_release -a
  15. echo " Your OS is not currently supported... Exiting the install."
  16. echo "If you require assistance we are available via IRC on freenode via #fusionpbx"
  17. exit 2;
  18. }
  19. if [ $check_OS = 'Debian' ]; then
  20. if [ $check_Release_Major -ge 8 ]; then
  21. echo "Removing the cd img from /etc/apt/sources.list"
  22. sed -i '/cdrom:/d' /etc/apt/sources.list
  23. echo "Updating system before we start"
  24. apt-get update && apt-get -y upgrade
  25. echo "Installing git"
  26. apt-get install -y git
  27. cd /usr/src
  28. echo "Fetching Installer"
  29. if [ -d /usr/src/fusionpbx-install.sh ]; then
  30. echo "Cannot continue you already have a installer downloaded"
  31. exit 1
  32. fi
  33. git clone https://github.com/fusionpbx/fusionpbx-install.sh
  34. cd /usr/src/fusionpbx-install.sh/debian
  35. ./install.sh $@
  36. else
  37. echo "Although you are running Debian we require version >= 8"
  38. unsupported_OS
  39. fi
  40. else
  41. unsupported_OS
  42. fi
  43. echo "If you require assistance we are available via IRC on freenode via #fusionpbx"