Skip to content

Commit a63a07c

Browse files
Copilotmdheller
andauthored
feat: add workstation mac-defaults validation check
Agent-Logs-Url: https://github.com/SociOS-Linux/source-os/sessions/52f10c6b-b344-4a8e-9983-cb41148666b9 Co-authored-by: mdheller <21163552+mdheller@users.noreply.github.com>
1 parent da2a581 commit a63a07c

3 files changed

Lines changed: 157 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: workstation-mac-defaults-validation
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'profiles/linux-dev/workstation-v0/bin/check-mac-defaults.sh'
7+
- 'profiles/linux-dev/workstation-v0/gnome/mac-defaults.sh'
8+
- 'profiles/linux-dev/workstation-v0/gnome/README.md'
9+
- '.github/workflows/workstation-mac-defaults-validation.yml'
10+
push:
11+
branches:
12+
- main
13+
paths:
14+
- 'profiles/linux-dev/workstation-v0/bin/check-mac-defaults.sh'
15+
- 'profiles/linux-dev/workstation-v0/gnome/mac-defaults.sh'
16+
- 'profiles/linux-dev/workstation-v0/gnome/README.md'
17+
- '.github/workflows/workstation-mac-defaults-validation.yml'
18+
19+
jobs:
20+
mac-defaults-smoke:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Syntax check mac-defaults scripts
29+
run: |
30+
set -euo pipefail
31+
bash -n profiles/linux-dev/workstation-v0/gnome/mac-defaults.sh
32+
bash -n profiles/linux-dev/workstation-v0/bin/check-mac-defaults.sh
33+
34+
- name: "Smoke: helper emits required keys"
35+
run: |
36+
set -euo pipefail
37+
helper='profiles/linux-dev/workstation-v0/bin/check-mac-defaults.sh'
38+
out=$(bash "$helper")
39+
grep -F 'mac_defaults_script=present' <<<"$out" >/dev/null
40+
grep -F 'hot_corners_disabled=' <<<"$out" >/dev/null
41+
grep -F 'clock_format_12h=' <<<"$out" >/dev/null
42+
grep -F 'locate_pointer_enabled=' <<<"$out" >/dev/null
43+
grep -F 'nautilus_double_click=' <<<"$out" >/dev/null
44+
grep -F 'dock_favorites_seed=' <<<"$out" >/dev/null
45+
grep -F 'files_binding_super_e=' <<<"$out" >/dev/null
46+
grep -F 'terminal_binding_super_ret=' <<<"$out" >/dev/null
47+
grep -F 'screenshot_binding_3=' <<<"$out" >/dev/null
48+
grep -F 'screenshot_binding_4=' <<<"$out" >/dev/null
49+
grep -F 'screenshot_binding_5=' <<<"$out" >/dev/null
50+
grep -F 'screenshot_binding_6=' <<<"$out" >/dev/null
51+
grep -F 'mac_defaults_ok=' <<<"$out" >/dev/null
52+
53+
- name: "Smoke: helper detects all required settings as present"
54+
run: |
55+
set -euo pipefail
56+
helper='profiles/linux-dev/workstation-v0/bin/check-mac-defaults.sh'
57+
out=$(bash "$helper")
58+
grep -F 'hot_corners_disabled=present' <<<"$out" >/dev/null
59+
grep -F 'clock_format_12h=present' <<<"$out" >/dev/null
60+
grep -F 'locate_pointer_enabled=present' <<<"$out" >/dev/null
61+
grep -F 'nautilus_double_click=present' <<<"$out" >/dev/null
62+
grep -F 'dock_favorites_seed=present' <<<"$out" >/dev/null
63+
grep -F 'files_binding_super_e=present' <<<"$out" >/dev/null
64+
grep -F 'terminal_binding_super_ret=present' <<<"$out" >/dev/null
65+
grep -F 'screenshot_binding_3=present' <<<"$out" >/dev/null
66+
grep -F 'screenshot_binding_4=present' <<<"$out" >/dev/null
67+
grep -F 'screenshot_binding_5=present' <<<"$out" >/dev/null
68+
grep -F 'screenshot_binding_6=present' <<<"$out" >/dev/null
69+
grep -F 'mac_defaults_ok=yes' <<<"$out" >/dev/null
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Validate the workstation-v0 mac-like GNOME defaults pack.
5+
# Inspects mac-defaults.sh for required settings without running GNOME.
6+
# Emits key=value lines for CI, status, and doctor integration.
7+
# This helper is read-only: it does not modify any settings.
8+
9+
profile_dir(){
10+
cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd
11+
}
12+
13+
check_script(){
14+
local key=$1
15+
local pattern=$2
16+
local file=$3
17+
if grep -qF "$pattern" "$file" 2>/dev/null; then
18+
printf '%s=present\n' "$key"
19+
else
20+
printf '%s=missing\n' "$key"
21+
fi
22+
}
23+
24+
main(){
25+
local pdir script overall_ok
26+
pdir="$(profile_dir)"
27+
script="$pdir/gnome/mac-defaults.sh"
28+
overall_ok=no
29+
30+
if [[ -f "$script" ]]; then
31+
printf 'mac_defaults_script=present\n'
32+
else
33+
printf 'mac_defaults_script=missing\n'
34+
printf 'mac_defaults_ok=no\n'
35+
return
36+
fi
37+
38+
check_script hot_corners_disabled "enable-hot-corners false" "$script"
39+
check_script clock_format_12h "clock-format '12h'" "$script"
40+
check_script locate_pointer_enabled "locate-pointer true" "$script"
41+
check_script nautilus_double_click "click-policy 'double'" "$script"
42+
check_script dock_favorites_seed "favorite-apps" "$script"
43+
check_script files_binding_super_e 'set_custom_binding custom1 "SourceOS Files"' "$script"
44+
check_script terminal_binding_super_ret 'set_custom_binding custom2 "SourceOS Terminal"' "$script"
45+
check_script screenshot_binding_3 'set_custom_binding custom3' "$script"
46+
check_script screenshot_binding_4 'set_custom_binding custom4' "$script"
47+
check_script screenshot_binding_5 'set_custom_binding custom5' "$script"
48+
check_script screenshot_binding_6 'set_custom_binding custom6' "$script"
49+
50+
if grep -qF "enable-hot-corners false" "$script" &&
51+
grep -qF "clock-format '12h'" "$script" &&
52+
grep -qF "locate-pointer true" "$script" &&
53+
grep -qF "click-policy 'double'" "$script" &&
54+
grep -qF "favorite-apps" "$script" &&
55+
grep -qF 'set_custom_binding custom1 "SourceOS Files"' "$script" &&
56+
grep -qF 'set_custom_binding custom2 "SourceOS Terminal"' "$script"; then
57+
overall_ok=yes
58+
fi
59+
printf 'mac_defaults_ok=%s\n' "$overall_ok"
60+
}
61+
62+
main "$@"

profiles/linux-dev/workstation-v0/gnome/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,32 @@ The workstation keeps keyboard remapping explicit and policy-gated:
5959
- Kinto remains an explicit compatibility lane for X11/xkeysnail-style workflows and is not auto-installed in the Wayland-first profile.
6060
- `check-keyboard-policy.sh` emits key=value status for CI and future doctor/status integration.
6161

62+
## Mac-defaults validation
63+
64+
The mac-like GNOME defaults pack can be inspected without changing system state:
65+
66+
```bash
67+
./profiles/linux-dev/workstation-v0/bin/check-mac-defaults.sh
68+
```
69+
70+
The helper emits key=value output for:
71+
72+
- `mac_defaults_script`
73+
- `hot_corners_disabled`
74+
- `clock_format_12h`
75+
- `locate_pointer_enabled`
76+
- `nautilus_double_click`
77+
- `dock_favorites_seed`
78+
- `files_binding_super_e`
79+
- `terminal_binding_super_ret`
80+
- `screenshot_binding_3`, `screenshot_binding_4`, `screenshot_binding_5`, `screenshot_binding_6`
81+
- `mac_defaults_ok`
82+
83+
It is read-only and does not require a GNOME session. It verifies that
84+
`mac-defaults.sh` records the intended desktop behavior slice by inspecting
85+
the script source. The check is wired into the
86+
`workstation-mac-defaults-validation` CI workflow.
87+
6288
## Dock/extension validation
6389

6490
The dock and extension lane can be inspected without changing system state:

0 commit comments

Comments
 (0)