vst-install.sh 1.7 KB

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