File update_xrdesktop_patch.sh of Package gnome-shell-xrdesktop
#!/bin/bash
# Usage: update_xrdesktop_patch.sh [desired xrdesktop version]
# By default, the version specified in the spec file is used to determine the branch with the xrdesktop patches.
set -euo pipefail
REPO_DIR="repo-gnome-shell"
repogit(){
git -C "${REPO_DIR}" $@
}
if [ ! -f "gnome-shell.spec" ]; then
echo "No 'gnome-shell.spec' found. Have you expanded the sources?"
exit 1
fi
VERSION="$(rpmspec -q --srpm --qf "%{version}" gnome-shell.spec)"
if [ -d "${REPO_DIR}/.git" ]; then
repogit fetch --all
else
git clone https://gitlab.freedesktop.org/xrdesktop/gnome-shell "${REPO_DIR}"
repogit remote add gnome https://gitlab.gnome.org/GNOME/gnome-shell
repogit fetch gnome
fi
DESIRED_VERSION="${1:-${VERSION}}"
XRDESKTOP_BRANCHES=($(repogit branch -rl "origin/${DESIRED_VERSION}*"))
BRANCH=""
if [ "${#XRDESKTOP_BRANCHES[@]}" -eq 1 ]; then
BRANCH="${XRDESKTOP_BRANCHES[0]}"
elif [ "${#XRDESKTOP_BRANCHES[@]}" -eq 0 ]; then
echo "No matching branch found!"
exit 1
else
echo -e "\nMultiple matching branches found."
while [ -z "${BRANCH}" ]; do
counter=0
for b in ${XRDESKTOP_BRANCHES[@]}; do
echo "${counter}. ${b}"
counter=$((counter+1))
done
read -p "Please choose a branch [0-$((${#XRDESKTOP_BRANCHES[@]}-1))]: " branch_number
if [ 0 -le "${branch_number}" -a "${branch_number}" -lt "${#XRDESKTOP_BRANCHES[@]}" ]; then
BRANCH="${XRDESKTOP_BRANCHES[${branch_number}]}"
fi
done
fi
repogit diff "${VERSION}" "${BRANCH}" -- . ':(exclude)subprojects/gvc' > gnome-shell-xrdesktop.patch