mirror of
https://github.com/rancher/os.git
synced 2025-08-02 07:24:28 +00:00
Use symlinks for power commands instead of bind mounts
This commit is contained in:
parent
67c7ba0fed
commit
9a34545aa9
@ -45,6 +45,8 @@ func entrypointAction(c *cli.Context) error {
|
||||
writeFiles(cfg)
|
||||
}
|
||||
|
||||
setupPowerOperations()
|
||||
|
||||
if len(os.Args) < 3 {
|
||||
return nil
|
||||
}
|
||||
@ -74,3 +76,29 @@ func writeFiles(cfg *config.CloudConfig) error {
|
||||
cloudinitexecute.WriteFiles(cfg, info.Name[1:])
|
||||
return nil
|
||||
}
|
||||
|
||||
func setupPowerOperations() {
|
||||
for _, powerOperation := range []string{
|
||||
"/sbin/poweroff",
|
||||
"/sbin/shutdown",
|
||||
"/sbin/reboot",
|
||||
"/sbin/halt",
|
||||
"/usr/sbin/poweroff",
|
||||
"/usr/sbin/shutdown",
|
||||
"/usr/sbin/reboot",
|
||||
"/usr/sbin/halt",
|
||||
} {
|
||||
os.Remove(powerOperation)
|
||||
}
|
||||
|
||||
for _, link := range []symlink{
|
||||
{config.ROS_BIN, "/sbin/poweroff"},
|
||||
{config.ROS_BIN, "/sbin/reboot"},
|
||||
{config.ROS_BIN, "/sbin/halt"},
|
||||
{config.ROS_BIN, "/sbin/shutdown"},
|
||||
} {
|
||||
if err := os.Symlink(link.oldname, link.newname); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,10 +130,6 @@ rancher:
|
||||
volumes:
|
||||
- /usr/bin/ros:/usr/bin/dockerlaunch:ro
|
||||
- /usr/bin/ros:/usr/bin/system-docker:ro
|
||||
- /usr/bin/ros:/sbin/poweroff:ro
|
||||
- /usr/bin/ros:/sbin/reboot:ro
|
||||
- /usr/bin/ros:/sbin/halt:ro
|
||||
- /usr/bin/ros:/sbin/shutdown:ro
|
||||
- /usr/bin/ros:/usr/bin/respawn:ro
|
||||
- /usr/bin/ros:/usr/bin/ros:ro
|
||||
- /usr/bin/ros:/usr/bin/cloud-init-execute:ro
|
||||
|
Loading…
Reference in New Issue
Block a user