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

make ros install --append work

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2016-12-07 20:55:38 +10:00
parent 85bdaa6145
commit 1a0e818328
5 changed files with 18 additions and 17 deletions

0
cmd/control/dev.go Executable file → Normal file
View File

View File

@@ -248,6 +248,7 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force,
} }
if mountiso { if mountiso {
// TODO: I hope to remove this from here later.
if err := mountBootIso(); err == nil { if err := mountBootIso(); err == nil {
log.Infof("Mounted /dev/sr0") log.Infof("Mounted /dev/sr0")
} }
@@ -423,7 +424,7 @@ func layDownOS(image, installType, cloudConfig, device, kappend string) error {
//log.Debugf("pvGrubConfig") //log.Debugf("pvGrubConfig")
//pvGrubConfig(menu) //pvGrubConfig(menu)
log.Debugf("installRancher") log.Debugf("installRancher")
err := installRancher(baseName, bootDir, VERSION, DIST) err := installRancher(baseName, bootDir, VERSION, DIST, kernelArgs+" "+kappend)
if err != nil { if err != nil {
log.Errorf("%s", err) log.Errorf("%s", err)
return err return err
@@ -842,23 +843,12 @@ DEFAULT RancherOS-current
return nil return nil
} }
func installRancher(baseName, bootDir, VERSION, DIST string) error { func installRancher(baseName, bootDir, VERSION, DIST, kappend string) error {
log.Debugf("installRancher") log.Debugf("installRancher")
//cp ${DIST}/initrd ${baseName}/${bootDir}initrd-${VERSION}-rancheros // TODO detect if there already is a linux-current.cfg, if so, move it to linux-previous.cfg, and replace only current with the one in the image/iso
//if err := dfs.CopyFile(DIST+"/initrd", filepath.Join(baseName, bootDir), "initrd-"+VERSION+"-rancheros"); err != nil {
// log.Errorf("copy initrd: ", err)
// return err
//}
//cp ${DIST}/vmlinuz ${baseName}/${bootDir}vmlinuz-${VERSION}-rancheros // The image/ISO have all the files in it - the syslinux cfg's and the kernel&initrd, so we can copy them all from there
//if err := dfs.CopyFile(DIST+"/vmlinuz", filepath.Join(baseName, bootDir), "vmlinuz-"+VERSION+"-rancheros"); err != nil {
// log.Errorf("copy vmlinuz: %s", err)
// return err
//}
//return nil
// The ISO has all the files in it - the syslinux cfg's and the kernel&initrd, so we can copy them all from there
files, _ := ioutil.ReadDir(DIST) files, _ := ioutil.ReadDir(DIST)
for _, file := range files { for _, file := range files {
if file.IsDir() { if file.IsDir() {
@@ -874,6 +864,12 @@ func installRancher(baseName, bootDir, VERSION, DIST string) error {
log.Errorf("copy %s: %s", "syslinux.cfg", err) log.Errorf("copy %s: %s", "syslinux.cfg", err)
return err return err
} }
// The global.cfg INCLUDE - useful for over-riding the APPEND line
err := ioutil.WriteFile(filepath.Join(filepath.Join(baseName, bootDir), "global.cfg"), []byte("APPEND "+kappend), 0644)
if err != nil {
log.Errorf("write (%s) %s", "global.cfg", err)
return err
}
return nil return nil
} }

View File

@@ -1,6 +1,9 @@
TIMEOUT 20 #2s TIMEOUT 20 #2s
PROMPT 1 PROMPT 1
# doesn't appear to work here?
INCLUDE ../global.cfg
# each INCLUDEd file has a `DEFAULT mylabel` in it, and the last one wins # each INCLUDEd file has a `DEFAULT mylabel` in it, and the last one wins
INCLUDE ../linux-previous.cfg INCLUDE ../linux-previous.cfg
INCLUDE ../linux-current.cfg INCLUDE ../linux-current.cfg

View File

@@ -6,5 +6,6 @@ LABEL rancheros-${LABEL}
KERNEL /boot/vmlinuz-${KERNEL_VERSION} KERNEL /boot/vmlinuz-${KERNEL_VERSION}
INITRD /boot/initrd INITRD /boot/initrd
#TODO - once we work out how to append it for qemu-dev,/boot/linuxmods-${KERNEL_VERSION} #TODO - once we work out how to append it for qemu-dev,/boot/linuxmods-${KERNEL_VERSION}
APPEND quiet rancher.autologin=tty1 rancher.autologin=ttyS0 ${APPEND} #APPEND quiet rancher.autologin=tty1 rancher.autologin=ttyS0 ${APPEND}
#INCLUDE global.cfg

View File

@@ -28,7 +28,8 @@ cp ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION} ${CD}/boot/
cat scripts/isolinux.cfg | envsubst > ${CD}/boot/isolinux/isolinux.cfg cat scripts/isolinux.cfg | envsubst > ${CD}/boot/isolinux/isolinux.cfg
cat scripts/isolinux_label.cfg | LABEL=${VERSION} envsubst > ${CD}/boot/linux-current.cfg cat scripts/isolinux_label.cfg | LABEL=${VERSION} envsubst > ${CD}/boot/linux-current.cfg
cat scripts/isolinux_label.cfg | LABEL=debug APPEND="rancher.debug=true" envsubst > ${CD}/boot/linux-previous.cfg #cat scripts/isolinux_label.cfg | LABEL=debug APPEND="rancher.debug=true" envsubst > ${CD}/boot/linux-previous.cfg
cat scripts/global.cfg | LABEL=${VERSION} envsubst > ${CD}/boot/global.cfg
cp /usr/lib/ISOLINUX/isolinux.bin ${CD}/boot/isolinux/ cp /usr/lib/ISOLINUX/isolinux.bin ${CD}/boot/isolinux/
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 ${CD}/boot/isolinux/ cp /usr/lib/syslinux/modules/bios/ldlinux.c32 ${CD}/boot/isolinux/