aboutsummaryrefslogtreecommitdiff
path: root/pkg/machine/fcos.go
diff options
context:
space:
mode:
authorJason T. Greene <jason@stacksmash.com>2021-11-12 00:10:58 -0600
committerJason T. Greene <jason.greene@redhat.com>2021-12-24 19:28:10 -0600
commit803defbe509af1902a1fdc2ed7f41b49ebd241f6 (patch)
tree54fe3a08b58b9129f87e51cd1b8fcd938f582777 /pkg/machine/fcos.go
parent73a54ea54d0a1b4ccaa2a0e23c678e5b7c1d5c37 (diff)
downloadpodman-803defbe509af1902a1fdc2ed7f41b49ebd241f6.tar.gz
podman-803defbe509af1902a1fdc2ed7f41b49ebd241f6.tar.bz2
podman-803defbe509af1902a1fdc2ed7f41b49ebd241f6.zip
Introduce Windows WSL implementation of podman machine
[NO NEW TESTS NEEDED] for now Signed-off-by: Jason Greene <jason.greene@redhat.com>
Diffstat (limited to 'pkg/machine/fcos.go')
-rw-r--r--pkg/machine/fcos.go29
1 files changed, 5 insertions, 24 deletions
diff --git a/pkg/machine/fcos.go b/pkg/machine/fcos.go
index 99197ac0e..60ab471ee 100644
--- a/pkg/machine/fcos.go
+++ b/pkg/machine/fcos.go
@@ -1,4 +1,4 @@
-// +build amd64,!windows arm64,!windows
+// +build amd64 arm64
package machine
@@ -65,25 +65,6 @@ func NewFcosDownloader(vmType, vmName, imageStream string) (DistributionDownload
return fcd, nil
}
-func (f FcosDownload) getLocalUncompressedName() string {
- uncompressedFilename := filepath.Join(filepath.Dir(f.LocalPath), f.VMName+"_"+f.ImageName)
- return strings.TrimSuffix(uncompressedFilename, ".xz")
-}
-
-func (f FcosDownload) DownloadImage() error {
- // check if the latest image is already present
- ok, err := UpdateAvailable(&f.Download)
- if err != nil {
- return err
- }
- if !ok {
- if err := DownloadVMImage(f.URL, f.LocalPath); err != nil {
- return err
- }
- }
- return Decompress(f.LocalPath, f.getLocalUncompressedName())
-}
-
func (f FcosDownload) Get() *Download {
return &f.Download
}
@@ -95,14 +76,14 @@ type fcosDownloadInfo struct {
Sha256Sum string
}
-func UpdateAvailable(d *Download) (bool, error) {
+func (f FcosDownload) HasUsableCache() (bool, error) {
// check the sha of the local image if it exists
// get the sha of the remote image
// == dont bother to pull
- if _, err := os.Stat(d.LocalPath); os.IsNotExist(err) {
+ if _, err := os.Stat(f.LocalPath); os.IsNotExist(err) {
return false, nil
}
- fd, err := os.Open(d.LocalPath)
+ fd, err := os.Open(f.LocalPath)
if err != nil {
return false, err
}
@@ -115,7 +96,7 @@ func UpdateAvailable(d *Download) (bool, error) {
if err != nil {
return false, err
}
- return sum.Encoded() == d.Sha256sum, nil
+ return sum.Encoded() == f.Sha256sum, nil
}
func getFcosArch() string {