diff --git a/rpm/sailfishos-chum-gui-installer.spec b/rpm/sailfishos-chum-gui-installer.spec index a1d9ad4..6f44238 100644 --- a/rpm/sailfishos-chum-gui-installer.spec +++ b/rpm/sailfishos-chum-gui-installer.spec @@ -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 @@ -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.