1
0
mirror of https://github.com/rancher/os.git synced 2025-06-28 15:56:58 +00:00

Add friendly tips on ros config syslinux

This commit is contained in:
Jason-ZW 2018-10-09 10:03:51 +08:00 committed by niusmallnan
parent 90e88cf2b4
commit 4cb09e2ac6

View File

@ -1,6 +1,7 @@
package control package control
import ( import (
"bufio"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
@ -14,6 +15,7 @@ import (
"github.com/rancher/os/pkg/log" "github.com/rancher/os/pkg/log"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/pkg/errors"
"github.com/rancher/os/config" "github.com/rancher/os/config"
"github.com/rancher/os/pkg/util" "github.com/rancher/os/pkg/util"
) )
@ -153,6 +155,22 @@ func env2map(env []string) map[string]string {
} }
func editSyslinux(c *cli.Context) error { func editSyslinux(c *cli.Context) error {
// check whether is Raspberry Pi or not
bytes, err := ioutil.ReadFile("/proc/device-tree/model")
if err == nil && strings.Contains(strings.ToLower(string(bytes)), "raspberry") {
buf := bufio.NewWriter(os.Stdout)
fmt.Fprintln(buf, "raspberry pi can not use this command")
buf.Flush()
return errors.New("raspberry pi can not use this command")
}
if _, err := os.Stat("/proc/1/root/boot/global.cfg"); os.IsNotExist(err) {
buf := bufio.NewWriter(os.Stdout)
fmt.Fprintln(buf, "global.cfg can not be found")
buf.Flush()
return errors.New("global.cfg can not be found")
}
cmd := exec.Command("system-docker", "run", "--rm", "-it", cmd := exec.Command("system-docker", "run", "--rm", "-it",
"-v", "/:/host", "-v", "/:/host",
"-w", "/host", "-w", "/host",