hst-install.sh 1.8 KB

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