vst-install.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # Vesta installation wrapper
  3. # http://vestacp.com
  4. #
  5. # Currently Supported Operating Systems:
  6. #
  7. # RHEL 5, 6, 7
  8. # CentOS 5, 6, 7
  9. # Debian 7, 8
  10. # Ubuntu 12.04 - 16.04
  11. #
  12. # Am I root?
  13. if [ "x$(id -u)" != 'x0' ]; then
  14. echo 'Error: this script can only be executed by root'
  15. exit 1
  16. fi
  17. # Check admin user account
  18. if [ ! -z "$(grep ^admin: /etc/passwd)" ] && [ -z "$1" ]; then
  19. echo "Error: user admin exists"
  20. echo
  21. echo 'Please remove admin user account before proceeding.'
  22. echo 'If you want to do it automatically run installer with -f option:'
  23. echo "Example: bash $0 --force"
  24. exit 1
  25. fi
  26. # Check admin group
  27. if [ ! -z "$(grep ^admin: /etc/group)" ] && [ -z "$1" ]; then
  28. echo "Error: group admin exists"
  29. echo
  30. echo 'Please remove admin group before proceeding.'
  31. echo 'If you want to do it automatically run installer with -f option:'
  32. echo "Example: bash $0 --force"
  33. exit 1
  34. fi
  35. # Detect OS
  36. case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
  37. Debian) type="debian" ;;
  38. Ubuntu) type="ubuntu" ;;
  39. *) type="rhel" ;;
  40. esac
  41. # Fallback to Ubuntu
  42. if [ ! -e "/etc/redhat-release" ]; then
  43. type='ubuntu'
  44. fi
  45. # Check wget
  46. if [ -e '/usr/bin/wget' ]; then
  47. wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
  48. if [ "$?" -eq '0' ]; then
  49. bash vst-install-$type.sh $*
  50. exit
  51. else
  52. echo "Error: vst-install-$type.sh download failed."
  53. exit 1
  54. fi
  55. fi
  56. # Check curl
  57. if [ -e '/usr/bin/curl' ]; then
  58. curl -O http://vestacp.com/pub/vst-install-$type.sh
  59. if [ "$?" -eq '0' ]; then
  60. bash vst-install-$type.sh $*
  61. exit
  62. else
  63. echo "Error: vst-install-$type.sh download failed."
  64. exit 1
  65. fi
  66. fi
  67. exit