From fc0c6951d7ac36dd8f30ace929991197dc99ae54 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 5 Aug 2026 23:22:25 -0500 Subject: Simplify: centralize paths in layout, dedup zfs snapshot refs, remove dead code - Add layout.Config methods (ReleasesDir, PostReceiveHookPath, RCScriptPath, RCConfPath) so main.go and jailmgr no longer hand-build paths that layout already owns. - Extract zfsutil.snapRef to replace three inline dataset@tag Sprintfs. - Remove seven unused exported functions (zfsutil.Exists, jailmgr.Stop, sh.RunWithStdinFile, and four dead layout.Config path methods) and their now-unused imports. --- internal/jailmgr/jailmgr.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'internal/jailmgr') diff --git a/internal/jailmgr/jailmgr.go b/internal/jailmgr/jailmgr.go index 54cf614..b6a5d28 100644 --- a/internal/jailmgr/jailmgr.go +++ b/internal/jailmgr/jailmgr.go @@ -17,11 +17,7 @@ import ( // WriteConf renders jail.conf.d/.conf and the jail's own rc.d service // script + rc.conf enable line. Called once, from `skiff new-app`. func WriteConf(cfg layout.Config, app, ip string) error { - conf, err := tmpl.JailConf(tmpl.JailConfData{ - Name: app, - JailRoot: cfg.JailRoot(app), - IP: ip, - }) + conf, err := tmpl.JailConf(tmpl.JailConfData{Name: app, JailRoot: cfg.JailRoot(app), IP: ip}) if err != nil { return err } @@ -33,7 +29,7 @@ func WriteConf(cfg layout.Config, app, ip string) error { if err != nil { return err } - rcPath := filepath.Join(cfg.JailRoot(app), "usr", "local", "etc", "rc.d", app) + rcPath := cfg.RCScriptPath(app) if err := os.MkdirAll(filepath.Dir(rcPath), 0755); err != nil { return err } @@ -42,7 +38,7 @@ func WriteConf(cfg layout.Config, app, ip string) error { } rcConfLine := fmt.Sprintf("\n%s_enable=\"YES\"\n", app) - f, err := os.OpenFile(filepath.Join(cfg.JailRoot(app), "etc", "rc.conf"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + f, err := os.OpenFile(cfg.RCConfPath(app), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { return fmt.Errorf("open jail rc.conf: %w", err) } @@ -57,10 +53,6 @@ func Start(ctx context.Context, out io.Writer, app string) error { return sh.Run(ctx, out, "", "service", "jail", "start", app) } -func Stop(ctx context.Context, out io.Writer, app string) error { - return sh.Run(ctx, out, "", "service", "jail", "stop", app) -} - // Restart restarts an already-running jail, or starts it if this is its // first deploy and it isn't up yet. func Restart(ctx context.Context, out io.Writer, app string) error { -- cgit v1.3