2023-06-20 22:54:31 +10:00
|
|
|
|
{ ... }:
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
system.activationScripts.createRun.text = ''
|
2025-01-12 16:49:02 +00:00
|
|
|
|
if [[ $(stat -c '%a' /etc/synthetic.conf) != "644" ]]; then
|
|
|
|
|
echo "fixing permissions on /etc/synthetic.conf..."
|
|
|
|
|
sudo chmod 644 /etc/synthetic.conf
|
|
|
|
|
fi
|
2024-11-17 03:12:30 +11:00
|
|
|
|
|
2025-01-12 16:49:02 +00:00
|
|
|
|
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
|
2024-11-17 03:12:30 +11:00
|
|
|
|
|
2025-01-12 16:49:02 +00:00
|
|
|
|
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
|
|
|
|
|
fi
|
2024-11-17 03:12:30 +11:00
|
|
|
|
|
2025-01-12 16:49:02 +00:00
|
|
|
|
sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true
|
|
|
|
|
|
|
|
|
|
if [[ ! -L /run ]]; then
|
|
|
|
|
printf >&2 '[1;31merror: apfs.util failed to symlink /run, aborting activation[0m\n'
|
|
|
|
|
printf >&2 'To create a symlink from /run to /var/run, please run:\n'
|
|
|
|
|
printf >&2 '\n'
|
2025-01-12 16:49:25 +00:00
|
|
|
|
printf >&2 "$ printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf\n"
|
2025-01-12 16:49:02 +00:00
|
|
|
|
printf >&2 '$ sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t\n'
|
|
|
|
|
printf >&2 '\n'
|
|
|
|
|
printf >&2 'The current contents of /etc/synthetic.conf is:\n'
|
|
|
|
|
printf >&2 '\n'
|
2025-01-14 02:19:01 +00:00
|
|
|
|
sed 's/^/ /' /etc/synthetic.conf >&2
|
2025-01-12 16:49:02 +00:00
|
|
|
|
printf >&2 '\n'
|
|
|
|
|
exit 1
|
2023-06-20 22:54:31 +10:00
|
|
|
|
fi
|
|
|
|
|
'';
|
|
|
|
|
}
|