mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
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 ```
This commit is contained in:
parent
3c52583b99
commit
25e0b6064e
1 changed files with 10 additions and 0 deletions
|
@ -5,6 +5,16 @@
|
||||||
IFS="." read -r -a macOSVersion <<< "$(sw_vers -productVersion)"
|
IFS="." read -r -a macOSVersion <<< "$(sw_vers -productVersion)"
|
||||||
|
|
||||||
if [[ ''${macOSVersion[0]} -gt 10 || ( ''${macOSVersion[0]} -eq 10 && ''${macOSVersion[1]} -ge 15 ) ]]; then
|
if [[ ''${macOSVersion[0]} -gt 10 || ( ''${macOSVersion[0]} -eq 10 && ''${macOSVersion[1]} -ge 15 ) ]]; then
|
||||||
|
if [[ $(stat -c '%a' /etc/synthetic.conf) != "644" ]]; then
|
||||||
|
echo "fixing permissions on /etc/synthetic.conf..."
|
||||||
|
sudo chmod 644 /etc/synthetic.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $(grep -c '^run\b' /etc/synthetic.conf) -gt 1 ]]; then
|
||||||
|
echo "found duplicate run entries in /etc/synthetic.conf, removing..."
|
||||||
|
sudo sed -i "" -e '/^run\tprivate\/var\/run$/d' /etc/synthetic.conf
|
||||||
|
fi
|
||||||
|
|
||||||
if ! grep -q '^run\b' /etc/synthetic.conf 2>/dev/null; then
|
if ! grep -q '^run\b' /etc/synthetic.conf 2>/dev/null; then
|
||||||
echo "setting up /run via /etc/synthetic.conf..."
|
echo "setting up /run via /etc/synthetic.conf..."
|
||||||
printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf >/dev/null
|
printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf >/dev/null
|
||||||
|
|
Loading…
Reference in a new issue