diff --git a/profiles/linux-dev/workstation-v0/doctor.sh b/profiles/linux-dev/workstation-v0/doctor.sh index f43f3d3..1a8b5a4 100644 --- a/profiles/linux-dev/workstation-v0/doctor.sh +++ b/profiles/linux-dev/workstation-v0/doctor.sh @@ -304,6 +304,58 @@ check_lampstand_unit(){ esac } +check_workstation_polish(){ + local helper + helper="$(cd "$(dirname "$0")" && pwd)/bin/check-workstation-polish.sh" + local out mac_helper keyboard_helper policy_ok backend_valid + + if [[ ! -f "$helper" ]]; then + warn "workstation polish helper missing: $helper" + record_result warn workstation-polish-helper "missing" + return + fi + + set +e + out="$(bash "$helper" 2>/dev/null)" + local rc=$? + set -e + + if [[ $rc -ne 0 ]]; then + warn "workstation polish helper failed (exit $rc)" + record_result warn workstation-polish "helper failed" + return + fi + + mac_helper="$(awk -F= '$1=="mac_polish.helper" {print $2}' <<<"$out" | tail -n1)" + keyboard_helper="$(awk -F= '$1=="keyboard_policy.helper" {print $2}' <<<"$out" | tail -n1)" + policy_ok="$(awk -F= '$1=="keyboard_policy.policy_ok" {print $2}' <<<"$out" | tail -n1)" + backend_valid="$(awk -F= '$1=="keyboard_policy.backend_valid" {print $2}' <<<"$out" | tail -n1)" + + if [[ "$mac_helper" == "present" ]]; then + info "ok: mac polish helper" + record_result ok workstation-polish:mac-helper "present" + else + warn "mac polish helper missing" + record_result warn workstation-polish:mac-helper "missing" + fi + + if [[ "$keyboard_helper" == "present" ]]; then + info "ok: keyboard policy helper" + record_result ok workstation-polish:keyboard-helper "present" + else + warn "keyboard policy helper missing" + record_result warn workstation-polish:keyboard-helper "missing" + fi + + if [[ "$policy_ok" == "yes" ]]; then + info "ok: keyboard policy" + record_result ok workstation-polish:keyboard-policy "valid" + else + warn "keyboard policy not valid (backend_valid=${backend_valid:-unknown})" + record_result warn workstation-polish:keyboard-policy "not valid" + fi +} + check_gsettings_equals(){ local schema=$1 local key=$2 @@ -398,6 +450,7 @@ main(){ check rsync check_lampstand_lane check_lampstand_unit + check_workstation_polish if gnome_detect; then record_result info gnome "detected"