vst-install.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #
  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 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. Amazon) type="amazon" ;;
  40. *) type="rhel" ;;
  41. esac
  42. # Fallback to Ubuntu
  43. if [ ! -e "/etc/redhat-release" ]; then
  44. type='ubuntu'
  45. fi
  46. # Check wget
  47. if [ -e '/usr/bin/wget' ]; then
  48. wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
  49. if [ "$?" -eq '0' ]; then
  50. bash vst-install-$type.sh $*
  51. exit
  52. else
  53. echo "Error: vst-install-$type.sh download failed."
  54. exit 1
  55. fi
  56. fi
  57. # Check curl
  58. if [ -e '/usr/bin/curl' ]; then
  59. curl -O http://vestacp.com/pub/vst-install-$type.sh
  60. if [ "$?" -eq '0' ]; then
  61. bash vst-install-$type.sh $*
  62. exit
  63. else
  64. echo "Error: vst-install-$type.sh download failed."
  65. exit 1
  66. fi
  67. fi
  68. exit