From 768d3840641892e18b55770807c5d76de4c39dc8 Mon Sep 17 00:00:00 2001 From: Jessica James Date: Mon, 26 Apr 2021 21:08:06 -0500 Subject: [PATCH] Added SDK support to set_game_branch.sh, clean_builds.sh, map_builds.sh Added sdk_mirrors Added sdk_mirrors support to update_mirrors.sh --- clean_builds.sh | 10 ++++++++++ map_builds.sh | 12 +++++++++++- sdk_mirrors | 18 ++++++++++++++++++ set_game_branch.sh | 20 ++++++++++++++------ update_mirrors.sh | 9 ++++++++- 5 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 sdk_mirrors diff --git a/clean_builds.sh b/clean_builds.sh index 3633d5c..5573e93 100755 --- a/clean_builds.sh +++ b/clean_builds.sh @@ -84,12 +84,22 @@ function clean_builds() { referenced_builds=() for version_file in $version_path/*; do version_data=$(cat "$version_file") + + # Read in game build build=$(echo "$version_data" | jq -r ".game.patch_path") build_path="$patches_path/$build" if [[ ! "${referenced_builds[@]}" =~ "$build_path" ]]; then referenced_builds+=("$build_path") fi + + # Read in SDK build + build=$(echo "$version_data" | jq -r ".sdk.patch_path") + build_path="$patches_path/$build" + + if [[ ! "${referenced_builds[@]}" =~ "$build_path" ]]; then + referenced_builds+=("$build_path") + fi done if $verbose; then diff --git a/map_builds.sh b/map_builds.sh index e8642b5..bbbaa4a 100755 --- a/map_builds.sh +++ b/map_builds.sh @@ -76,6 +76,8 @@ function map_builds() { referenced_builds=() for version_file in $version_path/*; do version_data=$(cat "$version_file") + + # Read in game build build=$(echo "$version_data" | jq -r ".game.patch_path") build_path="$patches_path/$build" @@ -83,7 +85,15 @@ function map_builds() { referenced_builds+=("$build_path") fi - echo "$(basename $version_file) -> $build" + # Read in SDK build + sdk_build=$(echo "$version_data" | jq -r ".sdk.patch_path") + sdk_build_path="$patches_path/$sdk_build" + + if [[ ! "${referenced_builds[@]}" =~ "$sdk_build_path" ]]; then + referenced_builds+=("$sdk_build_path") + fi + + echo "$(basename $version_file) -> Game: ${build}; SDK: ${sdk_build}" done if $verbose; then diff --git a/sdk_mirrors b/sdk_mirrors new file mode 100644 index 0000000..015ddb8 --- /dev/null +++ b/sdk_mirrors @@ -0,0 +1,18 @@ +[ + { + "name": "CnCFPS.com (Los Angeles, CA, USA)", + "url": "http://rxp-lax2.cncfps.com" + }, + { + "name": "TotemArts (Las Vegas, Nevada, USA)", + "url": "http://us-lv.buyvm.renegade-x.com/" + }, + { + "name": "TotemArts (New York, New York, USA)", + "url": "http://us-ny.buyvm.renegade-x.com/" + }, + { + "name": "TotemArts (Roost, Luxembourg, EU)", + "url": "http://eu-lux.buyvm.renegade-x.com/" + } +] diff --git a/set_game_branch.sh b/set_game_branch.sh index 31567eb..26bac4e 100755 --- a/set_game_branch.sh +++ b/set_game_branch.sh @@ -6,6 +6,7 @@ patches_path="${patches_data_path}" echo_output=false minify=false verbose=false +product_key=game function print_help() { echo "Sets the patch path for a given branch." @@ -49,6 +50,11 @@ do shift shift ;; + --product-key) + product_key="$2" + shift + shift + ;; esac done @@ -71,6 +77,7 @@ then echo " version_path: $version_path" echo " patch_path: $patch_path" echo " version_file: $version_file" + echo " product_key: $product_key" echo "" fi @@ -83,6 +90,7 @@ function set_branch() { version_file="$1" patch_path="$2" patches_path="$3" + product_key="$4" metadata_file="${patches_path}/${patch_path}/metadata.json" # Verify version branch exists @@ -118,14 +126,14 @@ function set_branch() { version_data=$(cat "${version_file}") # Set the patch_path - version_data=$(echo "${version_data}" | jq ".game.patch_path = \"${patch_path}\"") + version_data=$(echo "${version_data}" | jq ".${product_key}.patch_path = \"${patch_path}\"") # Set the metadata hash; this is unused for now - version_data=$(echo "${version_data}" | jq ".game.metadata_hash = \"${metadata_hash}\"") + version_data=$(echo "${version_data}" | jq ".${product_key}.metadata_hash = \"${metadata_hash}\"") - # Merge in metadata into game - game_version_data=$(echo "${version_data}" | jq ".game * ${patch_metadata}") - version_data=$(echo "${version_data}" | jq ".game = ${game_version_data}") + # Merge in metadata into product + product_version_data=$(echo "${version_data}" | jq ".${product_key} * ${patch_metadata}") + version_data=$(echo "${version_data}" | jq ".${product_key} = ${product_version_data}") # Minify final JSON if specified if $minify @@ -142,4 +150,4 @@ function set_branch() { fi } -set_branch "${version_file}" "${patch_path}" "${patches_path}" +set_branch "${version_file}" "${patch_path}" "${patches_path}" "${product_key}" diff --git a/update_mirrors.sh b/update_mirrors.sh index fdfa5a7..d281b96 100755 --- a/update_mirrors.sh +++ b/update_mirrors.sh @@ -1,11 +1,18 @@ game_mirrors_file=game_mirrors +sdk_mirrors_file=sdk_mirrors static_path="/home/renx/static.renegade-x.com/" version_path="${static_path}/data/launcher_data/version" update_mirrors() { + version_file=${version_path}/$1 + + # Update game mirrors game_mirrors=$(cat "${game_mirrors_file}") - version_file=${version_path}/$1 jq ".game.mirrors = ${game_mirrors}" "${version_file}" > "$version_file.tmp" && mv "${version_file}.tmp" "${version_file}" + + # Update SDK mirrors + sdk_mirrors=$(cat "${sdk_mirrors_file}") + jq ".sdk.mirrors = ${sdk_mirrors}" "${version_file}" > "$version_file.tmp" && mv "${version_file}.tmp" "${version_file}" } # Release branches