v2ray.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/sh
  2. #
  3. # This is a Shell script for v2ray based alpine with Docker image
  4. #
  5. # Copyright (C) 2019 - 2022 Teddysun <[email protected]>
  6. #
  7. # Reference URL:
  8. # https://github.com/v2fly/v2ray-core.git
  9. PLATFORM=$1
  10. if [ -z "$PLATFORM" ]; then
  11. ARCH="amd64"
  12. else
  13. case "$PLATFORM" in
  14. linux/386)
  15. ARCH="386"
  16. ;;
  17. linux/amd64)
  18. ARCH="amd64"
  19. ;;
  20. linux/arm/v6)
  21. ARCH="arm6"
  22. ;;
  23. linux/arm/v7)
  24. ARCH="arm7"
  25. ;;
  26. linux/arm64|linux/arm64/v8)
  27. ARCH="arm64"
  28. ;;
  29. linux/ppc64le)
  30. ARCH="ppc64le"
  31. ;;
  32. linux/s390x)
  33. ARCH="s390x"
  34. ;;
  35. *)
  36. ARCH=""
  37. ;;
  38. esac
  39. fi
  40. [ -z "${ARCH}" ] && echo "Error: Not supported OS Architecture" && exit 1
  41. # Download binary file
  42. V2RAY_FILE="v2ray_linux_${ARCH}"
  43. # V2CTL_FILE="v2ctl_linux_${ARCH}"
  44. echo "Downloading binary file: ${V2RAY_FILE}"
  45. wget -O /usr/bin/v2ray https://dl.lamp.sh/files/${V2RAY_FILE} > /dev/null 2>&1
  46. if [ $? -ne 0 ]; then
  47. echo "Error: Failed to download binary file: ${V2RAY_FILE}" && exit 1
  48. fi
  49. echo "Download binary file: ${V2RAY_FILE} completed"
  50. # echo "Downloading binary file: ${V2CTL_FILE}"
  51. # wget -O /usr/bin/v2ctl https://dl.lamp.sh/files/${V2CTL_FILE} > /dev/null 2>&1
  52. # if [ $? -ne 0 ]; then
  53. # echo "Error: Failed to download binary file: ${V2CTL_FILE}" && exit 1
  54. # fi
  55. # echo "Download binary file: ${V2CTL_FILE} completed"
  56. chmod +x /usr/bin/v2ray
  57. # chmod +x /usr/bin/v2ctl