Skip to content
This repository was archived by the owner on Dec 4, 2020. It is now read-only.

Commit 8b11fbb

Browse files
authored
Merge pull request #44 from trueos/fix-incremental-pkg
Bugfix when doing incremental updates, we need to make sure
2 parents 2136e74 + 2820767 commit 8b11fbb

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.12
55
require (
66
github.com/client9/misspell v0.3.4 // indirect
77
github.com/fzipp/gocyclo v0.0.0-20150627053110-6acd4345c835 // indirect
8-
github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc // indirect
8+
github.com/gordonklaus/ineffassign v0.0.0-20190531140324-8863c8f9d746 // indirect
99
github.com/gorilla/websocket v1.4.0
1010
github.com/magefile/mage v1.8.0
1111
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ github.com/fzipp/gocyclo v0.0.0-20150627053110-6acd4345c835 h1:roDmqJ4Qes7hrDOsW
44
github.com/fzipp/gocyclo v0.0.0-20150627053110-6acd4345c835/go.mod h1:BjL/N0+C+j9uNX+1xcNuM9vdSIcXCZrQZUYbXOFbgN8=
55
github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc h1:cJlkeAx1QYgO5N80aF5xRGstVsRQwgLR7uA2FnP1ZjY=
66
github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
7+
github.com/gordonklaus/ineffassign v0.0.0-20190531140324-8863c8f9d746 h1:RlrReUDDybSbREJYQEFtzr/0vkgKTL3Y2LVUmVsYGHE=
8+
github.com/gordonklaus/ineffassign v0.0.0-20190531140324-8863c8f9d746/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
79
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
810
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
911
github.com/magefile/mage v1.8.0 h1:mzL+xIopvPURVBwHG9A50JcjBO+xV3b5iZ7khFRI+5E=

update/update.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func DoUpdate(message []byte) {
8383
// Start downloading our files if we aren't doing stand-alone upgrade
8484
if defines.UpdateFileFlag == "" {
8585
logger.LogToFile("Fetching file updates")
86+
startpkgfetch()
8687
startfetch()
8788
}
8889

@@ -1056,6 +1057,25 @@ func rebootNow() {
10561057
exec.Command("reboot").Run()
10571058
}
10581059

1060+
func startpkgfetch() error {
1061+
1062+
cmd := exec.Command(
1063+
defines.PKGBIN, "-C", defines.PkgConf, "upgrade", "-F", "-y", "-U",
1064+
)
1065+
cmd.Args = append(cmd.Args, "-f")
1066+
cmd.Args = append(cmd.Args, "ports-mgmt/pkg")
1067+
1068+
ws.SendMsg("Starting package update download")
1069+
out, err := cmd.CombinedOutput()
1070+
if err != nil {
1071+
ws.SendMsg(string(out))
1072+
ws.SendMsg("Failed package fetch!", "fatal")
1073+
return err
1074+
}
1075+
ws.SendMsg(string(out))
1076+
return nil
1077+
}
1078+
10591079
func startfetch() error {
10601080

10611081
cmd := exec.Command(

0 commit comments

Comments
 (0)