File: generate_bundle_linux.go

package info (click to toggle)
golang-github-crc-org-crc 2.34.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,548 kB
  • sloc: sh: 398; makefile: 326; javascript: 40
file content (25 lines) | stat: -rw-r--r-- 627 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package machine

import (
	"fmt"
	"path/filepath"

	"github.com/crc-org/crc/v2/pkg/crc/constants"
	crcos "github.com/crc-org/crc/v2/pkg/os"
)

func copyDiskImage(destDir string) (string, string, error) {
	const destFormat = "qcow2"

	imageName := fmt.Sprintf("%s.qcow2", constants.DefaultName)

	srcPath := filepath.Join(constants.MachineInstanceDir, constants.DefaultName, imageName)
	destPath := filepath.Join(destDir, imageName)

	_, _, err := crcos.RunWithDefaultLocale("qemu-img", "convert", "-f", "qcow2", "-O", destFormat, srcPath, destPath)
	if err != nil {
		return "", "", err
	}

	return destPath, destFormat, nil
}