Skip to content

Commit 25e0b60

Browse files
committed
system: fix detection and ownership of /etc/synthetic.conf
This file is owned by root and mode 600 on my system, so the grep is failing and it's adding a new entry every run. ```sh -rw------- 1 root wheel 664 Nov 25 15:52 /etc/synthetic.conf ```
1 parent 3c52583 commit 25e0b60

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

modules/system/base.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
IFS="." read -r -a macOSVersion <<< "$(sw_vers -productVersion)"
66
77
if [[ ''${macOSVersion[0]} -gt 10 || ( ''${macOSVersion[0]} -eq 10 && ''${macOSVersion[1]} -ge 15 ) ]]; then
8+
if [[ $(stat -c '%a' /etc/synthetic.conf) != "644" ]]; then
9+
echo "fixing permissions on /etc/synthetic.conf..."
10+
sudo chmod 644 /etc/synthetic.conf
11+
fi
12+
13+
if [[ $(grep -c '^run\b' /etc/synthetic.conf) -gt 1 ]]; then
14+
echo "found duplicate run entries in /etc/synthetic.conf, removing..."
15+
sudo sed -i "" -e '/^run\tprivate\/var\/run$/d' /etc/synthetic.conf
16+
fi
17+
818
if ! grep -q '^run\b' /etc/synthetic.conf 2>/dev/null; then
919
echo "setting up /run via /etc/synthetic.conf..."
1020
printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf >/dev/null

0 commit comments

Comments
 (0)