mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-04-28 03:32:27 +00:00
Add a check for livemedia when running upgrade
Signed-off-by: Itxaka <itxaka@kairos.io>
This commit is contained in:
parent
2e0af77fbc
commit
40da5fa451
17
main.go
17
main.go
@ -150,6 +150,9 @@ See https://kairos.io/docs/upgrade/manual/ for documentation.
|
||||
if err := validateSource(c.String("source")); err != nil {
|
||||
return err
|
||||
}
|
||||
if bootFromLiveMedia() {
|
||||
return fmt.Errorf("cannot upgrade from live media")
|
||||
}
|
||||
|
||||
return checkRoot()
|
||||
},
|
||||
@ -836,6 +839,20 @@ func validateSource(source string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check
|
||||
func bootFromLiveMedia() bool {
|
||||
// Check if the system is booted from a LIVE media by checking if the file /run/cos/livecd is present
|
||||
r, err := state.NewRuntime()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if r.BootState == state.LiveCD {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func getReleasesFromProvider(includePrereleases bool) ([]string, error) {
|
||||
var tags []string
|
||||
bus.Manager.Response(events.EventAvailableReleases, func(p *pluggable.Plugin, r *pluggable.EventResponse) {
|
||||
|
Loading…
Reference in New Issue
Block a user