mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
27 lines
552 B
Go
27 lines
552 B
Go
|
// +build linux
|
||
|
|
||
|
package mount
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"github.com/dotcloud/docker/pkg/libcontainer/console"
|
||
|
"os"
|
||
|
"path/filepath"
|
||
|
)
|
||
|
|
||
|
func SetupPtmx(rootfs, consolePath, mountLabel string) error {
|
||
|
ptmx := filepath.Join(rootfs, "dev/ptmx")
|
||
|
if err := os.Remove(ptmx); err != nil && !os.IsNotExist(err) {
|
||
|
return err
|
||
|
}
|
||
|
if err := os.Symlink("pts/ptmx", ptmx); err != nil {
|
||
|
return fmt.Errorf("symlink dev ptmx %s", err)
|
||
|
}
|
||
|
if consolePath != "" {
|
||
|
if err := console.Setup(rootfs, consolePath, mountLabel); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|