install-release.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. echo "Please make sure unzip and daemon are installed before running this script."
  3. VER="v1.1"
  4. ARCH=$(uname -m)
  5. VDIS="64"
  6. if [ "$ARCH" == "i686" ] || [ "$ARCH" == "i386" ]; then
  7. VDIS="32"
  8. elif [ "$ARCH" == *"armv7"* ]; then
  9. VDIS="arm"
  10. elif [ "$ARCH" == *"armv8"* ]; then
  11. VDIS="arm64"
  12. fi
  13. DOWNLOAD_LINK="https://github.com/v2ray/v2ray-core/releases/download/${VER}/v2ray-linux-${VDIS}.zip"
  14. rm -rf /tmp/v2ray
  15. mkdir -p /tmp/v2ray
  16. curl -L -o "/tmp/v2ray/v2ray.zip" ${DOWNLOAD_LINK}
  17. unzip "/tmp/v2ray/v2ray.zip" -d "/tmp/v2ray/"
  18. # Create folder for V2Ray log.
  19. mkdir -p /var/log/v2ray
  20. # Install V2Ray binary to /usr/bin/v2ray
  21. mkdir -p /usr/bin/v2ray
  22. cp "/tmp/v2ray/v2ray-${VER}-linux-${VDIS}/v2ray" "/usr/bin/v2ray/v2ray"
  23. # Install V2Ray server config to /etc/v2ray
  24. mkdir -p /etc/v2ray
  25. if [ ! -f "/etc/v2ray/config.json" ]; then
  26. cp "/tmp/v2ray/v2ray-${VER}-linux-${VDIS}/vpoint_vmess_freedom.json" "/etc/v2ray/config.json"
  27. #PORT=$(expr $RANDOM + 10000)
  28. #sed -i "s/37192/${PORT}/g" "/etc/v2ray/config.json"
  29. UUID=$(cat /proc/sys/kernel/random/uuid)
  30. sed -i "s/3b129dec-72a3-4d28-aeee-028a0fe86e22/${UUID}/g" "/etc/v2ray/config.json"
  31. #echo "PORT:${PORT}"
  32. echo "UUID:${UUID}"
  33. fi
  34. # Configure SysV if necessary.
  35. if [ -d "/etc/init.d" ]; then
  36. if [ ! -f "/etc/init.d/v2ray" ]; then
  37. cp "/tmp/v2ray/systemv/v2ray" "/etc/init.d/v2ray"
  38. chmod +x "/etc/init.d/v2ray"
  39. update-rc.d v2ray defaults
  40. fi
  41. fi