duckstation/scripts/flatpak/update-flathub.sh

33 lines
991 B
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"
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..."
jq ".modules[2].sources = ["\
"{\"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}"