lsb-release: Fix/replace with a custom Bash script#64258
lsb-release: Fix/replace with a custom Bash script#64258primeos merged 7 commits intoNixOS:masterfrom
Conversation
|
Re: TODOS
For inclusion in this repo MIT is best.
Can be done later. Should not delay this PR. Also, just support the standard lines.
This script has an additional newline at the end of the output. Except that identical to debian and ubuntu. 👍 |
Co-Authored-By: David Kleuker <davidak@users.noreply.github.com>
That also tricked me but this is due to the configuration of But I just noticed that the script from Debian prints Thanks for pasting the outputs on other operating systems, that's really helpful :) (I only compared it to the output on Debian stretch) |
|
I think the newline is no problem. It's only different.
I just used docker to quickly spin up an instance. Perfectly for such tests :) |
What I meant is that this is caused by the shell, not by the program ( The prompt is configured to print an additional newline (via So the output should actually be identical now (apart from the actual values of course). |
davidak
left a comment
There was a problem hiding this comment.
Code looks sane and script works as expected. Thanks!
|
@primeos is this ready for merging or do you want to change anything before? |
Seems like a good idea as some variables could contain special characters (e.g. "*"), especially on other operating systems.
@davidak Sorry for the delay, I ran out of time (the time of this PR was a bit suboptimal). cc @dtzWill @rardiol (previous contributors to |
|
This pull request has been mentioned on Nix community. There might be relevant details there: |
This also fixes the short output.
The previous behaviour broke e.g. the build of radiotray-ng:
Error: /etc/os-release is not present, aborting.
Error: /etc/os-release is not present, aborting.
Error: /etc/os-release is not present, aborting.
CMake Error at package/CMakeLists.txt:10 (string):
string no output variable specified
Building version: 0.2.6 for -- DEB packaging...
CMake Error at package/CMakeLists.txt:56 (if):
if given arguments:
"STREQUAL" "16.04" "OR" "STREQUAL" "stretch"
Unknown arguments specified
-- Configuring incomplete, errors occurred!
Unfortunately I was pretty busy and lost track of this PR... I did try my best to make the output as backwards compatible as possible (at least without Unfortunately the code isn't really nice anymore but I guess it'll have to do for now... (we can still refactor it later if it works as intended). Also: We might want to change the default values if we're in a Nix build sandbox to increase the usefulness of the new script (currently it only helps at run-time). |
Motivation for this change
See #22729 and #23175.
TODOs:
/etc/os-releaseother files is most likely not standardized.
/etc/os-releasesare not quoted (but that file should always be owned by root).Things done
sandboxinnix.confon non-NixOS)nix-shell -p nix-review --run "nix-review wip"./result/bin/)nix path-info -Sbefore and after)