Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sailfishos-chum-repo-config.spec] Rework OBS repository handling, part 2: Enhance #9

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions rpm/sailfishos-chum-repo-config.spec
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ Url:
%post
# The %%post scriptlet is deliberately run when installing and updating.
# Add sailfishos-chum repository configuration, depending on the installed
# SailfishOS release (3.1.0 is the lowest supported, see lines 22 and 76):
# SailfishOS release (3.1.0 is the lowest supported, see lines 22 and 76).
# Set empty default value failing the following tests, because VERSION_ID
# should become overwritten by source'ing /etc/os-release:
VERSION_ID=''
source %{_sysconfdir}/os-release
# Three equivalent variants, but the sed-based ones have additional, ugly
# backslashed quoting of all backslashes, curly braces and brackets (likely
Expand All @@ -159,32 +162,31 @@ source %{_sysconfdir}/os-release
# might be advisable, when using it inside a %%define statement's `%%()` ).
sailfish_version="$(echo "$VERSION_ID" | cut -s -f 1-3 -d '.' | tr -d '.')"
# Must be an all numerical string of at least three digits:
if echo "$sailfish_version" | grep -q '^[0-9][0-9][0-9][0-9]*$'
then
if [ "$sailfish_version" -lt 460 ]
then ssu ar sailfishos-chum 'https://repo.sailfishos.org/obs/sailfishos:/chum/%%(release)_%%(arch)/'
else ssu ar sailfishos-chum 'https://repo.sailfishos.org/obs/sailfishos:/chum/%%(releaseMajorMinor)_%%(arch)/'
if ! echo "$sailfish_version" | grep -q '^[0-9][0-9][0-9][0-9]*$'
then echo "Error: VERSION_ID=$VERSION_ID => sailfish_version=$sailfish_version" >&2
else
if [ "$sailfish_version" -ge 460 ]
then ssu ar sailfishos-chum 'https://repo.sailfishos.org/obs/sailfishos:/chum/%%(releaseMajorMinor)_%%(arch)/'
else ssu ar sailfishos-chum 'https://repo.sailfishos.org/obs/sailfishos:/chum/%%(release)_%%(arch)/'
fi
# Should be enhanced to proper debug output, also writing to systemd-journal:
else echo "Error: VERSION_ID=$VERSION_ID => sailfish_version=$sailfish_version" >&2
ssu ur
fi
ssu ur
exit 0

%post testing
VERSION_ID=''
source %{_sysconfdir}/os-release
sailfish_version="$(echo "$VERSION_ID" | cut -s -f 1-3 -d '.' | tr -d '.')"
# Must be an all numerical string of at least three digits:
if echo "$sailfish_version" | grep -q '^[0-9][0-9][0-9][0-9]*$'
then
if [ "$sailfish_version" -lt 460 ]
then ssu ar sailfishos-chum-testing 'https://repo.sailfishos.org/obs/sailfishos:/chum:/testing/%%(release)_%%(arch)/'
else ssu ar sailfishos-chum-testing 'https://repo.sailfishos.org/obs/sailfishos:/chum:/testing/%%(releaseMajorMinor)_%%(arch)/'
if ! echo "$sailfish_version" | grep -q '^[0-9][0-9][0-9][0-9]*$'
then echo "Error: VERSION_ID=$VERSION_ID => sailfish_version=$sailfish_version" >&2
else
if [ "$sailfish_version" -ge 460 ]
then ssu ar sailfishos-chum-testing 'https://repo.sailfishos.org/obs/sailfishos:/chum:/testing/%%(releaseMajorMinor)_%%(arch)/'
else ssu ar sailfishos-chum-testing 'https://repo.sailfishos.org/obs/sailfishos:/chum:/testing/%%(release)_%%(arch)/'
fi
# Should be enhanced to proper debug output, also writing to systemd-journal:
else echo "Error: VERSION_ID=$VERSION_ID => sailfish_version=$sailfish_version" >&2
ssu ur
fi
ssu ur
exit 0

%postun
Expand Down
Loading