mirror of
https://github.com/rancher/os.git
synced 2025-09-01 06:40:31 +00:00
Merge power funcs and fix build issues
This commit is contained in:
@@ -55,9 +55,6 @@ var (
|
||||
"/sbin/modprobe": "/busybox",
|
||||
"/var/run": "/run",
|
||||
DOCKER: "/docker",
|
||||
"/sbin/poweroff": "/init",
|
||||
"/sbin/halt": "/init",
|
||||
"/sbin/reboot": "/init",
|
||||
}
|
||||
)
|
||||
|
||||
|
@@ -5,13 +5,12 @@ import (
|
||||
"errors"
|
||||
"os"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/fsouza/go-dockerclient"
|
||||
)
|
||||
|
||||
|
||||
const (
|
||||
dockerPath = "unix:///var/run/system-docker.sock"
|
||||
dockerCGroupsFile = "/proc/self/cgroup"
|
||||
@@ -93,7 +92,7 @@ func shutDownContainers() error {
|
||||
}
|
||||
stopErr := client.StopContainer(containers[i].ID, timeout)
|
||||
if stopErr != nil {
|
||||
stopErrorStrings = append(stopErrorStrings, " [" + containers[i].ID + "] " +stopErr.Error())
|
||||
stopErrorStrings = append(stopErrorStrings, " ["+containers[i].ID+"] "+stopErr.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +104,7 @@ func shutDownContainers() error {
|
||||
}
|
||||
_, waitErr := client.WaitContainer(containers[i].ID)
|
||||
if waitErr != nil {
|
||||
waitErrorStrings = append(waitErrorStrings, " [" + containers[i].ID + "] " + waitErr.Error())
|
||||
waitErrorStrings = append(waitErrorStrings, " ["+containers[i].ID+"] "+waitErr.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +115,6 @@ func shutDownContainers() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
func getCurrentContainerId() (string, error) {
|
||||
file, err := os.Open(dockerCGroupsFile)
|
||||
|
||||
@@ -131,7 +129,7 @@ func getCurrentContainerId() (string, error) {
|
||||
line := fileReader.Text()
|
||||
parts := strings.Split(line, "/")
|
||||
|
||||
while len(parts) != 3 {
|
||||
for len(parts) != 3 {
|
||||
if !fileReader.Scan() {
|
||||
return "", errors.New("Found no docker cgroups")
|
||||
}
|
||||
@@ -148,4 +146,3 @@ func getCurrentContainerId() (string, error) {
|
||||
|
||||
return parts[len(parts)-1:][0], nil
|
||||
}
|
||||
|
||||
|
@@ -5,7 +5,7 @@ set -x
|
||||
cd $(dirname $0)/..
|
||||
|
||||
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
|
||||
|
@@ -1,3 +1,4 @@
|
||||
FROM base
|
||||
RUN rm /sbin/poweroff /sbin/reboot /sbin/halt
|
||||
COPY scripts/dockerimages/scripts/console.sh /
|
||||
CMD ["/console.sh"]
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package util
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lmount -lblkid -luuid
|
||||
#cgo LDFLAGS: -lmount -lblkid -luuid -lselinux
|
||||
#include<blkid/blkid.h>
|
||||
#include<libmount/libmount.h>
|
||||
#include<stdlib.h>
|
||||
@@ -22,7 +22,7 @@ func ResolveDevice(spec string) string {
|
||||
}
|
||||
|
||||
func GetFsType(device string) (string, error) {
|
||||
var ambi * C.int
|
||||
var ambi *C.int
|
||||
cDevice := C.CString(device)
|
||||
defer C.free(unsafe.Pointer(cDevice))
|
||||
cString := C.mnt_get_fstype(cDevice, ambi, nil)
|
||||
|
Reference in New Issue
Block a user