diff options
| author | Claude <noreply@anthropic.com> | 2026-08-05 23:22:25 -0500 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-08-05 23:22:25 -0500 |
| commit | fc0c6951d7ac36dd8f30ace929991197dc99ae54 (patch) | |
| tree | 46fa11cc103ebe7805bf42bc3e4bb105e6b49721 /internal/jailmgr | |
| parent | 9f7c9f2f31acd7bc544dd988af1c8c2fe63ec504 (diff) | |
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.
Diffstat (limited to 'internal/jailmgr')
| -rw-r--r-- | internal/jailmgr/jailmgr.go | 14 |
1 files changed, 3 insertions, 11 deletions
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/<app>.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 { |
