mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-02 21:20:55 +00:00
Support for new manifest format in install.sh
This commit is contained in:
parent
a043e0852f
commit
c036aaf61a
34
install.sh
34
install.sh
@ -20,24 +20,36 @@ if [ ! -d plugins ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Base GitLab update manifest.
|
# Base GitLab update manifest.
|
||||||
base_url="https://artifacts.gay.pizza/foundation/"
|
base_url="https://artifacts.gay.pizza/foundation"
|
||||||
|
|
||||||
# Download the update manifest.
|
# Download the update manifest.
|
||||||
manifest=$(curl --fail -Ls "$base_url/build/manifests/update.json" || (echo "Failed to download manifest."; exit 1))
|
manifest=$(curl --fail -Ls "$base_url/manifest.json" || (echo "Failed to download manifest."; exit 1))
|
||||||
|
|
||||||
# Get plugins list from the manifest.
|
# Get items list from the manifest.
|
||||||
plugins=$(echo "$manifest" | jq -r 'keys | .[]')
|
items=$(echo "$manifest" | jq -r '.items[].name')
|
||||||
|
|
||||||
|
i=0
|
||||||
|
|
||||||
# Download each plugin from the manifest, can also update plugins.
|
# Download each plugin from the manifest, can also update plugins.
|
||||||
for plugin in $plugins
|
for item in $items
|
||||||
do
|
do
|
||||||
|
type=$(echo "$manifest" | jq -r " .items[$i].type")
|
||||||
|
|
||||||
# Determine download path, extract version and artifact path URL.
|
# Determine download path, extract version and artifact path URL.
|
||||||
dl_path="plugins/$plugin.jar"
|
dl_path="plugins/$item.jar"
|
||||||
version=$(echo "$manifest" | jq -r " .[\"$plugin\"].version")
|
version=$(echo "$manifest" | jq -r " .items[$i].version")
|
||||||
artifact_path=$(echo "$manifest" | jq -r " .[\"$plugin\"].artifacts[0]")
|
|
||||||
|
|
||||||
echo "Installing $plugin v$version to $dl_path"
|
function get_artifact_path() {
|
||||||
|
echo "$manifest" | jq -r " .items[$i].files[] | select(.type == \"${1}\") | .path"
|
||||||
|
}
|
||||||
|
|
||||||
# Download the plugin and store it at the mentioned path.
|
if [ "${type}" = "bukkit-plugin" ]
|
||||||
curl --fail -Ls "$base_url/$artifact_path" --output "$dl_path" || (echo "Failed to download ${artifact_path}"; exit 1)
|
then
|
||||||
|
artifact_path=$(get_artifact_path "plugin-jar")
|
||||||
|
echo "Installing $item v$version to $dl_path from $base_url/$artifact_path"
|
||||||
|
# Download the plugin and store it at the mentioned path.
|
||||||
|
curl --fail -Ls "$base_url/$artifact_path" --output "$dl_path" || (echo "Failed to download ${artifact_path}"; exit 1)
|
||||||
|
fi
|
||||||
|
|
||||||
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user