github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/release/container/downloadAssets.sh (about) 1 #!/bin/bash 2 3 set -x -e 4 5 download() { 6 curl -L "https://github.com/${RELEASE_REPO}/releases/download/$1/$2" >"$2" 7 } 8 9 downloadAndUnzip() { 10 download "$1" "$2" 11 unzip -n -d "${2%\.zip}" "$2" 12 } 13 mkdir -p assets 14 15 pushd assets 16 downloadAndUnzip "$1" "v2ray-linux-$2.zip" 17 downloadAndUnzip "$1" "v2ray-extra.zip" 18 popd 19 20 placeFile() { 21 mkdir -p "context/$2" 22 cp -R "assets/$1/$3" "context/$2/$3" 23 } 24 25 function generateStandardVersion() { 26 placeFile "$1" "$2/bin" "v2ray" 27 } 28 29 function generateExtraVersion() { 30 generateStandardVersion "$1" "$2" 31 placeFile "$1" "$2/share" "geosite.dat" 32 placeFile "$1" "$2/share" "geoip.dat" 33 placeFile "$1" "$2/etc" "config.json" 34 placeFile "v2ray-extra" "$2/share" "browserforwarder" 35 } 36 37 if [ "$4" = "std" ]; then 38 generateStandardVersion "v2ray-linux-$2" "linux/$3/std" 39 fi 40 41 if [ "$4" = "extra" ]; then 42 generateExtraVersion "v2ray-linux-$2" "linux/$3/extra" 43 fi 44 45