27 lines
648 B
Go
27 lines
648 B
Go
package updater
|
|
|
|
const (
|
|
eventUpdate = "update"
|
|
eventOPKGUpdateResult = "opkg update result"
|
|
)
|
|
|
|
// UpdateStatus embeds informations about update status
|
|
type UpdateStatus struct {
|
|
Active bool `json:"active"`
|
|
Locked bool `json:"locked"`
|
|
State string `json:"state"`
|
|
}
|
|
|
|
// Update asks the ReachRS module to start an OPKG update
|
|
func (c *Client) Update() (*UpdateStatus, error) {
|
|
res := &UpdateStatus{}
|
|
if err := c.ReqResp(eventUpdate, nil, eventOPKGUpdateResult, res); err != nil {
|
|
return nil, err
|
|
}
|
|
c.Logf(
|
|
"opkg update result: active: %v, state: %v, locked: %v",
|
|
res.Active, res.State, res.Locked,
|
|
)
|
|
return res, nil
|
|
}
|