From 3ffb000828f53e015c9b00c305aa9094db024256 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 24 Nov 2024 21:49:14 +0100 Subject: [PATCH 1/2] [harbour-storeman-installer.spec] Fix missing `$` for variable evaluation --- rpm/harbour-storeman-installer.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/harbour-storeman-installer.spec b/rpm/harbour-storeman-installer.spec index 14b1496..2500767 100644 --- a/rpm/harbour-storeman-installer.spec +++ b/rpm/harbour-storeman-installer.spec @@ -175,7 +175,7 @@ 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 '.')" # sailfish_version 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]*$' +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 # Ensure that the repo config is correct: If it is missing or a fixed From 536780622fbd79b8a99d672a9077da8ce707e3a2 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 24 Nov 2024 22:05:07 +0100 Subject: [PATCH 2/2] [harbour-storeman-installer.spec] Beautify, comment and enhance --- rpm/harbour-storeman-installer.spec | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rpm/harbour-storeman-installer.spec b/rpm/harbour-storeman-installer.spec index 2500767..7b984ab 100644 --- a/rpm/harbour-storeman-installer.spec +++ b/rpm/harbour-storeman-installer.spec @@ -175,7 +175,7 @@ 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 '.')" # sailfish_version 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]*$' +if [ $(echo "$sailfish_version" | grep -c '^[0-9][0-9][0-9][0-9]*$') != 1 ] then echo "Error: VERSION_ID=$VERSION_ID => sailfish_version=$sailfish_version" >&2 else # Ensure that the repo config is correct: If it is missing or a fixed @@ -183,6 +183,7 @@ else release_macro="$(grep '^harbour-storeman-obs=' %{_sysconfdir}/ssu/ssu.ini | grep -o '/[[:graph:]][[:graph:]][[:graph:]][[:graph:]]*/$' | grep -o '%%(release[[:alpha:]]*)')" if [ $sailfish_version -ge 460 ] && [ "$release_macro" != '%%(releaseMajorMinor)' ] then + # No `ssu rr harbour-storeman-obs` needed, because an `ssu ar ` overwrites an extant entry. ssu ar harbour-storeman-obs 'https://repo.sailfishos.org/obs/home:/olf:/harbour-storeman/%%(releaseMajorMinor)_%%(arch)/' ssu_ur=yes elif [ $sailfish_version -lt 460 ] && [ "$release_macro" != '%%(release)' ] @@ -191,9 +192,7 @@ else ssu_ur=yes fi fi -if [ $ssu_ur = yes ] -then ssu ur -fi +[ $ssu_ur = yes ] && 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.