aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2020-03-18 20:34:46 +0100
committerDaiderd Jordan <daiderd@gmail.com>2020-05-21 19:58:11 +0200
commitbc24c09968bb35fce599151f86d123cb5984f727 (patch)
tree10dcc71a698e5d841fe4aa9398c5d20f127d152a
parent04f597c3f4d0ac8b8a677c798642329a5a6768e3 (diff)
install: make synthetic.conf and fstab checks stricter
-rwxr-xr-xscripts/create-darwin-volume.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/create-darwin-volume.sh b/scripts/create-darwin-volume.sh
index e2b49c9a0..ea4133444 100755
--- a/scripts/create-darwin-volume.sh
+++ b/scripts/create-darwin-volume.sh
@@ -39,11 +39,15 @@ find_nix_volume() {
}
test_fstab() {
- grep -q "/nix" /etc/fstab 2>/dev/null
+ grep -q "/nix apfs rw" /etc/fstab 2>/dev/null
+}
+
+test_nix_symlink() {
+ [ -L "/nix" ] || grep -q "^nix." /etc/synthetic.conf 2>/dev/null
}
test_synthetic_conf() {
- grep -q "^nix" /etc/synthetic.conf 2>/dev/null
+ grep -q "^nix$" /etc/synthetic.conf 2>/dev/null
}
test_nix() {
@@ -60,12 +64,12 @@ main() {
echo ""
echo " 1. Remove the entry from fstab using 'sudo vifs'"
echo " 2. Destroy the data volume using 'diskutil apfs deleteVolume'"
- echo " 3. Delete /etc/synthetic.conf"
+ echo " 3. Remove the 'nix' line from /etc/synthetic.conf or the file"
echo ""
) >&2
- if [ -L "/nix" ]; then
- echo "error: /nix is a symlink, please remove it or edit synthetic.conf (requires reboot)" >&2
+ if test_nix_symlink; then
+ echo "error: /nix is a symlink, please remove it and make sure it's not in synthetic.conf (in which case a reboot is required)" >&2
echo " /nix -> $(readlink "/nix")" >&2
exit 2
fi