From 207e9f95af5012724ec95dd3510d96d63c085e0e Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Sun, 26 Mar 2017 20:25:01 +0200 Subject: [PATCH] - --- addon/lib/rmupdate.tcl | 22 ++++++- addon/www/index.html | 137 +++++++++++++++++++++++++++++++---------- addon/www/rest.cgi | 27 +++++++- resize_image.sh | 64 +++++++++++++++++++ 4 files changed, 213 insertions(+), 37 deletions(-) create mode 100755 resize_image.sh diff --git a/addon/lib/rmupdate.tcl b/addon/lib/rmupdate.tcl index c94c928..4d5e387 100644 --- a/addon/lib/rmupdate.tcl +++ b/addon/lib/rmupdate.tcl @@ -70,6 +70,16 @@ proc ::rmupdate::get_partion_start_and_size {device partition} { return [list -1 -1] } +proc ::rmupdate::is_system_upgradeable {} { + set ret [get_filesystem_size_and_usage "/"] + set size [lindex $ret 0] + set used [lindex $ret 1] + if { [expr {$used*1.5}] > $size && [expr {$used+50*1024*1024}] >= $size } { + return 0 + } + return 1 +} + proc ::rmupdate::mount_image_partition {image partition mountpoint} { variable loop_dev variable sys_dev @@ -337,7 +347,12 @@ proc ::rmupdate::install_process_running {} { return 0 } -proc ::rmupdate::install_firmware_version {version} { +proc ::rmupdate::delete_firmware_image {version} { + variable img_dir + eval {file delete [glob "${img_dir}/*${version}.img"]} +} + +proc ::rmupdate::install_firmware_version {version {reboot 1}} { if {[rmupdate::install_process_running]} { error "Another install process is running." } @@ -369,6 +384,11 @@ proc ::rmupdate::install_firmware_version {version} { update_filesystems $firmware_image file delete $install_lock + + if {$reboot} { + write_log "Rebooting system." + exec /sbin/reboot -f + } } #puts [rmupdate::get_latest_firmware_version] diff --git a/addon/www/index.html b/addon/www/index.html index 2094f82..2722980 100644 --- a/addon/www/index.html +++ b/addon/www/index.html @@ -31,7 +31,9 @@ along with this program. If not, see . RaspberryMatic Update Addon @@ -147,12 +214,12 @@ along with this program. If not, see .

Firmwares

+
+
- - @@ -161,12 +228,16 @@ along with this program. If not, see .
VersionLatestInstalled Available Downloaded Action
+
+ + +