Skip to content

Commit ffe0e06

Browse files
author
志宇
committed
Skyimager fixes.
* Ensure build grabs boot params from entry before starting. * Fix skyimager archive format.
1 parent ef2ae2d commit ffe0e06

File tree

5 files changed

+40
-47
lines changed

5 files changed

+40
-47
lines changed

build-skyimager.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ go get github.com/lucor/fyne-cross/cmd/fyne-cross || exit 1
1919
./cmd/skyimager-gui || exit 1
2020

2121
# Compress bins.
22-
FYNE=./fyne-cross/bin
22+
FYNE=$(pwd)/fyne-cross/bin
2323
TARGETS=("linux-amd64" "darwin-amd64" "windows-amd64")
2424

2525
for target in "${TARGETS[@]}"; do
26-
dst="$FYNE/skyimager-$target-$VERSION"
27-
28-
tar -czf "$dst.tar" "$FYNE/$target" || exit 1
26+
cd "$FYNE" || exit 1
27+
dst="./skyimager-$target-$VERSION"
28+
tar -czf "$dst.tar" "$target"/* || exit 1
2929
xz -vzT0 "$dst.tar" || exit 1
3030
done
31+
32+
cd "$(pwd)" || 0

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/SkycoinProject/skywire-mainnet v0.1.2
1111
github.com/google/go-github v17.0.0+incompatible
1212
github.com/google/go-querystring v1.0.0 // indirect
13+
github.com/lucor/fyne-cross v1.4.0 // indirect
1314
github.com/mholt/archiver v3.1.1+incompatible
1415
github.com/rakyll/statik v0.1.7
1516
github.com/sirupsen/logrus v1.5.0

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
2+
fyne.io/fyne v1.2.2/go.mod h1:Ab+3DIB/FVteW0y4DXfmZv4N3JdnCBh2lHkINI02BOU=
23
fyne.io/fyne v1.2.3 h1:5xwtSBNjxxmg+GF/lYvvf4xPzyjgWQoJVrzb+bt5gaA=
34
fyne.io/fyne v1.2.3/go.mod h1:JhDdBrPP/Kdr1H5ZT3HW8E/6zlz+GkOldWqSirGBDnY=
45
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
@@ -140,6 +141,8 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
140141
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
141142
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
142143
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
144+
github.com/lucor/fyne-cross v1.4.0 h1:AEY8ayoxskmzQF1XBLcnK8IK5/Ejmiaz2IeThM/yOms=
145+
github.com/lucor/fyne-cross v1.4.0/go.mod h1:lVIalVfFMFxYEbKuaKTskX9NKh07kT5bnoEEqeKGY2U=
143146
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
144147
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
145148
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=

pkg/imager/fyne.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package imager
22

33
import (
4+
"context"
45
"encoding/json"
56
"errors"
67
"fmt"
@@ -72,6 +73,27 @@ func (fg *FyneGUI) Run() {
7273
fg.w.ShowAndRun()
7374
}
7475

76+
func (fg *FyneGUI) listBaseImgs() ([]string, string) {
77+
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
78+
defer cancel()
79+
80+
title := "Please Wait"
81+
msg := "Obtaining base image releases from GitHub..."
82+
d := dialog.NewProgressInfinite(title, msg, fg.w)
83+
84+
d.Show()
85+
rs, lr, err := ListReleases(ctx, fg.log)
86+
d.Hide()
87+
88+
if err != nil {
89+
dialog.ShowError(err, fg.w)
90+
return nil, ""
91+
}
92+
93+
fg.releases = rs
94+
return releaseStrings(rs), lr.String()
95+
}
96+
7597
func (fg *FyneGUI) generateBPS() (string, error) {
7698
prevIP := fg.gwIP
7799
bpsSlice := make([]boot.Params, 0, fg.visors+1)

pkg/imager/fyne_pages.go

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package imager
22

33
import (
4-
"context"
4+
"encoding/json"
55
"errors"
66
"fmt"
77
"net"
88
"os"
99
"path/filepath"
1010
"strconv"
1111
"strings"
12-
"time"
1312

1413
"fyne.io/fyne"
1514
"fyne.io/fyne/dialog"
@@ -140,6 +139,7 @@ func (fg *FyneGUI) Page3() fyne.CanvasObject {
140139

141140
bps := widget.NewMultiLineEntry()
142141
bps.SetText(bpsStr)
142+
143143
conf := pageConfig{
144144
I: 3,
145145
Name: "Finalize Boot Parameters",
@@ -155,6 +155,12 @@ func (fg *FyneGUI) Page3() fyne.CanvasObject {
155155
},
156156
NextText: "Download and Build",
157157
Next: func() {
158+
// Decode bps entry text to ensure changes are recorded.
159+
dec := json.NewDecoder(strings.NewReader(bps.Text))
160+
if err := dec.Decode(&fg.bps); err != nil {
161+
dialog.ShowError(fmt.Errorf("invalid boot paramters: %v", err), fg.w)
162+
return
163+
}
158164
dialog.ShowConfirm("Confirmation", "Start download and build?", func(b bool) {
159165
if b {
160166
fg.build()
@@ -164,44 +170,3 @@ func (fg *FyneGUI) Page3() fyne.CanvasObject {
164170
}
165171
return makePage(fg.w, conf, bps)
166172
}
167-
168-
func (fg *FyneGUI) latestBaseURL() string {
169-
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
170-
defer cancel()
171-
172-
title := "Please Wait"
173-
msg := "Obtaining latest base image URL from GitHub..."
174-
d := dialog.NewProgressInfinite(title, msg, fg.w)
175-
176-
d.Show()
177-
imgURL, err := LatestBaseImgURL(ctx, fg.log)
178-
d.Hide()
179-
180-
if err != nil {
181-
dialog.ShowError(err, fg.w)
182-
return ""
183-
}
184-
fg.baseImg = imgURL
185-
return imgURL
186-
}
187-
188-
func (fg *FyneGUI) listBaseImgs() ([]string, string) {
189-
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
190-
defer cancel()
191-
192-
title := "Please Wait"
193-
msg := "Obtaining base image releases from GitHub..."
194-
d := dialog.NewProgressInfinite(title, msg, fg.w)
195-
196-
d.Show()
197-
rs, lr, err := ListReleases(ctx, fg.log)
198-
d.Hide()
199-
200-
if err != nil {
201-
dialog.ShowError(err, fg.w)
202-
return nil, ""
203-
}
204-
205-
fg.releases = rs
206-
return releaseStrings(rs), lr.String()
207-
}

0 commit comments

Comments
 (0)