Delete downloaded firmware image after installation.

This commit is contained in:
Jan Schneider 2018-02-27 20:57:18 +01:00
parent 6c75f65b3d
commit dd26628ea0
3 changed files with 25 additions and 4 deletions

View File

@ -1113,7 +1113,7 @@ proc ::rmupdate::delete_firmware_image {version} {
catch { eval {file delete [glob "${img_dir}/*${version}*.zip"]} }
}
proc ::rmupdate::install_firmware_version {version lang {reboot 1} {dryrun 0}} {
proc ::rmupdate::install_firmware_version {version lang {reboot 1} {keep_download 0} {dryrun 0}} {
variable language
set language $lang
if {[get_running_installation] != ""} {
@ -1142,6 +1142,10 @@ proc ::rmupdate::install_firmware_version {version lang {reboot 1} {dryrun 0}} {
check_sizes $firmware_image
update_filesystems $firmware_image $dryrun
if {!$keep_download && !$dryrun} {
file delete $firmware_image
}
set_running_installation ""
if {$reboot && !$dryrun} {

View File

@ -217,9 +217,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
$('#modal-log').modal('show');
if (!running_installation) {
var reboot = $('#reboot-after-install').is(':checked');
var keep_download = ! $('#delete-download-after-install').is(':checked');
var dryrun = $('#dryrun').is(':checked');
set_running_installation("Firmware " + version);
rest("POST", "/start_install_firmware", JSON.stringify({"language": language, "version":version, "reboot":reboot, "dryrun":dryrun}),
rest("POST", "/start_install_firmware", JSON.stringify({"language": language, "version":version, "reboot":reboot, "dryrun":dryrun, "keep_download": keep_download}),
function(data) {
// We are not expecting a response
},
@ -580,6 +581,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
installation_log: 'Installation log',
open_release_info: 'Open release info',
perform_trial_run: 'Perform a trial run with no changes made',
delete_download_after_install: 'Delete download after installation',
reboot_after_install: 'Reboot system after installation',
addons: 'Addons',
addon_name: 'Addon name',
@ -648,6 +650,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
installation_log: 'Installations-Protokoll',
open_release_info: 'Release-Informationen öffnen',
perform_trial_run: 'Testlauf durchführen ohne Änderungen durchzuführen',
delete_download_after_install: 'Download nach Installation löschen',
reboot_after_install: 'System nach Installation neu starten',
addons: 'Zusatzsoftware',
addon_name: 'Name des Addons',
@ -811,6 +814,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<label data-i18n="perform_trial_run"></label>
</div>
<br />
<div class="ui checkbox">
<input id="delete-download-after-install" type="checkbox" checked="checked">
<label data-i18n="delete_download_after_install"></label>
</div>
<br />
<div class="ui checkbox">
<input id="reboot-after-install" type="checkbox" checked="checked">
<label data-i18n="reboot_after_install"></label>

View File

@ -70,6 +70,7 @@ proc process {} {
regexp {\"language\"\s*:\s*\"([^\"]+)\"} $data match lang
regexp {\"reboot\"\s*:\s*(true|false)} $data match reboot
regexp {\"dryrun\"\s*:\s*(true|false)} $data match dryrun
regexp {\"keep_download\"\s*:\s*(true|false)} $data match keep_download
if { [info exists version] && $version != "" } {
if { ![info exists reboot] } {
set reboot "true"
@ -79,7 +80,7 @@ proc process {} {
} else {
set reboot 0
}
if { ![info exists reboot] } {
if { ![info exists dryrun] } {
set dryrun "false"
}
if {$dryrun == "true"} {
@ -87,7 +88,15 @@ proc process {} {
} else {
set dryrun 0
}
return "\"[rmupdate::install_firmware_version $version $lang $reboot $dryrun]\""
if { ![info exists keep_download] } {
set keep_download "false"
}
if {$keep_download == "true"} {
set keep_download 1
} else {
set keep_download 0
}
return "\"[rmupdate::install_firmware_version $version $lang $reboot $keep_download $dryrun]\""
} else {
error "Invalid version: ${data}"
}