PuriDevelopers

vst-install.sh

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