1
0
mirror of https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git synced 2023-10-10 11:37:40 +00:00
This commit is contained in:
Jan Schneider
2017-03-26 20:25:01 +02:00
parent 0f3cc9b506
commit 207e9f95af
4 changed files with 213 additions and 37 deletions

View File

@@ -48,13 +48,34 @@ proc process {} {
} elseif {[lindex $path 1] == "get_firmware_info"} {
return [rmupdate::get_firmware_info]
} elseif {[lindex $path 1] == "start_install_firmware"} {
regexp {^([\d\.]+)$} $data match version
regexp {\"version\"\s*:\s*\"([\d\.]+)\"} $data match version
regexp {\"reboot\"\s*:\s*(true|false)} $data match reboot
if { [info exists version] && $version != "" } {
rmupdate::install_firmware_version $version
return "\"done\""
if { ![info exists reboot] } {
set reboot "true"
}
if {$reboot == "true"} {
set reboot 1
} else {
set reboot 0
}
return "\"[rmupdate::install_firmware_version $version $reboot]\""
} else {
error "Invalid version: ${data}"
}
} elseif {[lindex $path 1] == "delete_firmware_image"} {
regexp {\"version\"\s*:\s*\"([\d\.]+)\"} $data match version
if { [info exists version] && $version != "" } {
return "\"[rmupdate::delete_firmware_image $version]\""
} else {
error "Invalid version: ${data}"
}
} elseif {[lindex $path 1] == "is_system_upgradeable"} {
if {[rmupdate::is_system_upgradeable]} {
return "true"
} else {
return "false"
}
} elseif {[lindex $path 1] == "read_install_log"} {
variable content_type "text/html"
return [rmupdate::read_install_log]