fix: compare only basename of os.Args[0] in machined

This makes handling of `exec` more flexible.

Signed-off-by: Markus Reiter <me@reitermark.us>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Markus Reiter 2023-06-23 08:58:59 +02:00 committed by Andrey Smirnov
parent 53389b1e72
commit 7ce87f20c3
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD

View File

@ -13,6 +13,7 @@ import (
"net/http"
"os"
"os/signal"
"path/filepath"
"syscall"
"time"
@ -286,25 +287,25 @@ func run() error {
}
func main() {
switch os.Args[0] {
case "/apid":
switch filepath.Base(os.Args[0]) {
case "apid":
apid.Main()
return
case "/trustd":
case "trustd":
trustd.Main()
return
// Azure uses the hv_utils kernel module to shutdown the node in hyper-v by calling perform_shutdown which will call orderly_poweroff which will call /sbin/poweroff.
case "/sbin/poweroff":
case "poweroff":
poweroff.Main()
return
case "/sbin/wrapperd":
case "wrapperd":
wrapperd.Main()
return
case "/sbin/dashboard":
case "dashboard":
dashboard.Main()
return