fix(initramfs): fix bare metal install (#245)
This commit is contained in:
parent
de8bf88b33
commit
c171c51c5c
@ -6,6 +6,7 @@ import "C"
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
@ -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)
|
||||
|
@ -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 {
|
||||
@ -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
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user