Add opt-in Plasma fingerprint workaround

This commit is contained in:
ajp_anton
2026-09-04 23:16:15 +00:00
parent 810c8caf74
commit 19df3c3a75
16 changed files with 920 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
source_dir="$repo_root/plasma-fingerprint-workaround/kscreenlocker"
topdir="$repo_root/rpmbuild"
version=${KSCREENLOCKER_VERSION:-6.7.4}
base_release=${KSCREENLOCKER_BASE_RELEASE:-1}
workaround_release=${KSCREENLOCKER_WORKAROUND_RELEASE:-5}
archive="$topdir/SOURCES/kscreenlocker-$version.tar.xz"
archive_url="https://download.kde.org/stable/plasma/$version/kscreenlocker-$version.tar.xz"
if [[ $version == 6.7.4 ]]; then
default_archive_sha256=f9cd525d501f08931f2c0b4d08f5384588967bc89fac62e39ed4ae2da2925a39
else
default_archive_sha256=
fi
archive_sha256=${KSCREENLOCKER_SOURCE_SHA256:-$default_archive_sha256}
if [[ ! $archive_sha256 =~ ^[[:xdigit:]]{64}$ ]]; then
printf 'Error: set KSCREENLOCKER_SOURCE_SHA256 for KScreenLocker %s.\n' \
"$version" >&2
exit 2
fi
mkdir -p "$topdir"/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
if [[ ! -f $archive ]]; then
temporary_archive="$archive.download"
trap 'rm -f -- "$temporary_archive"' EXIT
curl --fail --location --show-error \
--proto '=https' --proto-redir '=https' \
--output "$temporary_archive" "$archive_url"
mv -- "$temporary_archive" "$archive"
trap - EXIT
fi
printf '%s %s\n' "$archive_sha256" "$archive" |
sha256sum --check --status - || {
printf 'Error: KScreenLocker source archive checksum does not match.\n' >&2
exit 1
}
for patch in "$source_dir"/patches/*.patch; do
install -m 0644 "$patch" "$topdir/SOURCES/${patch##*/}"
done
install -m 0755 \
"$source_dir/restart-fprintd-after-resume" \
"$topdir/SOURCES/restart-fprintd-after-resume"
rpmbuild \
--define "_topdir $topdir" \
--define "upstream_version $version" \
--define "base_release $base_release" \
--define "workaround_release $workaround_release" \
-ba "$source_dir/kscreenlocker.spec"
rpm_path="$topdir/RPMS/$(rpm --eval '%{_arch}')/kscreenlocker-$version-$base_release$(rpm --eval '%{?dist}').ajp$workaround_release.$(rpm --eval '%{_arch}').rpm"
bash "$repo_root/plasma-fingerprint-workaround/tests/test-patched-kscreenlocker-rpm" \
"$rpm_path" "$version-$base_release$(rpm --eval '%{?dist}')"
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
tool_dir="$repo_root/plasma-fingerprint-workaround"
topdir="$repo_root/rpmbuild"
mkdir -p "$topdir"/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
install -m 0755 \
"$tool_dir/plasma-fingerprint-workaround" \
"$topdir/SOURCES/plasma-fingerprint-workaround"
install -m 0644 "$tool_dir/payload.conf" "$topdir/SOURCES/payload.conf"
install -m 0644 "$repo_root/LICENSE" "$topdir/SOURCES/LICENSE"
install -m 0644 "$tool_dir/README.md" "$topdir/SOURCES/README.md"
install -m 0755 "$tool_dir/tests/test-controller" "$topdir/SOURCES/test-controller"
rpmbuild \
--define "_topdir $topdir" \
-bb "$tool_dir/plasma-fingerprint-workaround.spec"
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
printf 'Usage: GITEA_TOKEN=... %s PATH_TO_RPM\n' "$0" >&2
}
if (( $# != 1 )); then
usage
exit 2
fi
repo_root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
payload_config="$repo_root/plasma-fingerprint-workaround/payload.conf"
rpm_path=$1
if [[ ! -f $rpm_path || $rpm_path != *.rpm ]]; then
printf 'Error: %s is not an RPM file.\n' "$rpm_path" >&2
exit 2
fi
if [[ -z ${GITEA_TOKEN:-} ]]; then
printf 'Error: set GITEA_TOKEN to a Gitea access token with package write permission.\n' >&2
exit 2
fi
payload_url=
payload_sha256=
# shellcheck source=/dev/null
source "$payload_config"
actual_sha256=$(sha256sum "$rpm_path")
actual_sha256=${actual_sha256%% *}
if [[ $actual_sha256 != "$payload_sha256" ]]; then
printf 'Error: RPM checksum does not match payload.conf.\n' >&2
exit 1
fi
if [[ ${rpm_path##*/} != "${payload_url##*/}" ]]; then
printf 'Error: RPM filename does not match payload.conf.\n' >&2
exit 1
fi
curl \
--fail-with-body \
--show-error \
--silent \
--user "ajp_anton:${GITEA_TOKEN}" \
--upload-file "$rpm_path" \
"$payload_url"
printf 'Published %s as a generic Gitea package.\n' "$rpm_path"