mirror of
https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git
synced 2023-10-10 11:37:40 +00:00
Add dryrun option
This commit is contained in:
parent
565c8c0139
commit
2ef7169ed5
@ -208,9 +208,13 @@ proc ::rmupdate::check_sizes {image} {
|
|||||||
write_log "Sizes of filesystems checked successfully."
|
write_log "Sizes of filesystems checked successfully."
|
||||||
}
|
}
|
||||||
|
|
||||||
proc ::rmupdate::update_filesystems {image} {
|
proc ::rmupdate::update_filesystems {image {dryrun 0}} {
|
||||||
variable mnt_new
|
variable mnt_new
|
||||||
variable mnt_cur
|
variable mnt_cur
|
||||||
|
set extra_args ""
|
||||||
|
if {$dryrun != 0} {
|
||||||
|
set extra_args "--dry-run"
|
||||||
|
}
|
||||||
|
|
||||||
write_log "Updating filesystems."
|
write_log "Updating filesystems."
|
||||||
|
|
||||||
@ -224,7 +228,7 @@ proc ::rmupdate::update_filesystems {image} {
|
|||||||
mount_system_partition $partition $mnt_cur
|
mount_system_partition $partition $mnt_cur
|
||||||
|
|
||||||
write_log "Rsyncing filesystem of partition ${partition}."
|
write_log "Rsyncing filesystem of partition ${partition}."
|
||||||
set data [exec rsync --progress --archive --delete "${mnt_new}/" "${mnt_cur}"]
|
set data [exec rsync ${extra_args} --progress --archive --delete "${mnt_new}/" "${mnt_cur}"]
|
||||||
write_log "Rsync finished."
|
write_log "Rsync finished."
|
||||||
|
|
||||||
umount $mnt_new
|
umount $mnt_new
|
||||||
|
@ -112,9 +112,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
installation_running = version;
|
installation_running = version;
|
||||||
$('[data-install-version="' + installation_running + '"]').addClass('loading');
|
$('[data-install-version="' + installation_running + '"]').addClass('loading');
|
||||||
var reboot = $('#reboot-after-install').is(':checked');
|
var reboot = $('#reboot-after-install').is(':checked');
|
||||||
|
var dryrun = $('#dryrun').is(':checked');
|
||||||
display_message('info', 'Installing firmware ' + version + '.', 6000000);
|
display_message('info', 'Installing firmware ' + version + '.', 6000000);
|
||||||
clear_message();
|
clear_message();
|
||||||
rest("POST", "/start_install_firmware", JSON.stringify({"version":version, "reboot":reboot}),
|
rest("POST", "/start_install_firmware", JSON.stringify({"version":version, "reboot":reboot, "dryrun":dryrun}),
|
||||||
function(data) {
|
function(data) {
|
||||||
$('[data-install-version="' + installation_running + '"]').removeClass('loading');
|
$('[data-install-version="' + installation_running + '"]').removeClass('loading');
|
||||||
installation_running = "";
|
installation_running = "";
|
||||||
@ -228,6 +229,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<tbody>
|
<tbody>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<input id="dryrun" type="checkbox">
|
||||||
|
<label>Perform a trial run with no changes made</label>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
<input id="reboot-after-install" type="checkbox" checked="checked">
|
<input id="reboot-after-install" type="checkbox" checked="checked">
|
||||||
<label>Reboot system after installation</label>
|
<label>Reboot system after installation</label>
|
||||||
|
@ -50,6 +50,7 @@ proc process {} {
|
|||||||
} elseif {[lindex $path 1] == "start_install_firmware"} {
|
} elseif {[lindex $path 1] == "start_install_firmware"} {
|
||||||
regexp {\"version\"\s*:\s*\"([\d\.]+)\"} $data match version
|
regexp {\"version\"\s*:\s*\"([\d\.]+)\"} $data match version
|
||||||
regexp {\"reboot\"\s*:\s*(true|false)} $data match reboot
|
regexp {\"reboot\"\s*:\s*(true|false)} $data match reboot
|
||||||
|
regexp {\"dryrun\"\s*:\s*(true|false)} $data match dryrun
|
||||||
if { [info exists version] && $version != "" } {
|
if { [info exists version] && $version != "" } {
|
||||||
if { ![info exists reboot] } {
|
if { ![info exists reboot] } {
|
||||||
set reboot "true"
|
set reboot "true"
|
||||||
@ -59,7 +60,15 @@ proc process {} {
|
|||||||
} else {
|
} else {
|
||||||
set reboot 0
|
set reboot 0
|
||||||
}
|
}
|
||||||
return "\"[rmupdate::install_firmware_version $version $reboot]\""
|
if { ![info exists reboot] } {
|
||||||
|
set dryrun "false"
|
||||||
|
}
|
||||||
|
if {$dryrun == "true"} {
|
||||||
|
set dryrun 1
|
||||||
|
} else {
|
||||||
|
set dryrun 0
|
||||||
|
}
|
||||||
|
return "\"[rmupdate::install_firmware_version $version $reboot $dryrun]\""
|
||||||
} else {
|
} else {
|
||||||
error "Invalid version: ${data}"
|
error "Invalid version: ${data}"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user