mirror of
https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git
synced 2023-10-10 13:37:40 +02:00
Check if firmware image is compressed
This commit is contained in:
parent
025cdf26ea
commit
73b3efaca3
@ -445,18 +445,24 @@ proc ::rmupdate::update_cmdline {cmdline root} {
|
||||
}
|
||||
|
||||
proc ::rmupdate::update_boot_scr {boot_scr root} {
|
||||
set fd [open $boot_scr r]
|
||||
fconfigure $fd -translation binary
|
||||
set boot_script "/tmp/boot.script"
|
||||
|
||||
catch { exec /bin/dd if=$boot_scr of=$boot_script bs=72 skip=1 }
|
||||
|
||||
set fd [open $boot_script r]
|
||||
set data [read $fd]
|
||||
close $fd
|
||||
|
||||
regsub -all "setenv rootfs \[0-9\]" $data "setenv rootfs ${root}" data
|
||||
regsub -all "setenv userfs \[0-9\]" $data "setenv userfs 4" data
|
||||
|
||||
set fd [open $boot_scr w]
|
||||
fconfigure $fd -translation binary
|
||||
set fd [open $boot_script w]
|
||||
puts $fd $data
|
||||
close $fd
|
||||
|
||||
exec /usr/bin/mkimage -C none -A arm -T script -d $boot_script $boot_scr
|
||||
|
||||
file delete $boot_script
|
||||
}
|
||||
|
||||
proc ::rmupdate::get_system_device {} {
|
||||
@ -466,6 +472,7 @@ proc ::rmupdate::get_system_device {} {
|
||||
close $fd
|
||||
foreach d [split $data "\n"] {
|
||||
if { [regexp {root=PARTUUID=(\S+)} $d match partuuid] } {
|
||||
catch {
|
||||
set x [file readlink "/dev/disk/by-partuuid/${partuuid}"]
|
||||
if { [regexp {(mmcblk.*)p\d} [file tail $x] match device] } {
|
||||
set sys_dev "/dev/${device}"
|
||||
@ -476,6 +483,7 @@ proc ::rmupdate::get_system_device {} {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "/dev/mmcblk0"
|
||||
}
|
||||
|
||||
@ -1049,6 +1057,7 @@ proc ::rmupdate::download_firmware {{download_url ""} {version ""}} {
|
||||
write_install_log ""
|
||||
write_install_log "Download completed."
|
||||
|
||||
if {[regexp {.*\.zip$} $archive_file match]} {
|
||||
write_install_log "Extracting firmware %s.\nThis process takes some minutes, please be patient..." [file tail $archive_file]
|
||||
set data [exec /usr/bin/unzip -ql "${archive_file}" 2>/dev/null]
|
||||
set img_file ""
|
||||
@ -1063,6 +1072,9 @@ proc ::rmupdate::download_firmware {{download_url ""} {version ""}} {
|
||||
}
|
||||
exec /usr/bin/unzip "${archive_file}" "${img_file}" -o -d "${img_dir}" 2>/dev/null
|
||||
set img_file "${img_dir}/${img_file}"
|
||||
} else {
|
||||
set img_file $archive_file
|
||||
}
|
||||
#puts "${img_file} ${image_file}"
|
||||
if {$version == ""} {
|
||||
set image_file $img_file
|
||||
|
Loading…
x
Reference in New Issue
Block a user