diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-10-18 22:25:09 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-10-18 22:25:09 +0900 |
| commit | 55bb348d5f49b3089b3475e20ee04a81f676e803 (patch) | |
| tree | 801e30cc5124b38004db67c6e826c37d095a31e7 /internal/app/seal.go | |
| parent | ecce832d9360c42afcc81d5d7de53194bac48684 (diff) | |
state: store launch method instead of launcher path
Launcher path is constant for each launch method on the same system.
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/app/seal.go')
| -rw-r--r-- | internal/app/seal.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/app/seal.go b/internal/app/seal.go index f8031b71..9fd6dfb8 100644 --- a/internal/app/seal.go +++ b/internal/app/seal.go @@ -21,6 +21,11 @@ const ( LaunchMethodMachineCtl ) +var method = [...]string{ + LaunchMethodSudo: "sudo", + LaunchMethodMachineCtl: "systemd", +} + var ( ErrConfig = errors.New("no configuration to seal") ErrUser = errors.New("unknown user") @@ -65,7 +70,7 @@ func (a *app) Seal(config *Config) error { // parses launch method text and looks up tool path switch config.Method { - case "sudo": + case method[LaunchMethodSudo]: seal.launchOption = LaunchMethodSudo if sudoPath, err := exec.LookPath("sudo"); err != nil { return fmsg.WrapError(ErrSudo, @@ -73,7 +78,7 @@ func (a *app) Seal(config *Config) error { } else { seal.toolPath = sudoPath } - case "systemd": + case method[LaunchMethodMachineCtl]: seal.launchOption = LaunchMethodMachineCtl if !internal.SdBootedV { return fmsg.WrapError(ErrSystemd, |
