1
0
mirror of https://github.com/rancher/os.git synced 2025-06-27 07:16:48 +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
import (
"bufio"
"fmt"
"io"
"io/ioutil"
@ -14,6 +15,7 @@ import (
"github.com/rancher/os/pkg/log"
"github.com/codegangsta/cli"
"github.com/pkg/errors"
"github.com/rancher/os/config"
"github.com/rancher/os/pkg/util"
)
@ -153,6 +155,22 @@ func env2map(env []string) map[string]string {
}
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",
"-v", "/:/host",
"-w", "/host",