mirror of
https://github.com/NixOS/nix
synced 2025-07-08 15:13:55 +02:00
fix xpath and conditional bugs; xpath -> xmllint
- xpath -> xmllint: xpath's cli interface changed in Big Sur
rather than add conditional logic for picking the correct
syntax for xpath, I'm changing to xmllint --xpath, which
appears to be consistent across versions I've tested...
- /plist/dict/key[text()='Writable']/following-sibling::true[1]
doesn't do quite what's expected. It was written to try to
select a <true /> node paired with the Writable key, but it
will also select the *next* <true /> node that appears even
if it was paired with another key.
- I think there's also a logic bug in the conditionals here.
I'm not sure anyone ever actuall saw it, thanks to the xpath
bug, though. With the xpath fix, this conditional passes if /nix
does not exist, / IS writable, and the version is Catalina+.
I think it meant to test for /nix does not exist, / is NOT
writable, and the version is Catalina+. I reworked this lightly
to make it a little clearer at the code level.
(cherry picked from commit 1f02b65c59
)
Signed-off-by: Domen Kožar <domen@dev.si>
This commit is contained in:
parent
14c7e77bc4
commit
72b8673e06
1 changed files with 2 additions and 2 deletions
|
@ -112,8 +112,8 @@ if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
"$self/create-darwin-volume.sh"
|
"$self/create-darwin-volume.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info=$(diskutil info -plist / | xpath "/plist/dict/key[text()='Writable']/following-sibling::true[1]" 2> /dev/null)
|
writable="$(diskutil info -plist / | xmllint --xpath "name(/plist/dict/key[text()='Writable']/following-sibling::*[1])" -)"
|
||||||
if ! [ -e $dest ] && [ -n "$info" ] && { [ "$macos_major" -gt 10 ] || { [ "$macos_major" -eq 10 ] && [ "$macos_minor" -gt 14 ]; }; }; then
|
if ! [ -e $dest ] && [ "$writable" = "false" ]; then
|
||||||
(
|
(
|
||||||
echo ""
|
echo ""
|
||||||
echo "Installing on macOS >=10.15 requires relocating the store to an apfs volume."
|
echo "Installing on macOS >=10.15 requires relocating the store to an apfs volume."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue