Skip to content

Commit

Permalink
fix(initramfs): fix bare metal install (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradbeam authored and andrewrynhard committed Dec 1, 2018
1 parent de8bf88 commit c171c51
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/initramfs/cmd/init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "C"

import (
"flag"
"fmt"
"log"
"os"

Expand Down Expand Up @@ -103,7 +104,7 @@ func initram() error {
func root() error {
// Setup logging to /dev/kmsg.
if _, err := kmsg("[talos]"); err != nil {
return err
return fmt.Errorf("failed to setup logging to /dev/kmsg: %v", err)
}
// Read the user data.
log.Printf("reading the user data: %s\n", constants.UserDataPath)
Expand Down
6 changes: 4 additions & 2 deletions src/initramfs/cmd/init/pkg/mount/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func Mount(s string) error {

// Unmount unmounts the ROOT and DATA block devices.
func Unmount() error {
for _, disk := range []string{constants.RootPartitionLabel, constants.DataPartitionLabel} {
for _, disk := range []string{constants.BootPartitionLabel, constants.RootPartitionLabel, constants.DataPartitionLabel} {
mountpoint, ok := instance.blockdevices[disk]
if ok {
if err := unix.Unmount(mountpoint.target, 0); err != nil {
Expand Down Expand Up @@ -260,6 +260,8 @@ func mountBlockDevices(blockdevices []*BlockDevice, s string) (err error) {
mountpoint.target = s
case constants.DataPartitionLabel:
mountpoint.target = path.Join(s, "var")
case constants.BootPartitionLabel:
mountpoint.target = path.Join(s, "boot")
default:
continue
}
Expand Down Expand Up @@ -287,7 +289,7 @@ func mountBlockDevices(blockdevices []*BlockDevice, s string) (err error) {
func probe() (b []*BlockDevice, err error) {
b = []*BlockDevice{}

for _, disk := range []string{constants.RootPartitionLabel, constants.DataPartitionLabel} {
for _, disk := range []string{constants.RootPartitionLabel, constants.DataPartitionLabel, constants.BootPartitionLabel} {
if err := appendBlockDeviceWithLabel(&b, disk); err != nil {
return nil, err
}
Expand Down
6 changes: 6 additions & 0 deletions src/initramfs/cmd/init/pkg/platform/baremetal/baremetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,12 @@ func untar(tarball *os.File, dst string) error {
if err != nil {
return err
}
case tar.TypeSymlink:
dest := filepath.Join(dst, header.Name)
source := header.Linkname
if err := os.Symlink(source, dest); err != nil {
return err
}
}
}
}
Expand Down

0 comments on commit c171c51

Please sign in to comment.