fixed and simplified ubuntu version comparison #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch fixed the Ubuntu version comparison and simplifies it to not use bc.
When using Ubuntu 22.04 using the original version, I get the following error:
./preinstall.sh: 14: 1: not found
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package libuhd4.6.0t64
E: Couldn't find any package by glob 'libuhd4.6.0t64'
E: Unable to locate package cppzmq-dev
Since bc outputs a "1" on the string comparison, which preinstall.sh then attempts to execute.
After that, the intended packages for Ubuntu 22.04 are not installed and the rest fails.
When using Ubuntu 24.04 using the original version, I get the following error:
./preinstall.sh: 14: 0: not found
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
comerr-dev icu-devtools krb5-multidev libboost-chrono1.83.0t64 libboost-filesystem1.83.0 libboost-serialization1.83.0 libboost-thread1.83.0 libbsd-dev libgssrpc4t64 libicu-dev
libkadm5clnt-mit12 libkadm5srv-mit12 libkdb5-10t64 libkrb5-dev libmd-dev libmd0 libnorm-dev libnorm1t64 libpgm-5.3-0t64 libpgm-dev libsodium-dev libxml2-dev libzmq3-dev libzmq5
Suggested packages:
...
Likewise here, the result of the string comparison is executed ("0") and fails, so that by accident
the correct packages are installed on Ubuntu 24.04.
This fix simplifies the string comparison to use the builtin sh functionality and removes bc.
Tested with both Ubuntu 22.04 and 24.04.