Skip to content

Commit

Permalink
Merge pull request LnL7#1198 from ascandella/fix-etc-synthetic
Browse files Browse the repository at this point in the history
Fix detection and ownership of /etc/synthetic.conf entry
  • Loading branch information
Enzime authored Nov 26, 2024
2 parents 3c52583 + 25e0b60 commit 6ab87b7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/system/base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
IFS="." read -r -a macOSVersion <<< "$(sw_vers -productVersion)"
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
echo "setting up /run via /etc/synthetic.conf..."
printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf >/dev/null
Expand Down

0 comments on commit 6ab87b7

Please sign in to comment.