install.sh 998 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. #
  3. # VLMCSD - CentOS/Debian/RedHat/Ubuntu installer
  4. #
  5. # Author: Wind4 (puxiaping@gmail.com)
  6. # Date: November 30, 2015
  7. #
  8. # Detect OS
  9. if [ -f /etc/debian_version ]; then
  10. ostype='debian'
  11. elif [ -f /etc/lsb-release ]; then
  12. ostype='ubuntu'
  13. elif [ -f /etc/redhat-release ]; then
  14. ostype='rhel'
  15. else
  16. echo 'This script only support CentOS/Debian/RedHat/Ubuntu.' >&2
  17. exit 1
  18. fi
  19. # Checking wget
  20. if [ ! -f /usr/bin/wget ]; then
  21. case $ostype in
  22. debian|ubuntu)
  23. apt-get update -yqq
  24. apt-get install -yqq wget
  25. ;;
  26. rhel)
  27. yum install -y -q wget
  28. ;;
  29. esac
  30. if [ "$?" -ne '0' ]; then
  31. echo "Error: Can't install wget" >&2
  32. exit 1
  33. fi
  34. fi
  35. # Select script type
  36. case $ostype in
  37. debian|ubuntu) type='debian' ;;
  38. rhel) type='rhel' ;;
  39. esac
  40. wget https://wind4.github.io/vlmcsd/scripts/install-$type.sh -O vlmcsd-$type.sh
  41. if [ "$?" -eq '0' ]; then
  42. bash vlmcsd-$type.sh $*
  43. exit
  44. else
  45. echo 'Download installer failed.' >&2
  46. exit 1
  47. fi