1
0
mirror of https://github.com/rancher/os.git synced 2025-09-02 15:24:32 +00:00

Merge power funcs and fix build issues

This commit is contained in:
Darren Shepherd
2015-02-16 22:09:26 -07:00
parent d656da6a26
commit 76e5cf8d50
5 changed files with 14 additions and 19 deletions

View File

@@ -55,9 +55,6 @@ var (
"/sbin/modprobe": "/busybox", "/sbin/modprobe": "/busybox",
"/var/run": "/run", "/var/run": "/run",
DOCKER: "/docker", DOCKER: "/docker",
"/sbin/poweroff": "/init",
"/sbin/halt": "/init",
"/sbin/reboot": "/init",
} }
) )

View File

@@ -5,13 +5,12 @@ import (
"errors" "errors"
"os" "os"
"strconv" "strconv"
"syscall"
"strings" "strings"
"syscall"
"github.com/fsouza/go-dockerclient" "github.com/fsouza/go-dockerclient"
) )
const ( const (
dockerPath = "unix:///var/run/system-docker.sock" dockerPath = "unix:///var/run/system-docker.sock"
dockerCGroupsFile = "/proc/self/cgroup" dockerCGroupsFile = "/proc/self/cgroup"
@@ -116,7 +115,6 @@ func shutDownContainers() error {
return nil return nil
} }
func getCurrentContainerId() (string, error) { func getCurrentContainerId() (string, error) {
file, err := os.Open(dockerCGroupsFile) file, err := os.Open(dockerCGroupsFile)
@@ -131,7 +129,7 @@ func getCurrentContainerId() (string, error) {
line := fileReader.Text() line := fileReader.Text()
parts := strings.Split(line, "/") parts := strings.Split(line, "/")
while len(parts) != 3 { for len(parts) != 3 {
if !fileReader.Scan() { if !fileReader.Scan() {
return "", errors.New("Found no docker cgroups") return "", errors.New("Found no docker cgroups")
} }
@@ -148,4 +146,3 @@ func getCurrentContainerId() (string, error) {
return parts[len(parts)-1:][0], nil return parts[len(parts)-1:][0], nil
} }

View File

@@ -5,7 +5,7 @@ set -x
cd $(dirname $0)/.. cd $(dirname $0)/..
apt-get update apt-get update
apt-get install -y curl rsync build-essential syslinux xorriso libblkid-dev apt-get install -y curl rsync build-essential syslinux xorriso libblkid-dev libmount-dev libselinux1-dev
curl -sL https://github.com/ibuildthecloud/docker/releases/download/v1.5.0-rancher-2/docker-1.5.0 > /usr/bin/docker curl -sL https://github.com/ibuildthecloud/docker/releases/download/v1.5.0-rancher-2/docker-1.5.0 > /usr/bin/docker

View File

@@ -1,3 +1,4 @@
FROM base FROM base
RUN rm /sbin/poweroff /sbin/reboot /sbin/halt
COPY scripts/dockerimages/scripts/console.sh / COPY scripts/dockerimages/scripts/console.sh /
CMD ["/console.sh"] CMD ["/console.sh"]

View File

@@ -1,7 +1,7 @@
package util package util
/* /*
#cgo LDFLAGS: -lmount -lblkid -luuid #cgo LDFLAGS: -lmount -lblkid -luuid -lselinux
#include<blkid/blkid.h> #include<blkid/blkid.h>
#include<libmount/libmount.h> #include<libmount/libmount.h>
#include<stdlib.h> #include<stdlib.h>