Duckstation/scripts/flatpak/update-flathub.sh

37 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
APPID=org.duckstation.DuckStation
SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
if [[ $# -lt 1 ]]; then
echo "Output directory must be provided as a parameter"
exit 1
fi
OUTDIR=$(realpath "$1")
2023-09-30 02:38:21 +00:00
OUTMANIFEST="${OUTDIR}/${APPID}.json"
2023-09-30 02:38:21 +00:00
echo -n "Get revision: "
pushd "${SCRIPTDIR}" >/dev/null
GIT_HASH=$(git rev-parse HEAD)
2023-09-30 02:38:21 +00:00
popd >/dev/null
echo "${GIT_HASH}"
2023-09-30 02:38:21 +00:00
echo "Updating files in ${OUTDIR}..."
mkdir -p "${OUTDIR}"
rm -fr "${OUTDIR}/modules"
cp -a "${SCRIPTDIR}/modules" "${OUTDIR}/modules"
2024-04-16 05:11:10 +00:00
cp "${SCRIPTDIR}/../shaderc-changes.patch" "${OUTDIR}/modules"
2023-09-30 02:38:21 +00:00
echo "Generate AppStream XML..."
"${SCRIPTDIR}/../../scripts/generate-metainfo.sh" "${OUTDIR}"
2023-09-30 02:38:21 +00:00
echo "Patching Manifest Sources..."
2024-04-16 05:11:10 +00:00
jq ".sources[4] = {\"type\": \"patch\", \"path\": \"shaderc-changes.patch\"}" \
"${SCRIPTDIR}/modules/22-shaderc.json" > "${OUTDIR}/modules/22-shaderc.json"
jq ".modules[3].sources = ["\
2023-09-30 02:38:21 +00:00
"{\"type\": \"git\", \"url\": \"https://github.com/stenzek/duckstation.git\", \"commit\": \"${GIT_HASH}\", \"disable-shallow-clone\": true},"\
"{\"type\": \"file\", \"path\": \"org.duckstation.DuckStation.metainfo.xml\", \"dest\": \"scripts/flatpak\"}]" \
"${SCRIPTDIR}/${APPID}.json" > "${OUTMANIFEST}"