61 lines
2.2 KiB
Bash
Executable File
61 lines
2.2 KiB
Bash
Executable File
#!/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}')"
|