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

Commit

Permalink
Update SysUp with a conversion routine to go from legacy
Browse files Browse the repository at this point in the history
pkg base to new ports base option
  • Loading branch information
kmoore134 committed Feb 10, 2019
1 parent 42d36f5 commit 143c901
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
6 changes: 0 additions & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,6 @@ func printupdatedetails(details UpdateInfo) {
for i, _ := range details.Del {
fmt.Println(" " + details.Del[i].Name + " " + details.Del[i].Version)
}

if ( details.KernelUp ) {
fmt.Println()
fmt.Println("Kernel Update will be performed - Two reboots required")
fmt.Println("----------------------------------------------------")
}
}

func startupdate() {
Expand Down
28 changes: 24 additions & 4 deletions doupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,24 @@ func checkbaseswitch() {
return
}

// Make sure pkg is fetched
sendinfomsg("Fetching new base")
logtofile("Fetching new base")
cmd = exec.Command(PKGBIN, "-C", localpkgconf, "fetch", "-U", "-d", "-y", "os/userland", "os/kernel")
err = cmd.Run()
if ( err != nil ) {
sendfatalmsg("Failed fetching new base")
}

// Get list of packages we need to nuke
shellcmd := "${PKGBIN} query '%o %n-%v' | grep ^base | awk '{print $2}'"
shellcmd := PKGBIN + " query '%o %n-%v' | grep '^base ' | awk '{print $2}'"
output, cmderr := exec.Command("/bin/sh", "-c", shellcmd).Output()
if ( cmderr != nil ) {
log.Fatal("Failed getting base package list")
}

barr := strings.Split(string(output), "\n")
basepkgs := strings.TrimSpace(string(output))
barr := strings.Split(basepkgs, "\n")
for i, _ := range barr {
// Unset vital flag
sendinfomsg("Removing: " + barr[i])
Expand All @@ -432,15 +442,25 @@ func checkbaseswitch() {
log.Fatal("Failed unsetting vital")
}
// Remove the package now
cmd = exec.Command(PKGBIN, "-c", STAGEDIR, "-C", localpkgconf, "delete", "-y", barr[i])
cmd = exec.Command(PKGBIN, "-c", STAGEDIR, "-C", localpkgconf, "delete", "-y", "-f", barr[i])
err = cmd.Run()
if ( err != nil ) {
log.Fatal("Failed removing")
}
if ( strings.Contains(barr[i], "-runtime-1")) {
// If this was the runtime package, need to re-install userland right away
sendinfomsg("Boot-strapping userland")
pkgcmd := exec.Command(PKGBIN, "-r", STAGEDIR, "-C", localpkgconf, "install", "-U", "-f", "-y", "os/userland")
fullout, err := pkgcmd.CombinedOutput()
if ( err != nil ) {
sendinfomsg(string(fullout))
sendfatalmsg("Failed boot-strapping userland")
}
}
}

// Load new userland / kernel and friends
pkgcmd := exec.Command(PKGBIN, "-c", STAGEDIR, "-C", localpkgconf, "install", "-U", "-y", "os/userland", "os/kernel", "os/docs", "os/userland-lib32")
pkgcmd := exec.Command(PKGBIN, "-c", STAGEDIR, "-C", localpkgconf, "install", "-U", "-y", "os/userland", "os/kernel")
fullout, err := pkgcmd.CombinedOutput()
sendinfomsg(string(fullout))
logtofile(string(fullout))
Expand Down

0 comments on commit 143c901

Please sign in to comment.