From 38d4ee09ae9fee145de632cc70426df1aaf80bf6 Mon Sep 17 00:00:00 2001 From: Mitchell-Johnson Date: Thu, 17 Sep 2026 22:53:32 -0700 Subject: [PATCH] storage: re-probe smartctl lazily so an install from the Disks tab works without a restart Co-Authored-By: Claude Fable 5.1 --- internal/storage/storage.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/storage/storage.go b/internal/storage/storage.go index 5748781..3ccb6b6 100644 --- a/internal/storage/storage.go +++ b/internal/storage/storage.go @@ -220,7 +220,14 @@ func New(sudo bool) *Manager { return &Manager{sudo: sudo, smartctl: ok, cache: map[string]Smart{}} } -func (m *Manager) HasSmartctl() bool { return m.smartctl } +// HasSmartctl re-probes when it was missing at startup, so an install from the Disks +// tab takes effect without a daemon restart. +func (m *Manager) HasSmartctl() bool { + if !m.smartctl { + _, m.smartctl = lookPath("smartctl") + } + return m.smartctl +} func (m *Manager) run(ctx context.Context, args ...string) ([]byte, int, error) { if p, ok := lookPath(args[0]); ok { @@ -273,7 +280,7 @@ func (m *Manager) Smart(ctx context.Context, dev string, force bool) Smart { s.Error = "unknown device" return s } - if !m.smartctl { + if !m.HasSmartctl() { return s } m.mu.Lock()