shim: get rid of insane launch condition
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
parent
e4536b87ad
commit
b470941911
|
@ -57,8 +57,8 @@ func (a *app) commandBuilderMachineCtl(shimEnv string) (args []string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// both license and version flags need to be set to activate shim path
|
// launch fortify as shim
|
||||||
innerCommand.WriteString("exec " + a.seal.sys.executable + " -V -license")
|
innerCommand.WriteString("exec " + a.seal.sys.executable + " shim")
|
||||||
|
|
||||||
// append inner command
|
// append inner command
|
||||||
args = append(args, innerCommand.String())
|
args = append(args, innerCommand.String())
|
||||||
|
|
|
@ -26,7 +26,7 @@ func (a *app) commandBuilderSudo(shimEnv string) (args []string) {
|
||||||
args = append(args, shimEnv)
|
args = append(args, shimEnv)
|
||||||
|
|
||||||
// -- $@
|
// -- $@
|
||||||
args = append(args, "--", a.seal.sys.executable, "-V", "--license") // magic for shim.Try()
|
args = append(args, "--", a.seal.sys.executable, "shim")
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package shim
|
||||||
import (
|
import (
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
"errors"
|
"errors"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
@ -148,3 +149,13 @@ func receiveWLfd(conn *net.UnixConn) (int, error) {
|
||||||
return fds[0], nil
|
return fds[0], nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try runs shim and stops execution if FORTIFY_SHIM is set.
|
||||||
|
func Try() {
|
||||||
|
if args := flag.Args(); len(args) == 1 && args[0] == "shim" {
|
||||||
|
if s, ok := os.LookupEnv(EnvShim); ok {
|
||||||
|
shim(s)
|
||||||
|
panic("unreachable")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -80,11 +80,3 @@ func ServeConfig(socket string, payload *Payload, wl string, done chan struct{})
|
||||||
return ws, nil
|
return ws, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try runs shim and stops execution if FORTIFY_SHIM is set.
|
|
||||||
func Try() {
|
|
||||||
if s, ok := os.LookupEnv(EnvShim); ok {
|
|
||||||
shim(s)
|
|
||||||
}
|
|
||||||
panic("unreachable")
|
|
||||||
}
|
|
||||||
|
|
4
main.go
4
main.go
|
@ -35,10 +35,8 @@ func main() {
|
||||||
verbose.Println("system booted with systemd as init system")
|
verbose.Println("system booted with systemd as init system")
|
||||||
}
|
}
|
||||||
|
|
||||||
// launcher payload early exit
|
// shim early exit
|
||||||
if printVersion && printLicense {
|
|
||||||
shim.Try()
|
shim.Try()
|
||||||
}
|
|
||||||
|
|
||||||
// version/license/template command early exit
|
// version/license/template command early exit
|
||||||
tryVersion()
|
tryVersion()
|
||||||
|
|
Loading…
Reference in New Issue