Add omarchy-doctor

This commit is contained in:
Ryan Hughes
2025-09-28 00:41:37 -04:00
parent 0b172dbef1
commit 57a977a51d
40 changed files with 1032 additions and 356 deletions

View File

@@ -1,5 +1,20 @@
# Ensure timezone can be updated without needing to sudo
sudo tee /etc/sudoers.d/omarchy-tzupdate >/dev/null <<EOF
OMARCHY_DESCRIPTION="Timezone Update Permissions"
omarchy_install() {
# Ensure timezone can be updated without needing to sudo
sudo tee /etc/sudoers.d/omarchy-tzupdate >/dev/null <<EOF
%wheel ALL=(root) NOPASSWD: /usr/bin/tzupdate, /usr/bin/timedatectl
EOF
sudo chmod 0440 /etc/sudoers.d/omarchy-tzupdate
sudo chmod 0440 /etc/sudoers.d/omarchy-tzupdate
}
omarchy_verify() {
sudo test -f /etc/sudoers.d/omarchy-tzupdate || add_error "Timezone sudoers file missing"
if sudo test -f /etc/sudoers.d/omarchy-tzupdate; then
local perms=$(sudo stat -c %a /etc/sudoers.d/omarchy-tzupdate)
[[ "$perms" == "440" ]] || add_error "Sudoers file has incorrect permissions: $perms (should be 440)"
sudo grep -q "NOPASSWD: /usr/bin/tzupdate, /usr/bin/timedatectl" /etc/sudoers.d/omarchy-tzupdate || add_error "Timezone sudoers rule not configured"
fi
}