@@ -61,16 +61,20 @@ func commandDaemonInstall(c *cli.Context) error {
6161 color .Green .Printf ("✅ Found daemon binary at: %s\n " , daemonBinPath )
6262 }
6363
64- // If we picked a system-managed binary but a stale curl-installer copy
65- // still lives under ~/.shelltime/bin, remove it so future resolution
66- // stays unambiguous.
64+ // If we picked a system-managed binary but a curl-installer copy still
65+ // lives under ~/.shelltime/bin, rename it to shelltime-daemon.bak rather
66+ // than delete it. Future resolution stays unambiguous AND the .bak
67+ // recovery branch above can restore it on the next `daemon install` —
68+ // no GitHub re-download when the user later clears the system binary.
6769 curlDaemonPath := model .GetCurlInstallerDaemonPath ()
6870 if daemonBinPath != curlDaemonPath {
6971 if info , statErr := os .Stat (curlDaemonPath ); statErr == nil && ! info .IsDir () {
70- if rmErr := os .Remove (curlDaemonPath ); rmErr == nil {
71- color .Yellow .Printf ("🧹 Removed stale curl-installer daemon at %s\n " , curlDaemonPath )
72+ preservedPath := curlDaemonPath + ".bak"
73+ _ = os .Remove (preservedPath )
74+ if rnErr := os .Rename (curlDaemonPath , preservedPath ); rnErr == nil {
75+ color .Yellow .Printf ("📦 Preserved curl-installer daemon as %s (auto-restores on next `daemon install`).\n " , preservedPath )
7276 } else {
73- color .Yellow .Printf ("⚠️ Could not remove stale daemon at %s: %v\n " , curlDaemonPath , rmErr )
77+ color .Yellow .Printf ("⚠️ Could not preserve curl-installer daemon at %s: %v\n " , curlDaemonPath , rnErr )
7478 }
7579 }
7680 }
0 commit comments