[cmd/start] Compile cmdline args after possibly upgrading to new UI

This commit is contained in:
Daniel 2024-08-01 14:16:18 +02:00
parent 4fd1ddb399
commit a07b87fc20

View file

@ -154,7 +154,7 @@ func getExecArgs(opts *Options, cmdArgs []string) []string {
args = append(args, "--input-signals")
}
if runtime.GOOS == "linux" && opts.Identifier == "app/portmaster-app.zip" {
if runtime.GOOS == "linux" && opts.ShortIdentifier == "app" {
// see https://www.freedesktop.org/software/systemd/man/pam_systemd.html#type=
if xdgSessionType := os.Getenv("XDG_SESSION_TYPE"); xdgSessionType == "wayland" {
// we're running the Portmaster UI App under Wayland so make sure we add some arguments
@ -180,10 +180,6 @@ func run(opts *Options, cmdArgs []string) (err error) {
return nil
}
// get original arguments
// additional parameters can be specified using -- --some-parameter
args := getExecArgs(opts, cmdArgs)
// check for duplicate instances
if opts.PIDFile {
pid, err := checkAndCreateInstanceLock(opts.LockPathPrefix, opts.ShortIdentifier, opts.LockPerUser)
@ -226,7 +222,7 @@ func run(opts *Options, cmdArgs []string) (err error) {
}
}
return runAndRestart(opts, args)
return runAndRestart(opts, cmdArgs)
}
func runAndRestart(opts *Options, args []string) error {
@ -342,6 +338,10 @@ func execute(opts *Options, args []string) (cont bool, err error) {
opts = &app2Options
}
// Compile arguments and add additional arguments based on system configuration.
// Extra parameters can be specified using "-- --some-parameter".
args = getExecArgs(opts, args)
file, err := registry.GetFile(
helper.PlatformIdentifier(opts.Identifier),
)