mirror of
https://github.com/rancher/os.git
synced 2025-06-28 15:56:58 +00:00
Merge pull request #1308 from SvenDowideit/move-os-release-file
Move the os-release file to /usr/lib and softlink
This commit is contained in:
commit
aa781b4a51
@ -75,10 +75,6 @@ func consoleInitAction(c *cli.Context) error {
|
|||||||
log.Error(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := writeOsRelease(); err != nil {
|
|
||||||
log.Error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, link := range []symlink{
|
for _, link := range []symlink{
|
||||||
{"/var/lib/rancher/engine/docker", "/usr/bin/docker"},
|
{"/var/lib/rancher/engine/docker", "/usr/bin/docker"},
|
||||||
{"/var/lib/rancher/engine/docker-containerd", "/usr/bin/docker-containerd"},
|
{"/var/lib/rancher/engine/docker-containerd", "/usr/bin/docker-containerd"},
|
||||||
@ -87,6 +83,8 @@ func consoleInitAction(c *cli.Context) error {
|
|||||||
{"/var/lib/rancher/engine/dockerd", "/usr/bin/dockerd"},
|
{"/var/lib/rancher/engine/dockerd", "/usr/bin/dockerd"},
|
||||||
{"/var/lib/rancher/engine/docker-proxy", "/usr/bin/docker-proxy"},
|
{"/var/lib/rancher/engine/docker-proxy", "/usr/bin/docker-proxy"},
|
||||||
{"/var/lib/rancher/engine/docker-runc", "/usr/bin/docker-runc"},
|
{"/var/lib/rancher/engine/docker-runc", "/usr/bin/docker-runc"},
|
||||||
|
{"/usr/share/rancher/os-release", "/usr/lib/os-release"},
|
||||||
|
{"/usr/share/rancher/os-release", "/etc/os-release"},
|
||||||
} {
|
} {
|
||||||
syscall.Unlink(link.newname)
|
syscall.Unlink(link.newname)
|
||||||
if err := os.Symlink(link.oldname, link.newname); err != nil {
|
if err := os.Symlink(link.oldname, link.newname); err != nil {
|
||||||
@ -212,33 +210,6 @@ func modifySshdConfig() error {
|
|||||||
return ioutil.WriteFile("/etc/ssh/sshd_config", []byte(sshdConfigString), 0644)
|
return ioutil.WriteFile("/etc/ssh/sshd_config", []byte(sshdConfigString), 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeOsRelease() error {
|
|
||||||
idLike := "busybox"
|
|
||||||
if osRelease, err := ioutil.ReadFile("/etc/os-release"); err == nil {
|
|
||||||
for _, line := range strings.Split(string(osRelease), "\n") {
|
|
||||||
if strings.HasPrefix(line, "ID_LIKE") {
|
|
||||||
split := strings.Split(line, "ID_LIKE")
|
|
||||||
if len(split) > 1 {
|
|
||||||
idLike = split[1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ioutil.WriteFile("/etc/os-release", []byte(fmt.Sprintf(`
|
|
||||||
NAME="RancherOS"
|
|
||||||
VERSION=%s
|
|
||||||
ID=rancheros
|
|
||||||
ID_LIKE=%s
|
|
||||||
VERSION_ID=%s
|
|
||||||
PRETTY_NAME="RancherOS %s"
|
|
||||||
HOME_URL=
|
|
||||||
SUPPORT_URL=
|
|
||||||
BUG_REPORT_URL=
|
|
||||||
BUILD_ID=
|
|
||||||
`, config.VERSION, idLike, config.VERSION, config.VERSION)), 0644)
|
|
||||||
}
|
|
||||||
|
|
||||||
func setupSSH(cfg *config.CloudConfig) error {
|
func setupSSH(cfg *config.CloudConfig) error {
|
||||||
for _, keyType := range []string{"rsa", "dsa", "ecdsa", "ed25519"} {
|
for _, keyType := range []string{"rsa", "dsa", "ecdsa", "ed25519"} {
|
||||||
outputFile := fmt.Sprintf("/etc/ssh/ssh_host_%s_key", keyType)
|
outputFile := fmt.Sprintf("/etc/ssh/ssh_host_%s_key", keyType)
|
||||||
|
@ -140,6 +140,7 @@ rancher:
|
|||||||
- /usr/bin/ros:/usr/bin/cloud-init-save:ro
|
- /usr/bin/ros:/usr/bin/cloud-init-save:ro
|
||||||
- /usr/bin/ros:/usr/sbin/netconf:ro
|
- /usr/bin/ros:/usr/sbin/netconf:ro
|
||||||
- /usr/bin/ros:/usr/sbin/wait-for-docker:ro
|
- /usr/bin/ros:/usr/sbin/wait-for-docker:ro
|
||||||
|
- /usr/share/rancher:/usr/share/rancher:ro
|
||||||
console:
|
console:
|
||||||
image: {{.OS_REPO}}/os-console:{{.VERSION}}{{.SUFFIX}}
|
image: {{.OS_REPO}}/os-console:{{.VERSION}}{{.SUFFIX}}
|
||||||
command: ros console-init
|
command: ros console-init
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd $(dirname $0)/..
|
cd $(dirname $0)/..
|
||||||
rm -rf build dist bin images/*/build
|
rm -rf build dist bin images/*/build state
|
||||||
|
@ -22,6 +22,25 @@ if [ "$(docker info | grep 'Storage Driver: ' | sed 's/Storage Driver: //')" !=
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${INITRD_DIR}/usr/share/rancher/
|
||||||
|
cat <<HERE > ${INITRD_DIR}/usr/share/rancher/os-release
|
||||||
|
NAME="RancherOS"
|
||||||
|
VERSION=${VERSION}
|
||||||
|
ID=rancheros
|
||||||
|
ID_LIKE=
|
||||||
|
VERSION_ID=${VERSION}
|
||||||
|
PRETTY_NAME="RancherOS ${VERSION}"
|
||||||
|
HOME_URL="http://rancher.com/rancher-os/"
|
||||||
|
SUPPORT_URL="https://forums.rancher.com/c/rancher-os"
|
||||||
|
BUG_REPORT_URL="https://github.com/rancher/os/issues"
|
||||||
|
BUILD_ID=
|
||||||
|
HERE
|
||||||
|
|
||||||
|
# need to make relative links to the os-release file
|
||||||
|
cd ${INITRD_DIR}/usr/lib
|
||||||
|
ln -s ../share/rancher/os-release os-release
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
DFS=$(docker run -d --privileged -v /lib/modules/$(uname -r):/lib/modules/$(uname -r) ${DFS_IMAGE}${SUFFIX} ${DFS_ARGS})
|
DFS=$(docker run -d --privileged -v /lib/modules/$(uname -r):/lib/modules/$(uname -r) ${DFS_IMAGE}${SUFFIX} ${DFS_ARGS})
|
||||||
trap "docker rm -fv ${DFS_ARCH} ${DFS}" EXIT
|
trap "docker rm -fv ${DFS_ARCH} ${DFS}" EXIT
|
||||||
docker exec -i ${DFS} docker load < ${INITRD_DIR}/usr/share/ros/images.tar
|
docker exec -i ${DFS} docker load < ${INITRD_DIR}/usr/share/ros/images.tar
|
||||||
|
Loading…
Reference in New Issue
Block a user