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

Commit

Permalink
Merge pull request #42 from trueos/unique-bename
Browse files Browse the repository at this point in the history
Include date/timestamp on all new BE's created. This prevents an issue
  • Loading branch information
kmoore134 authored May 22, 2019
2 parents 44734a7 + 92785fd commit 2136e74
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,8 @@ func renamebe() {
log.Fatal(err)
}

BENAME = string(bytes.Fields(version)[0])
// Set new BE name, but keep date / timestamp
BENAME = string(bytes.Fields(version)[0]) + "_" + defines.BESTAGE
}
}

Expand All @@ -992,8 +993,8 @@ func renamebe() {
err := cmd.Run()
if err != nil {
logger.LogToFile("Failed touching " + loaderConf)
ws.SendMsg("Failed touching: " + loaderConf)
log.Fatal("Failed touching: " + loaderConf)
ws.SendMsg("Failed touching: "+loaderConf, "fatal")
return
}

// Unmount /dev
Expand All @@ -1010,17 +1011,17 @@ func renamebe() {
if err != nil {
logger.LogToFile("Failed beadm umount -f")
ws.SendMsg("Failed unmounting: "+defines.BESTAGE, "fatal")
log.Fatal(err)
return
}

// Now rename BE
if BENAME != defines.BESTAGE {
cmd = exec.Command("beadm", "rename", defines.BESTAGE, BENAME)
err = cmd.Run()
if err != nil {
logger.LogToFile("Failed beadm rename")
ws.SendMsg("Failed renaming: "+BENAME, "fatal")
log.Fatal(err)
logger.LogToFile("Failed renaming: " + defines.BESTAGE + " -> " + BENAME)
ws.SendMsg("Failed renaming: "+defines.BESTAGE+" -> "+BENAME, "fatal")
return
}
}

Expand All @@ -1030,7 +1031,7 @@ func renamebe() {
if err != nil {
logger.LogToFile("Failed beadm activate")
ws.SendMsg("Failed activating: "+BENAME, "fatal")
log.Fatal("Failed activating: " + BENAME)
return
}

}
Expand Down

0 comments on commit 2136e74

Please sign in to comment.