mirror of
https://github.com/containers/podman.git
synced 2025-05-22 17:46:52 +08:00
libpod: Move platform-specific bind mounts to a per-platform method
This adds a new per-platform method makePlatformBindMounts and moves the /etc/hostname mount. This file is only needed on Linux. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
@ -1766,16 +1766,6 @@ func (c *Container) makeBindMounts() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make /etc/hostname
|
|
||||||
// This should never change, so no need to recreate if it exists
|
|
||||||
if _, ok := c.state.BindMounts["/etc/hostname"]; !ok {
|
|
||||||
hostnamePath, err := c.writeStringToRundir("hostname", c.Hostname())
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("creating hostname file for container %s: %w", c.ID(), err)
|
|
||||||
}
|
|
||||||
c.state.BindMounts["/etc/hostname"] = hostnamePath
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make /etc/localtime
|
// Make /etc/localtime
|
||||||
ctrTimezone := c.Timezone()
|
ctrTimezone := c.Timezone()
|
||||||
if ctrTimezone != "" {
|
if ctrTimezone != "" {
|
||||||
@ -1879,7 +1869,7 @@ rootless=%d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return c.makePlatformBindMounts()
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateResolvConf generates a containers resolv.conf
|
// generateResolvConf generates a containers resolv.conf
|
||||||
|
@ -283,3 +283,7 @@ func setVolumeAtime(mountPoint string, st os.FileInfo) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Container) makePlatformBindMounts() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -652,3 +652,16 @@ func setVolumeAtime(mountPoint string, st os.FileInfo) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Container) makePlatformBindMounts() error {
|
||||||
|
// Make /etc/hostname
|
||||||
|
// This should never change, so no need to recreate if it exists
|
||||||
|
if _, ok := c.state.BindMounts["/etc/hostname"]; !ok {
|
||||||
|
hostnamePath, err := c.writeStringToRundir("hostname", c.Hostname())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("creating hostname file for container %s: %w", c.ID(), err)
|
||||||
|
}
|
||||||
|
c.state.BindMounts["/etc/hostname"] = hostnamePath
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user