mirror of
https://github.com/lxc/distrobuilder.git
synced 2026-02-05 15:46:17 +01:00
Update Vyos rolling update iso url
Changed because the download location for the Vyos Rolling update ISO file has changed. Signed-off-by: Naofumi Uesugi <blacknon@orebibou.com>
This commit is contained in:
committed by
Stéphane Graber
parent
b0234a222d
commit
c192e159ff
2
go.mod
2
go.mod
@@ -9,6 +9,7 @@ exclude (
|
||||
|
||||
require (
|
||||
github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3
|
||||
github.com/google/go-github/v56 v56.0.0
|
||||
github.com/lxc/incus v0.0.0-20231030213510-385b6509cfce
|
||||
github.com/mudler/docker-companion v0.4.6-0.20211015133729-bd4704fad372
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
@@ -45,6 +46,7 @@ require (
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/uuid v1.4.0 // indirect
|
||||
github.com/gorilla/schema v1.2.0 // indirect
|
||||
github.com/gorilla/securecookie v1.1.1 // indirect
|
||||
|
||||
5
go.sum
5
go.sum
@@ -174,10 +174,15 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-github/v56 v56.0.0 h1:TysL7dMa/r7wsQi44BjqlwaHvwlFlqkK8CtBWCX3gb4=
|
||||
github.com/google/go-github/v56 v56.0.0/go.mod h1:D8cdcX98YWJvi7TLo7zM4/h8ZTx6u6fwGEkCdisopo0=
|
||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package sources
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/google/go-github/v56/github"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/lxc/distrobuilder/shared"
|
||||
@@ -12,22 +14,50 @@ import (
|
||||
|
||||
type vyos struct {
|
||||
common
|
||||
|
||||
fname string
|
||||
fpath string
|
||||
}
|
||||
|
||||
func (s *vyos) Run() error {
|
||||
isoURL := "https://s3-us.vyos.io/rolling/current/vyos-rolling-latest.iso"
|
||||
|
||||
fpath, err := s.DownloadHash(s.definition.Image, isoURL, "", nil)
|
||||
err := s.downloadImage(s.definition)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed downloading ISO: %w", err)
|
||||
return fmt.Errorf("Failed to download image: %w", err)
|
||||
}
|
||||
|
||||
err = s.unpackISO(filepath.Join(fpath, "vyos-rolling-latest.iso"), s.rootfsDir)
|
||||
return s.unpackISO(filepath.Join(s.fpath, s.fname), s.rootfsDir)
|
||||
}
|
||||
|
||||
func (s *vyos) downloadImage(definition shared.Definition) error {
|
||||
var err error
|
||||
|
||||
ctx := context.Background()
|
||||
client := github.NewClient(nil)
|
||||
owner := "vyos"
|
||||
repo := "vyos-rolling-nightly-builds"
|
||||
|
||||
latestRelease, _, err := client.Repositories.GetLatestRelease(ctx, owner, repo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed unpacking ISO: %w", err)
|
||||
return fmt.Errorf("Failed to get latest release, %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
isoURL := ""
|
||||
assets := latestRelease.Assets
|
||||
for _, a := range assets {
|
||||
ext := filepath.Ext(a.GetName())
|
||||
if ext == ".iso" {
|
||||
isoURL = a.GetBrowserDownloadURL()
|
||||
s.fname = a.GetName()
|
||||
}
|
||||
}
|
||||
|
||||
if isoURL == "" {
|
||||
return fmt.Errorf("Failed to get latest release URL.")
|
||||
}
|
||||
|
||||
s.fpath, err = s.DownloadHash(s.definition.Image, isoURL, "", nil)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *vyos) unpackISO(filePath string, rootfsDir string) error {
|
||||
|
||||
Reference in New Issue
Block a user