Skip to content

Commit

Permalink
[sailfishos-chum-gui-installer.spec] Rework OBS repository handling, …
Browse files Browse the repository at this point in the history
…part 2: Enhance (#45)
  • Loading branch information
Olf0 authored Nov 8, 2024
1 parent 13d60ad commit 7ab8ab4
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions rpm/sailfishos-chum-gui-installer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ then
umask "$curmask"
fi
# Add sailfishos-chum repository configuration, depending on the installed
# SailfishOS release (3.1.0 is the lowest supported, see line 61):
# SailfishOS release (3.1.0 is the lowest supported, see line 61).
# 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 @@ -158,16 +161,15 @@ 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 log-file and systemd-journal:
else echo "Error: VERSION_ID=$VERSION_ID => sailfish_version=$sailfish_version" >&2
ssu ur
fi
ssu ur
# BTW, `ssu`, `rm -f`, `mkdir -p` etc. *always* return with "0" ("success"), hence
# no appended `|| true` needed to satisfy `set -e` for failing commands outside of
# flow control directives (if, while, until etc.). Furthermore Fedora Docs etc.
Expand Down

0 comments on commit 7ab8ab4

Please sign in to comment.