- Updated `wwctl upgrade` to handle updates - Maintained `.Container` and `.ContainerName` in tstruct - Added `ContainerName()` methods to node and profile objects - Added `--container`, `-C` aliases to wwctl commands (`<node|profile> <add|set>`) - Added `wwctl container` alias - Added support for `container_exit.sh` if `image_exit.sh` is not found Signed-off-by: Jonathon Anderson <janderson@ciq.com>
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package warewulfd
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path"
|
|
|
|
warewulfconf "github.com/warewulf/warewulf/internal/pkg/config"
|
|
"github.com/warewulf/warewulf/internal/pkg/wwlog"
|
|
|
|
"github.com/warewulf/warewulf/internal/pkg/image"
|
|
"github.com/warewulf/warewulf/internal/pkg/util"
|
|
)
|
|
|
|
/*
|
|
Copies the default shim, which is the shim located on host
|
|
to the tftp directory
|
|
*/
|
|
|
|
func CopyShimGrub() (err error) {
|
|
conf := warewulfconf.Get()
|
|
wwlog.Debug("copy shim and grub binaries from host")
|
|
shimPath := image.ShimFind("")
|
|
if shimPath == "" {
|
|
return fmt.Errorf("no shim found on the host os")
|
|
}
|
|
err = util.CopyFile(shimPath, path.Join(conf.TFTP.TftpRoot, "warewulf", "shim.efi"))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_ = os.Chmod(path.Join(conf.TFTP.TftpRoot, "warewulf", "shim.efi"), 0o755)
|
|
grubPath := image.GrubFind("")
|
|
if grubPath == "" {
|
|
return fmt.Errorf("no grub found on host os")
|
|
}
|
|
err = util.CopyFile(grubPath, path.Join(conf.TFTP.TftpRoot, "warewulf", "grub.efi"))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_ = os.Chmod(path.Join(conf.TFTP.TftpRoot, "warewulf", "grub.efi"), 0o755)
|
|
err = util.CopyFile(grubPath, path.Join(conf.TFTP.TftpRoot, "warewulf", "grubx64.efi"))
|
|
_ = os.Chmod(path.Join(conf.TFTP.TftpRoot, "warewulf", "grubx64.efi"), 0o755)
|
|
|
|
return
|
|
}
|