On Sat, Mar 24, 2018 at 06:05:08PM +0100, Thomas A. Schmitz wrote:
On 03/24/2018 05:51 PM, Mojca Miklavec wrote:
I reverted the change for now until someone can come up with a working command.
Arthur's
if command -v ldd >/dev/null && ldd --version 2>&1 | fgrep -q '^musl'
works for me, but again, there may be other corner cases that we don't see now. I would suggest reversing the logic of this test: default to linux unless you clearly find the string "musl" in the output; don't rely on a zero result, which may be prevented by a number f reasons...
I completely agree. Even in that form, the test can fail if for example there is no ldd in the path; which is somewhat unlikely on Linux, but still. Reversing the logic seems imperative; as for example in if ! command -v ldd >/dev/null || ! ldd --version 2>&1 | grep -E -q '^musl'; then libc=glic else libc=musl fi But do test thoroughly before installing, please. By the way, Thomas, what you wrote is slightly different from what I suggested earlier (by one character), and it would actually make the test fail even if you had a musl libc: fgrep tests for the presence of the literal string “^musl” and will thus return 1. You meant, of course, egrep for grepping regular expressions (alias of grep -E). That’s what I’m using in the test above, which will thus also fail if the default grep doesn’t support the -E switch, but with my suggestion it won’t affect the vast majority of users, since they don’t have musl. Best, Arthur