Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions profiles/linux-dev/workstation-v0/bin/sourceos
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,29 @@ status_check_lampstand(){
WARNINGS+=("lampstand backend unavailable")
}

status_check_lampstand_unit(){
local helper="$PROFILE_DIR/bin/check-lampstand-unit.sh"
local out unit_file enabled active

if [[ ! -f "$helper" ]]; then
WARNINGS+=("missing lampstand unit helper: $helper")
return
fi

if ! out="$(bash "$helper" 2>/dev/null)"; then
WARNINGS+=("lampstand unit helper failed")
return
fi

unit_file="$(awk -F= '$1=="unit_file" {print $2}' <<<"$out" | tail -n1)"
enabled="$(awk -F= '$1=="enabled" {print $2}' <<<"$out" | tail -n1)"
active="$(awk -F= '$1=="active" {print $2}' <<<"$out" | tail -n1)"

[[ "$unit_file" == "present" ]] || WARNINGS+=("lampstand user unit file missing")
[[ "$enabled" == "yes" || "$enabled" == "unknown" ]] || WARNINGS+=("lampstand user unit not enabled")
[[ "$active" == "yes" || "$active" == "unknown" ]] || WARNINGS+=("lampstand user unit not active")
}

status_collect(){
REQUIRED_MISSING=()
OPTIONAL_MISSING=()
Expand All @@ -331,6 +354,7 @@ status_collect(){
fi

status_check_lampstand
status_check_lampstand_unit

if gnome_detect; then
if ! check_bin gsettings; then
Expand Down
60 changes: 60 additions & 0 deletions profiles/linux-dev/workstation-v0/doctor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,65 @@ check_lampstand_lane(){
record_result warn lampstand "missing backend"
}

check_lampstand_unit(){
local helper="$(cd "$(dirname "$0")" && pwd)/bin/check-lampstand-unit.sh"
local out unit_file enabled active

if [[ ! -f "$helper" ]]; then
warn "Lampstand unit helper missing: $helper"
record_result warn lampstand-unit-helper "missing"
return
fi

if ! out="$(bash "$helper" 2>/dev/null)"; then
warn "Lampstand unit helper failed"
record_result warn lampstand-unit "helper failed"
return
fi

unit_file="$(awk -F= '$1=="unit_file" {print $2}' <<<"$out" | tail -n1)"
enabled="$(awk -F= '$1=="enabled" {print $2}' <<<"$out" | tail -n1)"
active="$(awk -F= '$1=="active" {print $2}' <<<"$out" | tail -n1)"

if [[ "$unit_file" == "present" ]]; then
info "ok: Lampstand user unit file"
record_result ok lampstand-unit-file "present"
else
warn "Lampstand user unit file missing"
record_result warn lampstand-unit-file "missing"
fi

case "$enabled" in
yes)
info "ok: Lampstand user unit enabled"
record_result ok lampstand-unit-enabled "yes"
;;
no)
warn "Lampstand user unit not enabled"
record_result warn lampstand-unit-enabled "no"
;;
*)
info "Lampstand user unit enabled state unknown"
record_result info lampstand-unit-enabled "unknown"
;;
esac

case "$active" in
yes)
info "ok: Lampstand user unit active"
record_result ok lampstand-unit-active "yes"
;;
no)
warn "Lampstand user unit not active"
record_result warn lampstand-unit-active "no"
;;
*)
info "Lampstand user unit active state unknown"
record_result info lampstand-unit-active "unknown"
;;
esac
}

check_gsettings_equals(){
local schema=$1
local key=$2
Expand Down Expand Up @@ -338,6 +397,7 @@ main(){
check mc
check rsync
check_lampstand_lane
check_lampstand_unit

if gnome_detect; then
record_result info gnome "detected"
Expand Down