add /update/features handler for feature negotiation

related to https://github.com/gokrazy/gokrazy/issues/52
This commit is contained in:
Michael Stapelberg 2020-04-07 09:52:12 +02:00
parent ffc8928d2e
commit 057fc9dcb0

View File

@ -109,6 +109,12 @@ func nonConcurrentSwitchHandler(newRootPartition int) func(http.ResponseWriter,
}
func initUpdate() error {
// The /update/features handler is used for negotiation of individual
// feature support (e.g. PARTUUID= support) between the packer and update
// target.
http.HandleFunc("/update/features", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "partuuid,")
})
http.HandleFunc("/update/mbr", nonConcurrentUpdateHandler(rootdev.BlockDevice()))
http.HandleFunc("/update/root", nonConcurrentUpdateHandler(rootdev.Partition(rootdev.InactiveRootPartition())))
http.HandleFunc("/update/switch", nonConcurrentSwitchHandler(rootdev.InactiveRootPartition()))