From 73b3efaca3e982be4cb560b6ec6be9cddba843c1 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Sat, 24 Mar 2018 00:18:27 +0100 Subject: [PATCH] Check if firmware image is compressed --- addon/lib/rmupdate.tcl | 290 +++++++++++++++++++++-------------------- 1 file changed, 151 insertions(+), 139 deletions(-) diff --git a/addon/lib/rmupdate.tcl b/addon/lib/rmupdate.tcl index 1c8d403..4a03754 100644 --- a/addon/lib/rmupdate.tcl +++ b/addon/lib/rmupdate.tcl @@ -136,7 +136,7 @@ proc ::rmupdate::get_rpi_version {} { set revision_map(a32082) "rpi3" set revision_map(1a01041) "rpi3" set revision_map(a020d3) "rpi3" - + set fp [open /proc/cpuinfo r] set data [read $fp] foreach d [split $data "\n"] { @@ -255,7 +255,7 @@ proc ::rmupdate::get_partitions {{device ""}} { } else { set data [exec /sbin/fdisk -l] } - + set root_partuuid "" set fd [open "/proc/cmdline" r] set cmdline_data [read $fd] @@ -266,20 +266,20 @@ proc ::rmupdate::get_partitions {{device ""}} { break } } - + #set fd [open /etc/mtab r] #set mtab_data [read $fd] #close $fd - + set df_data [exec /bin/df -a -T] - + foreach d [split $data "\n"] { if {[regexp {Disk\s+(\S+):.*\s(\d+)\s+bytes} $d match dev size]} { set partitions(${dev}::0::partition) 0 set partitions(${dev}::0::disk_device) $dev set partitions(${dev}::0::model) "" set partitions(${dev}::0::size) $size - + set data2 "" catch {set data2 [exec /usr/sbin/parted $dev unit B print]} data2 foreach d2 [split $data2 "\n"] { @@ -302,7 +302,7 @@ proc ::rmupdate::get_partitions {{device ""}} { set partitions(${dev}::${num}::filesystem_used) -1 set partitions(${dev}::${num}::filesystem_avail) -1 set partitions(${dev}::${num}::filesystem_usage) -1 - + foreach f [glob /dev/disk/by-partuuid/*] { catch { if { [file tail [file readlink $f]] == [file tail $part_dev] } { @@ -311,7 +311,7 @@ proc ::rmupdate::get_partitions {{device ""}} { } } } - + set data3 [exec /sbin/blkid $part_dev] foreach d3 [split $data3 "\n"] { if {[regexp {LABEL="([^"]+)"} $d3 match lab]} { @@ -324,7 +324,7 @@ proc ::rmupdate::get_partitions {{device ""}} { set partitions(${dev}::${num}::filesystem_type) $type } } - + #foreach d4 [split $mtab_data "\n"] { # if { [regexp {^(\S+)\s+(\S+)\s+} $d4 match md mp] } { # if {$md == $part_dev} { @@ -336,7 +336,7 @@ proc ::rmupdate::get_partitions {{device ""}} { # } # } #} - + # Filesystem Type 1K-blocks Used Available Use% Mounted on # /dev/root ext4 991512 346288 577640 37% / foreach d4 [split $df_data "\n"] { @@ -436,27 +436,33 @@ proc ::rmupdate::update_cmdline {cmdline root} { set fd [open $cmdline r] set data [read $fd] close $fd - + regsub -all "root=\[a-zA-Z0-9\=/\-\]+ " $data "root=${root} " data - + set fd [open $cmdline w] puts $fd $data close $fd } 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,13 +472,15 @@ proc ::rmupdate::get_system_device {} { close $fd foreach d [split $data "\n"] { if { [regexp {root=PARTUUID=(\S+)} $d match partuuid] } { - set x [file readlink "/dev/disk/by-partuuid/${partuuid}"] - if { [regexp {(mmcblk.*)p\d} [file tail $x] match device] } { - set sys_dev "/dev/${device}" - return $sys_dev - } elseif { [regexp {(.*)\d} [file tail $x] match device] } { - set sys_dev "/dev/${device}" - return $sys_dev + 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}" + return $sys_dev + } elseif { [regexp {(.*)\d} [file tail $x] match device] } { + set sys_dev "/dev/${device}" + return $sys_dev + } } } } @@ -528,7 +536,7 @@ proc ::rmupdate::update_fstab {fstab {boot ""} {root ""} {user ""}} { append ndata "${d}\n" } close $fd - + set fd [open $fstab w] puts $fd $ndata close $fd @@ -536,12 +544,12 @@ proc ::rmupdate::update_fstab {fstab {boot ""} {root ""} {user ""}} { proc ::rmupdate::mount_image_partition {image partition mountpoint} { variable loop_dev - + write_log 3 "Mounting parition ${partition} of image ${image}." set p [get_partion_start_end_and_size $image $partition] write_log 4 "Partiton start=[lindex $p 0], size=[lindex $p 2]." - + file mkdir $mountpoint catch {exec /bin/umount "${mountpoint}"} catch {exec /sbin/losetup -d $loop_dev} @@ -553,7 +561,7 @@ proc ::rmupdate::mount_system_partition {partition mountpoint} { set sys_dev [get_system_device] set remount 1 set root_partition_number [get_current_root_partition_number] - + if {$partition == 1} { set partition "/boot" } elseif {$partition == 2 || $partition == 3} { @@ -566,17 +574,17 @@ proc ::rmupdate::mount_system_partition {partition mountpoint} { } elseif {$partition == 4} { set partition "/usr/local" } - + if {$remount} { write_log 3 "Remounting filesystem ${partition} (rw)." } else { write_log 3 "Mounting device ${partition} (rw)." } - + if {![file exists $mountpoint]} { file mkdir $mountpoint } - + if {$remount} { if {$partition != $mountpoint} { exec /bin/mount -o bind $partition "${mountpoint}" @@ -612,26 +620,26 @@ proc ::rmupdate::get_filesystem_size_and_usage {device_or_mountpoint} { proc ::rmupdate::check_sizes {image} { variable mnt_img variable mnt_sys - + write_install_log "Checking size of filesystems." - + file mkdir $mnt_img file mkdir $mnt_sys - + foreach partition [list 1 2] { mount_image_partition $image $partition $mnt_img mount_system_partition $partition $mnt_sys - + set su_new [get_filesystem_size_and_usage $mnt_img] set new_used [lindex $su_new 1] set su_cur [get_filesystem_size_and_usage $mnt_sys] set cur_size [lindex $su_cur 0] - + write_log 4 "Current filesystem (${partition}) size: ${cur_size}, new filesystem used bytes: ${new_used}." - + umount $mnt_img umount $mnt_sys - + if { [expr {$new_used*1.05}] > $cur_size && [expr {$new_used+50*1024*1024}] >= $cur_size } { #error "Current filesystem of partition $partition (${cur_size} bytes) not big enough (new usage: ${new_used} bytes)." error [format [i18n "Current filesystem of partition %d (%d bytes) not big enough (new usage: %d bytes)."] $partition $cur_size $new_used] @@ -644,15 +652,15 @@ proc ::rmupdate::update_filesystems {image {dryrun 0}} { variable log_level variable mnt_img variable mnt_sys - + set sys_dev [get_system_device] set root_partition_number [get_current_root_partition_number] - + write_install_log "Updating filesystems." - + file mkdir $mnt_img file mkdir $mnt_sys - + foreach img_partition [list 2 1] { set sys_partition $img_partition set mnt_s $mnt_sys @@ -663,10 +671,10 @@ proc ::rmupdate::update_filesystems {image {dryrun 0}} { set mnt_s "/boot" } write_install_log "Updating system partition %s." $sys_partition - + mount_image_partition $image $img_partition $mnt_img mount_system_partition $sys_partition $mnt_s - + if {$log_level >= 4} { write_log 4 "ls -la ${mnt_img}" write_log 4 [exec ls -la ${mnt_img}] @@ -694,7 +702,7 @@ proc ::rmupdate::update_filesystems {image {dryrun 0}} { write_log 4 "ls -la ${mnt_s}" write_log 4 [exec ls -la ${mnt_s}] } - + if {$img_partition == 1} { write_install_log "Updating boot configuration." if {!$dryrun} { @@ -712,7 +720,7 @@ proc ::rmupdate::update_filesystems {image {dryrun 0}} { } } } - + umount $mnt_img umount $mnt_s } @@ -720,14 +728,14 @@ proc ::rmupdate::update_filesystems {image {dryrun 0}} { proc ::rmupdate::move_userfs_to_device {target_device {sync_data 0} {repartition 0}} { variable mnt_sys - + set current [get_current_firmware_version] set versions [list $current "2.31.25.20180226"] set versions [lsort -decreasing -command compare_versions $versions] if {[lindex $versions 0] != $current} { # Old firmware needs udev patch exec /bin/mount -o remount,rw / - + set fd [open "/lib/udev/rules.d/usbmount.rules" "w"] puts $fd {ENV{ID_FS_LABEL}=="bootfs|rootfs|rootfs1|rootfs2|userfs", GOTO="END"} puts $fd {KERNEL=="sd*", DRIVERS=="sbp2", ACTION=="add", RUN+="/usr/share/usbmount/usbmount add"} @@ -737,31 +745,31 @@ proc ::rmupdate::move_userfs_to_device {target_device {sync_data 0} {repartition puts $fd {KERNEL=="ub*", ACTION=="remove", RUN+="/usr/share/usbmount/usbmount remove"} puts $fd {LABEL="END"} close $fd - + exec /bin/mount -o remount,ro / } - + if {![file exists $target_device]} { error [i18n "Target device does not exist."] } - + set target_partition_device "" if {[get_disk_device $target_device] != $target_device} { set target_partition_device $target_device set target_device [get_disk_device $target_partition_device] set repartition 0 } - + set source_partition_device [get_mounted_device "/usr/local"] set source_device [get_disk_device $source_partition_device] - + if {$source_partition_device == "" || $source_device == ""} { error [i18n "Failed to find source device for /usr/local."] } if {$source_device == $target_device} { error [i18n "Source and target are the same device."] } - + if {$target_partition_device == ""} { array set partitions [get_partitions $target_device] set keys [array names partitions] @@ -797,7 +805,7 @@ proc ::rmupdate::move_userfs_to_device {target_device {sync_data 0} {repartition } set target_partition_device [get_partition_device $target_device $partition_number] } - + if {$sync_data == 1} { catch { exec /bin/umount $target_partition_device } set exitcode [catch { exec /sbin/mkfs.ext4 -F -L userfs $target_partition_device } output] @@ -807,7 +815,7 @@ proc ::rmupdate::move_userfs_to_device {target_device {sync_data 0} {repartition # Write ReGaHSS state to disk load tclrega.so rega system.Save() - + file mkdir $mnt_sys exec /bin/mount $target_partition_device $mnt_sys #set shell_script "cd /usr/local; tar -c . | (cd $mnt_sys; tar -xv)" @@ -818,42 +826,42 @@ proc ::rmupdate::move_userfs_to_device {target_device {sync_data 0} {repartition error $output } } - + catch { exec /sbin/tune2fs -L 0userfs $source_partition_device } catch { exec /sbin/tune2fs -L userfs $target_partition_device } } proc ::rmupdate::clone_system {target_device {activate_clone 0}} { variable mnt_sys - + if {![file exists $target_device]} { error [i18n "Target device does not exist."] } - + set source_device [get_system_device] if { $source_device == $target_device} { error [i18n "Source and target are the same device."] } - - + + exec /bin/mount -o remount,rw / exec /bin/sed -i s/ENABLED=1/ENABLED=0/ /etc/usbmount/usbmount.conf exec /bin/mount -o remount,ro / - + file mkdir $mnt_sys catch { exec /bin/umount $mnt_sys } catch { exec /bin/umount [get_partition_device $target_device 1] } catch { exec /bin/umount [get_partition_device $target_device 2] } catch { exec /bin/umount [get_partition_device $target_device 3] } catch { exec /bin/umount [get_partition_device $target_device 4] } - + set data [exec /bin/mount] foreach d [split $data "\n"] { if {[regexp {$target_device} $d match]} { error [i18n "Target is mounted."] } } - + set p [get_partion_start_end_and_size $source_device 1] set start1 [lindex $p 0] set end1 [lindex $p 1] @@ -865,7 +873,7 @@ proc ::rmupdate::clone_system {target_device {activate_clone 0}} { set end3 [lindex $p 1] set p [get_partion_start_end_and_size $source_device 4] set start4 [lindex $p 0] - + set exitcode [catch { exec /usr/sbin/parted --script ${target_device} \ mklabel msdos \ @@ -878,7 +886,7 @@ proc ::rmupdate::clone_system {target_device {activate_clone 0}} { if { $exitcode != 0 && $exitcode != 1 } { error $output } - + set exitcode [catch { exec /sbin/mkfs.vfat -F32 -n bootfs [get_partition_device $target_device 1] } output] if { $exitcode != 0} { error $output @@ -895,15 +903,15 @@ proc ::rmupdate::clone_system {target_device {activate_clone 0}} { if { $exitcode != 0 && $exitcode != 1 } { error $output } - + set source_uuid [get_part_uuid $source_device 2] set target_uuid [get_part_uuid $target_device 2] - + #catch { exec /bin/umount [get_partition_device $target_device 1] } #catch { exec /bin/umount [get_partition_device $target_device 2] } #catch { exec /bin/umount [get_partition_device $target_device 3] } #catch { exec /bin/umount [get_partition_device $target_device 4] } - + exec /bin/mount [get_partition_device $target_device 1] $mnt_sys set shell_script "cd /boot; tar -c . | (cd $mnt_sys; tar -xv)" set exitcode [catch { exec /bin/sh -c $shell_script } output] @@ -915,7 +923,7 @@ proc ::rmupdate::clone_system {target_device {activate_clone 0}} { if { $exitcode != 0 && $exitcode != 1 } { error $output } - + for {set p 2} {$p <= 3} {incr p} { exec /bin/mount [get_partition_device $target_device $p] $mnt_sys set shell_script "cd /; tar -c --exclude=boot/* --exclude=usr/local/* --exclude=tmp/* --exclude=proc/* --exclude=sys/* --exclude=run/* . | (cd $mnt_sys; tar -xv)" @@ -926,11 +934,11 @@ proc ::rmupdate::clone_system {target_device {activate_clone 0}} { error "$output $exitcode" } } - + # Write ReGaHSS state to disk load tclrega.so rega system.Save() - + exec /bin/mount [get_partition_device $target_device 4] $mnt_sys set shell_script "cd /usr/local; tar -c . | (cd $mnt_sys; tar -xv)" set exitcode [catch { exec /bin/sh -c $shell_script } output] @@ -938,18 +946,18 @@ proc ::rmupdate::clone_system {target_device {activate_clone 0}} { if { $exitcode != 0 && $exitcode != 1 } { error $output } - + if {$activate_clone == 1} { # Relabel ext4 filesystems catch { exec tune2fs -L 0rootfs1 [get_partition_device $source_device 2] } catch { exec tune2fs -L 0rootfs2 [get_partition_device $source_device 3] } catch { exec tune2fs -L 0userfs [get_partition_device $source_device 4] } - + # Recreate old boot fs with new label (util to relabel fat32 missing) exec /bin/umount [get_partition_device $source_device 1] exec /sbin/mkfs.vfat -n 0bootfs [get_partition_device $source_device 1] exec /bin/mount [get_partition_device $source_device 1] /boot - + exec /bin/mount [get_partition_device $target_device 1] $mnt_sys set shell_script "cd $mnt_sys; tar -c . | (cd /boot; tar -xv)" set exitcode [catch { exec /bin/sh -c $shell_script } output] @@ -957,11 +965,11 @@ proc ::rmupdate::clone_system {target_device {activate_clone 0}} { if { $exitcode != 0 && $exitcode != 1 } { error $output } - + # Update boot config for cloned system update_cmdline "/boot/cmdline.txt" "PARTUUID=${source_uuid}" } - + exec /bin/mount -o remount,rw / exec /bin/sed -i s/ENABLED=0/ENABLED=1/ /etc/usbmount/usbmount.conf exec /bin/mount -o remount,ro / @@ -1017,7 +1025,7 @@ proc ::rmupdate::get_latest_firmware_version {} { proc ::rmupdate::download_firmware {{download_url ""} {version ""}} { variable img_dir variable install_log - + if {$version == ""} { set image_file "${img_dir}/RaspberryMatic-${version}.img" } else { @@ -1045,24 +1053,28 @@ proc ::rmupdate::download_firmware {{download_url ""} {version ""}} { } else { exec /usr/bin/wget "${download_url}" --no-check-certificate --quiet --output-document=$archive_file } - + write_install_log "" write_install_log "Download completed." - - 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 "" - foreach d [split $data "\n"] { - regexp {\s+(\S+\.img)\s*$} $d match img_file - if { $img_file != "" } { - break + + 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 "" + foreach d [split $data "\n"] { + regexp {\s+(\S+\.img)\s*$} $d match img_file + if { $img_file != "" } { + break + } } + if { $img_file == "" } { + error [i18n "Failed to extract firmware image from archive."] + } + 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 } - if { $img_file == "" } { - error [i18n "Failed to extract firmware image from archive."] - } - exec /usr/bin/unzip "${archive_file}" "${img_file}" -o -d "${img_dir}" 2>/dev/null - set img_file "${img_dir}/${img_file}" #puts "${img_file} ${image_file}" if {$version == ""} { set image_file $img_file @@ -1091,13 +1103,13 @@ proc ::rmupdate::get_version_from_filename {filename} { proc ::rmupdate::get_firmware_info {} { variable release_url variable support_file_url - + set data [exec /usr/bin/wget "${support_file_url}" --no-check-certificate -q -O-] if { ! [regexp {\"latest_supported_version\"\s*:\s*\"([^\"]+)\"} $data match latest_supported_version] } { write_log 1 "Failed to get latest supported version from ${support_file_url}" return "\[\]" } - + set current [get_current_firmware_version] set versions [list $current] foreach e [get_available_firmware_downloads] { @@ -1115,7 +1127,7 @@ proc ::rmupdate::get_firmware_info {} { } } set versions [lsort -decreasing -command compare_versions $versions] - + set json "\[" set latest "true" foreach v $versions { @@ -1145,9 +1157,9 @@ proc ::rmupdate::get_firmware_info {} { proc ::rmupdate::set_running_installation {installation_info} { variable install_lock variable install_log - + write_log 4 "Set running installation: ${installation_info}" - + foreach var {install_log install_lock} { set var [set $var] if {$var != ""} { @@ -1157,13 +1169,13 @@ proc ::rmupdate::set_running_installation {installation_info} { } } } - + if {$installation_info != ""} { set fd [open $install_lock "w"] puts $fd [pid] puts $fd $installation_info close $fd - + if {[file exists $install_log]} { write_log 4 "Deleting: ${install_log}" file delete $install_log @@ -1175,23 +1187,23 @@ proc ::rmupdate::set_running_installation {installation_info} { proc ::rmupdate::get_running_installation {} { variable install_lock - + if {! [file exists $install_lock]} { return "" } - + set fp [open $install_lock "r"] set data [read $fp] close $fp - + set tmp [split $data "\n"] set lpid [string trim [lindex $tmp 0]] set installation_info [string trim [lindex $tmp 1]] - + if {[file exists "/proc/${lpid}"]} { return $installation_info } - + write_log 4 "Deleting: ${install_lock}" file delete $install_lock return "" @@ -1214,7 +1226,7 @@ proc ::rmupdate::install_firmware {{download_url ""} {version ""} {lang ""} {reb if {! [is_system_upgradeable]} { error [i18n "System not upgradeable."] } - + set firmware_image "" if {$version == ""} { set_running_installation "Firmware unknown" @@ -1228,29 +1240,29 @@ proc ::rmupdate::install_firmware {{download_url ""} {version ""} {lang ""} {reb } } } - + if {$firmware_image == ""} { set firmware_image [download_firmware $download_url $version] } - + get_system_device check_sizes $firmware_image update_filesystems $firmware_image $dryrun - + if {$version == ""} { file delete $firmware_image } elseif {!$keep_download && !$dryrun} { file delete $firmware_image } - + set_running_installation "" - + if {$reboot && !$dryrun} { write_install_log "System will reboot now." } - + after 5000 - + if {$reboot && !$dryrun} { exec /sbin/reboot } @@ -1265,10 +1277,10 @@ proc ::rmupdate::install_latest_version {{reboot 1} {dryrun 0}} { proc ::rmupdate::is_firmware_up_to_date {} { set latest_version [get_latest_firmware_version] write_install_log "Latest firmware version: %s" $latest_version - + set current_version [get_current_firmware_version] write_install_log "Installed firmware version: ${current_version}" - + if {[compare_versions $current_version $latest_version] >= 0} { return 1 } @@ -1401,7 +1413,7 @@ proc ::rmupdate::get_addon_info {{fetch_available_version 0} {fetch_download_url } } } - + if {$as_json == 1} { return [array_to_json [array get addons]] } else { @@ -1411,48 +1423,48 @@ proc ::rmupdate::get_addon_info {{fetch_available_version 0} {fetch_download_url proc ::rmupdate::uninstall_addon {addon_id} { variable rc_dir - + if {[get_running_installation] != ""} { error [i18n "Another install process is running."] } - + set_running_installation "Addon ${addon_id}" - + write_log 3 "Uninstalling addon" if { [catch { exec "${rc_dir}/${addon_id}" uninstall } errormsg] } { write_log 2 "${rc_dir}/${addon_id} uninstall failed: ${errormsg}" } - + write_log 3 "Addon ${addon_id} successfully uninstalled" - + set_running_installation "" - + return [format [i18n "Addon %s successfully uninstalled."] $addon_id] } proc ::rmupdate::install_addon {{addon_id ""} {download_url ""}} { variable rc_dir - + if {[get_running_installation] != ""} { error [i18n "Another install process is running."] } - + if {$addon_id != ""} { array set addon [get_addon_info 1 1 0 $addon_id] set download_url $addon(${addon_id}::download_url) } - + if {$download_url == ""} { error [i18n "Download url missing."] } if {$addon_id == ""} { set addon_id "unknown" } - + set_running_installation "Addon ${addon_id}" - + set archive_file "" regexp {^file://(.*)$} $download_url match archive_file if { [info exists archive_file] && $archive_file != "" } { @@ -1465,17 +1477,17 @@ proc ::rmupdate::install_addon {{addon_id ""} {download_url ""}} { } exec /usr/bin/wget "${download_url}" --no-check-certificate --quiet --output-document=$archive_file } - + write_log 3 "Extracting archive ${archive_file}." set tmp_dir "/tmp/rmupdate_addon_install_${addon_id}" if {[file exists $tmp_dir]} { file delete -force $tmp_dir } file mkdir $tmp_dir - + cd $tmp_dir exec /bin/tar xzvf "${archive_file}" - + write_log 3 "Running update_script" file attributes update_script -permissions 0755 if { [catch { @@ -1483,23 +1495,23 @@ proc ::rmupdate::install_addon {{addon_id ""} {download_url ""}} { } errormsg] } { write_log 2 "Addon update_script failed: ${errormsg}" } - + cd /tmp - + file delete -force $tmp_dir file delete $archive_file - + write_log 3 "Restarting addon" if { [catch { exec "${rc_dir}/${addon_id}" restart } errormsg] } { write_log 2 "Addon restart failed: ${errormsg}" } - + write_log 3 "Addon ${addon_id} successfully installed" - + set_running_installation "" - + return [format [i18n "Addon %s successfully installed."] $addon_id] } @@ -1535,7 +1547,7 @@ proc ::rmupdate::wlan_scan {{as_json 0} {device "wlan0"}} { set ssids(${cur_ssid}::ssid) $cur_ssid set ssids(${cur_ssid}::signal) $cur_signal } - + if {$as_json == 1} { return [array_to_json [array get ssids]] } else { @@ -1570,7 +1582,7 @@ proc ::rmupdate::wlan_connect {ssid {password ""}} { } puts $fd "\}" close $fd - + catch { exec /sbin/ifdown wlan0 } catch { exec /sbin/ifup wlan0 } } @@ -1580,7 +1592,7 @@ proc ::rmupdate::wlan_disconnect {} { puts $fd "ctrl_interface=/var/run/wpa_supplicant" puts $fd "ap_scan=1" close $fd - + catch { exec /sbin/ifdown wlan0 } catch { exec /sbin/ifup wlan0 } }