From ca4f47c5efd0a45dcaf233aae959b3b2b6b711dd Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Fri, 1 Mar 2024 15:06:16 +0100 Subject: [PATCH] Add support to /dev/disk/by-path device reference ...and to all the symlinks referencing a disk device. Signed-off-by: Francesco Giudici --- cmd/install.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/install.go b/cmd/install.go index 06b707a7298..acdf140bde0 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -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 @@ -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 {