Skip to content

Commit

Permalink
Add support to /dev/disk/by-path device reference
Browse files Browse the repository at this point in the history
...and to all the symlinks referencing a disk device.

Signed-off-by: Francesco Giudici <[email protected]>
  • Loading branch information
fgiudici authored and davidcassany committed Mar 4, 2024
1 parent e56244d commit ca4f47c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import (

"github.com/rancher/elemental-toolkit/cmd/config"
"github.com/rancher/elemental-toolkit/pkg/action"
"github.com/rancher/elemental-toolkit/pkg/constants"
elementalError "github.com/rancher/elemental-toolkit/pkg/error"
v1 "github.com/rancher/elemental-toolkit/pkg/types/v1"
"github.com/rancher/elemental-toolkit/pkg/utils"
)

// NewInstallCmd returns a new instance of the install subcommand and appends it to
Expand Down Expand Up @@ -79,6 +81,9 @@ func NewInstallCmd(root *cobra.Command, addCheckRoot bool) *cobra.Command {
return elementalError.New("at least a target device must be supplied", elementalError.InvalidTarget)
}

// If the device path is a symlink, resolve it (e.g., /dev/disk/by-path/platform-fe340000.mmc-part1)
spec.Target, _ = utils.ResolveLink(cfg.Fs, spec.Target, "/", constants.MaxLinkDepth)

cfg.Logger.Infof("Install called")
install, err := action.NewInstallAction(cfg, spec)
if err != nil {
Expand Down

0 comments on commit ca4f47c

Please sign in to comment.