1
0
mirror of https://github.com/rancher/os.git synced 2025-07-12 22:27:59 +00:00

cmd/power: Another shutdown command fix

It looks like some arguments for shutdown/halt/poweroff have been moved
to a conditional block that works off of how the command was actually
called. However, this value is derived from argv 0, without any sort of
normalization to make sure it matches the relative commands used to
determine how arguments are handled.

This has particular implications when power management commands are
called via absolute commands, as for example in the case of
open-vm-tools which calls /sbin/shutdown -h now specifically when
shutting down a system.

This corrects the situation by passing argv 0 through filepath.Base
before operating on it.
This commit is contained in:
Chris Marchesi 2018-03-06 14:00:27 -08:00
parent f6a76a10ae
commit 7d86fa5f8b
No known key found for this signature in database
GPG Key ID: 8D6F1589D9834498

View File

@ -27,7 +27,7 @@ func Shutdown() {
log.InitLogger()
app := cli.NewApp()
app.Name = os.Args[0]
app.Name = filepath.Base(os.Args[0])
app.Usage = fmt.Sprintf("%s RancherOS\nbuilt: %s", app.Name, config.BuildDate)
app.Version = config.Version
app.Author = "Rancher Labs, Inc."