summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTravis A. Everett <travis.a.everett@gmail.com>2020-09-08 01:01:11 -0500
committerTravis A. Everett <travis.a.everett@gmail.com>2020-10-19 12:24:31 -0500
commitfe807904e5e6e56b551f34f3586e69ea6498287c (patch)
tree4a370e925b5a06bfa4cbeacfa40585ba9c692897 /scripts
parente736f8f6e44180d7ed7cc1975b48c603c6c4f611 (diff)
adapt to apfs.util flag diff in catalina/big sur
Fixes #3957. Just runs both forms to minimize moving parts.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/create-darwin-volume.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/create-darwin-volume.sh b/scripts/create-darwin-volume.sh
index 8c4558c7f..32fa577a8 100755
--- a/scripts/create-darwin-volume.sh
+++ b/scripts/create-darwin-volume.sh
@@ -26,6 +26,20 @@ test_synthetic_conf() {
grep -q "^nix$" /etc/synthetic.conf 2>/dev/null
}
+# Create the paths defined in synthetic.conf, saving us a reboot.
+create_synthetic_objects(){
+ # Big Sur takes away the -B flag we were using and replaces it
+ # with a -t flag that appears to do the same thing (but they
+ # don't behave exactly the same way in terms of return values).
+ # This feels a little dirty, but as far as I can tell the
+ # simplest way to get the right one is to just throw away stderr
+ # and call both... :]
+ {
+ /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true # Big Sur
+ /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B || true # Catalina
+ } >/dev/null 2>&1
+}
+
test_nix() {
test -d "/nix"
}
@@ -101,7 +115,7 @@ main() {
if ! test_nix; then
echo "Creating mountpoint for /nix..." >&2
- /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B || true
+ create_synthetic_objects # the ones we defined in synthetic.conf
if ! test_nix; then
sudo mkdir -p /nix 2>/dev/null || true
fi