This commit is contained in:
Brian Zalewski 2024-05-18 04:46:41 +00:00
parent 31ec9798a6
commit b9ac1c9163
11 changed files with 112 additions and 28 deletions

View file

@ -445,28 +445,6 @@ emscriptenInstall() {
fi
}
# @description
# Adds auto-update feature to macOS that automatically downloads and installs updates. Also enables
# an auto-update feature for Homebrew on macOS.
enableAutoUpdateDarwin() {
if [ -d /Applications ] && [ -d /System ]; then
### Enable automated system updates on macOS
if [ -f "$HOME/Library/LaunchDaemons/com.apple.automatedupdates.plist" ] && [ ! -f "/Library/LaunchDaemons/com.apple.automatedupdates.plist" ]; then
logg info 'Configuring macOS to automatically apply system updates'
sudo mkdir -p /Library/LaunchDaemons
sudo cp -f "$HOME/Library/LaunchDaemons/com.apple.automatedupdates.plist" "/Library/LaunchDaemons/com.apple.automatedupdates.plist"
logg info 'Loading /Library/LaunchDaemons/com.apple.automatedupdates.plist'
sudo launchctl load "/Library/LaunchDaemons/com.apple.automatedupdates.plist" && logg success 'launchctl load successful'
fi
### Enable Homebrew auto-update service
if brew autoupdate status | grep 'Autoupdate is not configured.' > /dev/null; then
logg info 'Enabling Homebrew auto-update service (every 24 hours)'
brew autoupdate start --cleanup --greedy --upgrade
fi
fi
}
ensurePipUpdated() {
### python3.10 pip update
if command -v python3.10 > /dev/null; then
@ -1012,7 +990,6 @@ if [ -n "$DEBUG" ] || [ -n "$DEBUG_MODE" ]; then
dconfSettings
decryptSSHKeys
emscriptenInstall
enableAutoUpdateDarwin
ensureQtStyleOverride
ensurePipUpdated
ensureSystemGemUpdated
@ -1039,7 +1016,6 @@ else
dconfSettings &
decryptSSHKeys &
emscriptenInstall &
enableAutoUpdateDarwin &
ensureQtStyleOverride &
ensurePipUpdated &
ensureSystemGemUpdated &

View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# @file Chezmoi System Apply
# @brief Applies the Chezmoi files defined in the `system/` directory of the Install Doctor project to the root of the system (for locations outside the user's home directory)
# @description
# This script applies the `system/` Chezmoi directory to the root of the system.
logg info 'TODO - Implement system configuration apply'

View file

@ -368,11 +368,39 @@ ubuntuDashToDockFix() {
fi
}
# @description
# Adds auto-update feature to macOS that automatically downloads and installs updates. Also enables
# an auto-update feature for Homebrew on macOS.
enableAutoUpdateDarwin() {
if [ -d /Applications ] && [ -d /System ]; then
### Enable automated system updates on macOS
if [ -f "/Library/LaunchDaemons/com.apple.automatedupdates.plist" ]; then
logg info 'Configuring macOS to automatically apply system updates'
sudo mkdir -p /Library/LaunchDaemons
logg info 'Loading /Library/LaunchDaemons/com.apple.automatedupdates.plist'
if sudo launchctl list | grep 'com.apple.automatedupdates' > /dev/null; then
logg info 'Unloading previous com.apple.automatedupdates configuration'
sudo launchctl unload /Library/LaunchDaemons/clamdscan.plist
fi
sudo launchctl load -w /Library/LaunchDaemons/com.apple.automatedupdates.plist
else
logg warn '/Library/LaunchDaemons/com.apple.automatedupdates.plist is missing!'
fi
### Enable Homebrew auto-update service
if brew autoupdate status | grep 'Autoupdate is not configured.' > /dev/null; then
logg info 'Enabling Homebrew auto-update service (every 24 hours)'
brew autoupdate start --cleanup --greedy --upgrade
fi
fi
}
if [ -n "$DEBUG" ] || [ -n "$DEBUG_MODE" ]; then
logg info 'The DEBUG or DEBUG_MODE environment variable is set so the post-install tasks will be run synchronously'
bashItPlugins
candyIconTweaks
configureVNC
enableAutoUpdateDarwin
moveGnomeAppsToShare
preloadZsh
removeShortcutsLinux
@ -383,6 +411,7 @@ else
bashItPlugins &
candyIconTweaks &
configureVNC &
enableAutoUpdateDarwin &
moveGnomeAppsToShare &
preloadZsh &
removeShortcutsLinux &

View file

@ -0,0 +1,29 @@
{{- if (lookPath "cloudflared") -}}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.cloudflare.cloudflared</string>
<key>ProgramArguments</key>
<array>
<string>{{ lookPath "cloudflared" }}</string>
<string>tunnel</string>
<string>run</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/Library/Logs/com.cloudflare.cloudflared.out.log</string>
<key>StandardErrorPath</key>
<string>/Library/Logs/com.cloudflare.cloudflared.err.log</string>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>ThrottleInterval</key>
<integer>5</integer>
</dict>
</plist>
{{- end -}}

View file

@ -65,8 +65,13 @@ if command -v cloudflared > /dev/null; then
logg info 'Running sudo cloudflared service install'
sudo cloudflared service install
fi
sudo cp -f "$HOME/Library/LaunchDaemons/com.cloudflare.cloudflared.plist" /Library/LaunchDaemons/com.cloudflare.cloudflared.plist
logg info 'Ensuring cloudflared service is started'
sudo launchctl start com.cloudflare.cloudflared
if sudo launchctl list | grep 'com.cloudflare.cloudflared' > /dev/null; then
logg info 'Unloading previous com.cloudflare.cloudflared configuration'
sudo launchctl unload /Library/LaunchDaemons/com.cloudflare.cloudflared.plist
fi
sudo launchctl load -w /Library/LaunchDaemons/com.cloudflare.cloudflared.plist
elif [ -f /etc/os-release ]; then
### Linux
if systemctl --all --type service | grep -q "cloudflared" > /dev/null; then

3
system/.chezmoiignore Normal file
View file

@ -0,0 +1,3 @@
{{- if ne .host.distro.family "darwin" }}
Library
{{- end }}

View file

@ -19,4 +19,4 @@
<key>StandardOutPath</key>
<string>/var/log/ccom.apple.automatedupdates.plist.debug.log</string>
</dict>
</plist>
</plist>

View file

@ -0,0 +1,29 @@
{{- if (lookPath "cloudflared") -}}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.cloudflare.cloudflared</string>
<key>ProgramArguments</key>
<array>
<string>{{ lookPath "cloudflared" }}</string>
<string>tunnel</string>
<string>run</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/Library/Logs/com.cloudflare.cloudflared.out.log</string>
<key>StandardErrorPath</key>
<string>/Library/Logs/com.cloudflare.cloudflared.err.log</string>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>ThrottleInterval</key>
<integer>5</integer>
</dict>
</plist>
{{- end -}}

View file

@ -1,3 +1,4 @@
{{- if (lookPath "juicefs") -}}
/var/log/juicefs.log {
daily
rotate 7
@ -6,4 +7,5 @@
missingok
notifempty
copytruncate
}
}
{{- end -}}

View file

@ -1,5 +1,7 @@
{{- if (stat "/proc/sys/fs/binfmt_misc/WSLInterop") -}}
[wsl2]
nestedVirtualization=true
[boot]
command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm'
command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm'
{{- end -}}

View file

@ -1,3 +1,4 @@
{{- if (lookPath "zsh") -}}
# System-wide profile for interactive zsh(1) shells.
# Setup user specific overrides for this in ~/.zshrc. See zshbuiltins(1)
@ -76,3 +77,4 @@ PS1="%n@%m %1~ %# "
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
{{- end -}}