-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup/upgrade command that downloads vpinball #139
Labels
enhancement
New feature or request
Comments
this is what jsm came up with #!/bin/bash
set -e
PAT=""
download_artifact()
{
local REPO="$1"
local TOKEN="$2"
local BRANCH="$3"
local WORKFLOW_NAME="$4"
local SUFFIX="$5"
local RUN_ID=$(curl -s -H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$REPO/actions/runs?branch=$BRANCH" | \
jq --arg workflow "$WORKFLOW_NAME" \
'.workflow_runs[] | select(.conclusion=="success" and .name==$workflow) | .id' | head -n 1)
if [[ -z "$RUN_ID" ]]; then
echo "No matching run found for branch $BRANCH and workflow name $WORKFLOW_NAME."
return 1
fi
local ARTIFACT_DATA=$(curl -s -H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$REPO/actions/runs/$RUN_ID/artifacts" | \
jq --arg suffix "$SUFFIX" \
'.artifacts[] | select(.name | endswith($suffix))')
local ARTIFACT_URL=$(echo "$ARTIFACT_DATA" | jq -r '.archive_download_url')
ARTIFACT_NAME=$(echo "$ARTIFACT_DATA" | jq -r '.name')
ARTIFACT_NAME="$ARTIFACT_NAME.zip"
echo "Downloading $ARTIFACT_NAME..."
curl -L -o "${ARTIFACT_NAME}" -H "Authorization: token $TOKEN" "$ARTIFACT_URL"
}
pkill vpxds
pkill VPinballX_GL
rm -rf _upgrade
mkdir _upgrade
cd _upgrade
# Download and install vpxds
mkdir vpxds
cd vpxds
download_artifact "jsm174/vpxds" "$PAT" "master" "build"
unzip $ARTIFACT_NAME
rm /userdata/system/configs/vpinball/vpxds
cp vpxds /userdata/system/configs/vpinball
chmod +x /userdata/system/configs/vpinball/vpxds
cd ..
# Download and install vpinball
mkdir vpinball
cd vpinball
download_artifact "vpinball/vpinball" "$PAT" "standalone" "vpinball" "Release-linux-x64"
unzip $ARTIFACT_NAME
rm -rf /usr/bin/vpinball
mkdir /usr/bin/vpinball
cp VPinballX_GL /usr/bin/vpinball
chmod +x /usr/bin/vpinball/VPinballX_GL
cp -r res /usr/bin/vpinball
cp -r flexdmd /usr/bin/vpinball
cp -r scripts /usr/bin/vpinball
cp -r shader /usr/bin/vpinball
cd ..
# Save overlay
batocera-save-overlay
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: