vst-install.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. # Vesta installation wrapper
  3. # http://vestacp.com
  4. #
  5. # Currently Supported Operating Systems:
  6. #
  7. # RHEL 5, RHEL 6
  8. # CentOS 5, CentOS 6
  9. # Debian 7
  10. # Ubuntu LTS, Ubuntu 13.04, Ubuntu 13.10
  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 user account
  27. if [ ! -z "$(grep ^admin: /etc/group)" ] && [ -z "$1" ]; then
  28. echo "Error: group admin exists"
  29. echo
  30. echo 'Please remove admin user account 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. # Check wget
  42. if [ -e '/usr/bin/wget' ]; then
  43. wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
  44. if [ "$?" -eq '0' ]; then
  45. bash vst-install-$type.sh $*
  46. exit
  47. else
  48. echo "Error: vst-install-$type.sh download failed."
  49. exit 1
  50. fi
  51. fi
  52. # Check curl
  53. if [ -e '/usr/bin/curl' ]; then
  54. curl -O http://vestacp.com/pub/vst-install-$type.sh
  55. if [ "$?" -eq '0' ]; then
  56. bash vst-install-$type.sh $*
  57. exit
  58. else
  59. echo "Error: vst-install-$type.sh download failed."
  60. exit 1
  61. fi
  62. fi
  63. exit