1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-06 08:47:00 +00:00

system: remove code for macOS < 11

This commit is contained in:
Emily 2025-01-12 16:49:02 +00:00
parent 303a8143a4
commit ed6c4aabea

View file

@ -2,9 +2,6 @@
{ {
system.activationScripts.createRun.text = '' system.activationScripts.createRun.text = ''
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 if [[ $(stat -c '%a' /etc/synthetic.conf) != "644" ]]; then
echo "fixing permissions on /etc/synthetic.conf..." echo "fixing permissions on /etc/synthetic.conf..."
sudo chmod 644 /etc/synthetic.conf sudo chmod 644 /etc/synthetic.conf
@ -20,24 +17,14 @@
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
fi fi
if [[ ''${macOSVersion[0]} -gt 10 ]]; then
sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true
else
sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B || true
fi
if [[ ! -L /run ]]; then if [[ ! -L /run ]]; then
printf >&2 'error: apfs.util failed to symlink /run, aborting activation\n' printf >&2 'error: apfs.util failed to symlink /run, aborting activation\n'
printf >&2 'To create a symlink from /run to /var/run, please run:\n' printf >&2 'To create a symlink from /run to /var/run, please run:\n'
printf >&2 '\n' printf >&2 '\n'
printf >&2 "$ printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf" printf >&2 "$ printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf"
if [[ ''${macOSVersion[0]} -gt 10 ]]; then
printf >&2 '$ sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t\n' printf >&2 '$ sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t\n'
else
printf >&2 '$ sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B\n'
fi
printf >&2 '\n' printf >&2 '\n'
printf >&2 'The current contents of /etc/synthetic.conf is:\n' printf >&2 'The current contents of /etc/synthetic.conf is:\n'
printf >&2 '\n' printf >&2 '\n'
@ -45,17 +32,5 @@
printf >&2 '\n' printf >&2 '\n'
exit 1 exit 1
fi fi
else
echo "setting up /run..."
sudo ln -sfn private/var/run /run
if [[ ! -L /run ]]; then
printf >&2 'error: failed to symlink /run, aborting activation\n'
printf >&2 'To create a symlink from /run to /var/run, please run:\n'
printf >&2 '\n'
printf >&2 '$ sudo ln -sfn private/var/link /run\n'
exit 1
fi
fi
''; '';
} }