From: Jo-Philipp Wich Date: Sat, 9 May 2009 03:28:40 +0000 (+0000) Subject: luci-0.8: merge r4482 - r4487 X-Git-Tag: 0.8.7~46 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=667d88fb277b4ecb9d6adea67e8373e7dc70344d;p=oweals%2Fluci.git luci-0.8: merge r4482 - r4487 --- diff --git a/build/i18n-html2lua.pl b/build/i18n-html2lua.pl new file mode 100755 index 000000000..c6b893eee --- /dev/null +++ b/build/i18n-html2lua.pl @@ -0,0 +1,48 @@ +#!/usr/bin/perl + +@ARGV || die "Usage: $0 template1.htm [... templateN.htm]\n"; + + +my %tags; + +foreach my $file ( @ARGV ) +{ + if( open F, "< $file" ) + { + local $/ = undef; + + my $data = ; + + while( $data =~ m/ <%: -? (\w+) (.*?) %> /sgx ) + { + my ( $key, $val ) = ( $1, $2 ); + + if( $key && $val ) + { + $val =~ s/\s+/ /sg; + $val =~ s/^\s+//; + $val =~ s/\s+$//; + + $tags{$key} = $val; + } + else + { + $tags{$key} ||= ''; + } + } + + close F; + } +} + +foreach my $key ( sort keys %tags ) +{ + if( $val =~ /'/ ) + { + printf "%s = [[%s]]\n", $key, $tags{$key}; + } + else + { + printf "%s = '%s'\n", $key, $tags{$key}; + } +} diff --git a/i18n/english/luasrc/i18n/admin-core.en.lua b/i18n/english/luasrc/i18n/admin-core.en.lua index 37dab9e12..7967f72cf 100644 --- a/i18n/english/luasrc/i18n/admin-core.en.lua +++ b/i18n/english/luasrc/i18n/admin-core.en.lua @@ -37,7 +37,6 @@ a_s_changepw = 'Admin Password' a_s_p_ipkg = 'OPKG-Configuration' a_s_sshkeys = 'SSH-Keys' a_s_fstab = 'Mount Points' -a_s_flash = 'Flash Firmware' a_s_i_system1 = 'Change settings related to the system itself, its identification, installed hard- and software, authentication or mount points.' a_s_i_system2 = 'These settings define the base of your system.' a_s_i_system3 = 'Pay attention as any misconfiguration here may prevent your device from booting or may lock yourself out of it.' @@ -125,15 +124,6 @@ a_s_fstab_mountpoint = 'Mount Point' a_s_fstab_device1 = 'The device file of the memory or partition (e.g. /dev/sda1)' a_s_fstab_fs1 = 'The filesystem that was used to format the memory (e.g. ext3)' a_s_fstab_swap1 = 'If your physical memory is insufficient unused data can be temporarily swapped to a swap-device resulting in a higher amount of usable RAM. Be aware that swapping data is a very slow process as the swap-device cannot be accessed with the high datarates of the RAM.' -a_s_flash_flashed = 'Firmware successfully flashed. Rebooting device...' -a_s_flash_flasherr = 'Failed to flash' -a_s_flash_fwimage = 'Firmware image' -a_s_flash_received = 'Image received. About to start flashing process. DO NOT POWER OFF THE DEVICE!' -a_s_flash_inprogress = 'Writing firmware...' -a_s_flash_fwupgrade = 'Flash Firmware' -a_s_flash_keepcfg = 'Keep configuration files' -a_s_flash_notimplemented = 'Sorry, this function is not (yet) available for your platform.' -a_s_flash_upgrade1 = 'Replaces the installed firmware with a new one. The firmware format is platform-dependent.' a_s_reboot1 = 'Reboots the operating system of your device' a_s_reboot_do = 'Perform reboot' a_s_reboot_running = 'Please wait: Device rebooting...' @@ -384,3 +374,16 @@ hostnames_hostname = 'Hostname' hostnames_address = 'IP address' m_n_mssfix = 'Clamp Segment Size' m_n_mssfix_desc = 'Fixes problems with unreachable websites, submitting forms or other unexpected behaviour for some ISPs.' +admin_upgrade = 'Flash Firmware' +admin_upgrade_badimage = 'The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.' +admin_upgrade_checksum = 'Checksum' +admin_upgrade_desc = 'Upload an OpenWrt image file to reflash the device.' +admin_upgrade_filesize = 'Size' +admin_upgrade_fwimage = 'Firmware image' +admin_upgrade_keepcfg = 'Keep configuration files' +admin_upgrade_nosupport = 'Sorry. OpenWrt does not support a system upgrade on this platform.
You need to manually flash your device.' +admin_upgrade_running = 'The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.' +admin_upgrade_spaceavail = ' (%s available)' +admin_upgrade_toolarge = 'It appears that you try to flash an image that does not fit into the flash memory, please verify the image file!' +admin_upgrade_upload = 'Upload image' +admin_upgrade_uploaded = 'The flash image was uploaded. Below is the checksum and file size listed, compare them with the original file to ensure data integrity.
Click "Proceed" below to start the flash procedure.' diff --git a/i18n/english/luasrc/i18n/default.en.lua b/i18n/english/luasrc/i18n/default.en.lua index d923a88fc..21d43fd82 100644 --- a/i18n/english/luasrc/i18n/default.en.lua +++ b/i18n/english/luasrc/i18n/default.en.lua @@ -12,6 +12,7 @@ essentials = 'Essentials' apply = 'Apply' basicsettings = 'Basic Settings' broadcast = 'IPv4-Broadcast' +cancel = 'Cancel' changes = 'Changes' channel = 'Channel' cidr6 = 'CIDR-Notation: address/prefix' @@ -71,6 +72,7 @@ password = 'Password' path = 'Path' port = 'Port' ports = 'Ports' +proceed = 'Proceed' protocol = 'Protocol' reboot = 'Reboot' reset = 'Reset' diff --git a/i18n/french/luasrc/i18n/admin-core.fr.lua b/i18n/french/luasrc/i18n/admin-core.fr.lua index a4789a035..773848661 100644 --- a/i18n/french/luasrc/i18n/admin-core.fr.lua +++ b/i18n/french/luasrc/i18n/admin-core.fr.lua @@ -37,7 +37,6 @@ a_s_changepw = 'Mot de passe administrateur' a_s_p_ipkg = 'Configuration OPKG' a_s_sshkeys = 'Clés SSH' a_s_fstab = 'Points de montage' -a_s_flash = 'Mise à jour firmware' a_s_i_system1 = 'Changements en rapport avec le système, son identification le logiciel/matériel installé, l'authentification ou points de montage.' a_s_i_system2 = 'Ces réglages définissent la base de votre système.' a_s_i_system3 = 'Soyez vigilent car un mauvais réglage peut empêcher votre équipement de démarrer, ou vous empêcher de vous y connecter.' @@ -66,15 +65,6 @@ a_s_fstab_mountpoint = 'Point de montage' a_s_fstab_device1 = 'Le périphérique de bloc contenant la partition (ex : /dev/sda1)' a_s_fstab_fs1 = 'Le système de fichiers utilisé pour formatter le support de stockage (ex : ext3)' a_s_fstab_swap1 = 'Si la mémoire physique n'est pas en quantité suffisante, les données inutilisées peuvent être temporairement transférée sur une partition d'échange, relevant la quantité de RAM disponible. Ce processus est lent car la mémoire d'échange ne peut être accédée aux taux de transfert de la RAM.' -a_s_flash_flashed = 'Firmware installé avec succès. Redémarrage...' -a_s_flash_flasherr = 'Programme lors de la programmation' -a_s_flash_fwimage = 'Image firmware' -a_s_flash_received = 'Image reçue. Début du processus de flashage. NE PAS ETEINDRE L'EQUIPEMENT !' -a_s_flash_inprogress = 'Ecriture du firmware...' -a_s_flash_fwupgrade = 'Mise à jour firmware' -a_s_flash_keepcfg = 'Conserver les fichiers de configuration' -a_s_flash_notimplemented = 'Désolé, cette fonction n'est pas (encore) disponible pour votre plateforme.' -a_s_flash_upgrade1 = 'Remplace les fichiers existants par les nouveaux. Le format du firmware est dépendant de la plateforme.' a_s_reboot1 = 'Redémarrage du système d'exploitation de votre équipement' a_s_reboot_do = 'Redémarrer' a_s_reboot_running = 'Patientez s'il vous plaît: équipement en cours de redémarrage...' @@ -325,3 +315,16 @@ hostnames_address = 'Adresse IP' network_interface_encaps = 'PPPoA Encapsulation' m_n_mssfix = "Clamp Segment Size" m_n_mssfix_desc = "Fixes problems with unreachable websites, submitting forms or other unexpected behaviour for some ISPs." +admin_upgrade = 'Flash Firmware' +admin_upgrade_badimage = 'The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.' +admin_upgrade_checksum = 'Checksum' +admin_upgrade_desc = 'Upload an OpenWrt image file to reflash the device.' +admin_upgrade_filesize = 'Size' +admin_upgrade_fwimage = 'Firmware image' +admin_upgrade_keepcfg = 'Keep configuration files' +admin_upgrade_nosupport = 'Sorry. OpenWrt does not support a system upgrade on this platform.
You need to manually flash your device.' +admin_upgrade_running = 'The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.' +admin_upgrade_spaceavail = ' (%s available)' +admin_upgrade_toolarge = 'It appears that you try to flash an image that does not fit into the flash memory, please verify the image file!' +admin_upgrade_upload = 'Upload image' +admin_upgrade_uploaded = 'The flash image was uploaded. Below is the checksum and file size listed, compare them with the original file to ensure data integrity.
Click "Proceed" below to start the flash procedure.' diff --git a/i18n/french/luasrc/i18n/default.fr.lua b/i18n/french/luasrc/i18n/default.fr.lua index 8d9fa1045..f86721319 100644 --- a/i18n/french/luasrc/i18n/default.fr.lua +++ b/i18n/french/luasrc/i18n/default.fr.lua @@ -9,6 +9,7 @@ essentials = 'Essentiel' apply = 'Appliquer' basicsettings = 'Paramètres de base' broadcast = 'Broadcast IPv4' +cancel = 'Annuler' changes = 'Changements' channel = 'Canal' cidr6 = 'Notation CIDR : adresse/prefixe' @@ -68,6 +69,7 @@ password = 'Mot de passe' path = 'Chemin' port = 'Port' ports = 'Ports' +proceed = 'Continuer' protocol = 'Protocole' reboot = 'Redémarrage' reset = 'Remise à zéro' diff --git a/i18n/german/luasrc/i18n/admin-core.de.lua b/i18n/german/luasrc/i18n/admin-core.de.lua index 970fdbe0c..7bd1ec424 100644 --- a/i18n/german/luasrc/i18n/admin-core.de.lua +++ b/i18n/german/luasrc/i18n/admin-core.de.lua @@ -43,16 +43,6 @@ a_s_changepw1 = 'Ändert das Passwort des Systemverwalters (Benutzer "root& a_s_changepw_changed = 'Passwort erfolgreich geändert' a_s_changepw_nomatch = 'Passwörter stimmen nicht überein' a_s_desc = 'An dieser Stelle können Grundeinstellungen des Systems wie Hostname oder Zeitzone vorgenommen werden.' -a_s_flash = 'Upgrade' -a_s_flash_flashed = 'Flashvorgang erfolgreich. Router startet neu...' -a_s_flash_flasherr = 'Flashvorgang fehlgeschlagen' -a_s_flash_fwimage = 'Firmwareimage' -a_s_flash_received = 'Abbild empfangen. Starte Flashvorgang. SCHALTEN SIE DAS GERÄT NICHT AUS!' -a_s_flash_inprogress = 'Schreibe Firmware...' -a_s_flash_fwupgrade = 'Firmware aktualisieren' -a_s_flash_keepcfg = 'Konfigurationsdateien übernehmen' -a_s_flash_notimplemented = 'Diese Funktion steht leider (noch) nicht zur Verfügung.' -a_s_flash_upgrade1 = 'Ersetzt die installierte Firmware (das Betriebssystem des Routers) durch ein neues. Das Format der Firmware ist plattformabhängig.' a_s_fstab = 'Einhängepunkte' a_s_fstab_active = 'Eingehängte Dateisysteme' a_s_fstab_used = 'Benutzt' @@ -344,3 +334,16 @@ luci_components = "LuCI Komponenten" m_n_mssfix = "Segmentgrößen Clamping" m_n_mssfix_desc = "Behebt Probleme bei nicht erreichbaren Webseiten, Absenden von Formularen oder anderes unerwartetes Verhalten für einige ISPs." dhcp_desc = 'Mit DHCP können Netzwerkteilnehmer automatisch Einstellungen wie IP-Adresse, Präfix, DNS-Server, usw. beziehen.' +admin_upgrade = 'Firmware Flash' +admin_upgrade_badimage = 'Das hochgeladene Firmware-Image hat ein nicht unterstütztes Format. Stellen Sie sicher dass Sie das generische Format für Ihre Platform gewählt haben.' +admin_upgrade_checksum = 'Prüfsumme' +admin_upgrade_desc = 'Firmware-Image hochladen um das Gerät neu zu flaschen' +admin_upgrade_filesize = 'Größe' +admin_upgrade_fwimage = 'Firmware-Image' +admin_upgrade_keepcfg = 'Konfigurationsdateien erhalten' +admin_upgrade_nosupport = 'Sorry. OpenWrt unterstützt kein Systemupdate auf dieser Platform.
Sie müssen das Gerät manuell neu flashen.' +admin_upgrade_running = 'Der Flashvorgang läuft jetzt.
SCHALTEN SIE NICHT DEN STROM AUS!
Warten Sie einige Minuten bis das Gerät wieder erreichbar ist. Je nach Konfiguration ist es notwendig, dass Sie auf Ihrem Computer eine neue IP-Adresse beziehen müssen um auf das Gerät zugreifen zu können.' +admin_upgrade_spaceavail = ' (%s verfügbar)' +admin_upgrade_toolarge = 'Das verwendete Image scheint zu groß für den internen Flash-Speicher zu sein. Überprüfen Sie die Imagedatei!' +admin_upgrade_upload = 'Image hochladen' +admin_upgrade_uploaded = 'Das Firmware-Image wurde hochgeladen. Nachfolgend steht die Prüfsumme und Größe der Datei, vergleichen Sie diese mit ihrer Originaldatei um sicherzustellen dass das Image fehlerfrei ist.
Klicken Sie auf "Fortfahren" um den Flashvorgang zu starten.' diff --git a/i18n/german/luasrc/i18n/default.de.lua b/i18n/german/luasrc/i18n/default.de.lua index 238cba56e..c0a99dfbf 100644 --- a/i18n/german/luasrc/i18n/default.de.lua +++ b/i18n/german/luasrc/i18n/default.de.lua @@ -12,6 +12,7 @@ apply = 'Anwenden' back = 'zurück' basicsettings = 'Grundeinstellungen' broadcast = 'IPv4-Broadcast' +cancel = 'Abbrechen' changes = 'Änderungen' channel = 'Kanal' cidr6 = 'CIDR-Notation: Adresse/Prefix' @@ -71,6 +72,7 @@ password = 'Passwort' path = 'Pfad' port = 'Port' ports = 'Ports' +proceed = 'Fortfahren' protocol = 'Protokoll' reboot = 'Neu Starten' reset = 'Zurücksetzen' diff --git a/i18n/greek/luasrc/i18n/admin-core.el.lua b/i18n/greek/luasrc/i18n/admin-core.el.lua index a7a4787f4..8638d24c8 100644 --- a/i18n/greek/luasrc/i18n/admin-core.el.lua +++ b/i18n/greek/luasrc/i18n/admin-core.el.lua @@ -37,7 +37,6 @@ a_s_changepw = 'Κωδικός Διαχειριστή' a_s_p_ipkg = 'Παραμετροποίηση OPKG' a_s_sshkeys = 'Κλειδιά SSH' a_s_fstab = 'Σημεία Προσάρτησης' -a_s_flash = 'Φλασάρισμα Firmware' a_s_i_system1 = 'Αλλαγή ρυθμίσεων σχετικών με το σύστημα, την ταυτότητά του, το εγκατεστημένο υλικό και λογισμικό, την εξουσιοδότηση ή τα σημεία προσάρτησης.' a_s_i_system2 = 'Αυτές οι ρυθμίσεις ορίζουν τη βάση του συστήματος.' a_s_i_system3 = 'Δώστε ιδιαίτερη προσοχή γιατί οποιαδήποτε λάθος ρύθμιση εδώ μπορεί να αποτρέψει την συσκευή σας από το να εκκινήσει ή μπορεί να κλειδώσετε τον εαυτό σας έξω.' @@ -144,15 +143,6 @@ a_s_fstab_mountpoint = 'Σημείο Προσάρτησης' a_s_fstab_device1 = 'Το αρχείο συσκευής της μνήμης ή του διαμέρισματος (π.χ. /dev/sda1)' a_s_fstab_fs1 = 'Το σύστημα αρχείων που χρησιμοποιήθηκε για διαμόρφωση (π.χ. ext3)' a_s_fstab_swap1 = 'Αν η φυσική μνήμη δεν είναι αρκετή, μη-χρησιμοποιούμενα δεδομένα μπορούν προσωρινά να εναλλάσσονται σε μία συσκευή swap με αποτέλεσμα περισσότερη ενεργή RAM. Η εναλλαγή δεδομένων είναι μία πολύ αργή διαδικασία αφού η συσκευή swap δεν μπορεί να προσπελαστεί με τους υψηλούς ρυθμούς μεταφοράς δεδομένων που διαθέτει η RAM.' -a_s_flash_flashed = 'Το Firmware φλασαρίστηκε με επιτυχίας. Επανεκκίνηση συσκευής...' -a_s_flash_flasherr = 'Αποτυχία φλασαρίσματος' -a_s_flash_fwimage = 'Εικόνα Firmware' -a_s_flash_received = 'Εικόνα ελήφθη. Πρόκειται να ξεκινήσει η διαδικασία φλασαρίσματος. ΜΗ ΣΒΗΣΕΤΕ ΤΗ ΣΥΣΚΕΥΗ!' -a_s_flash_inprogress = 'Φλασάρισμα firmware...' -a_s_flash_fwupgrade = 'Φλασάρισμα Firmware' -a_s_flash_keepcfg = 'Διατήρηση αρχείων παραμετροποίησης' -a_s_flash_notimplemented = 'Συγνώμη, αυτή η λειτουργία (ακόμη) δεν είναι διαθέσιμη για την πλατφόρμα σας.' -a_s_flash_upgrade1 = 'Αντικαθιστά το εγκατεστημένο firmware με ένα νέο. Η μορφή του firmware εξαρτάται από την πλατφόρμα.' a_s_reboot1 = 'Επανεκκίνηση του λειτουργικού συστήματος της συσκευής σας' a_s_reboot_do = 'Εκτέλεση επανεκκίνησης' a_s_reboot_running = 'Παρακαλώ περιμένετε: Η συσκευή επανεκκινεί...' @@ -408,3 +398,16 @@ hostnames_address = 'Διεύθυνση IP' m_n_mssfix = 'Μέγεθος Τμήματος Τεμαχισμού' m_n_mssfix_desc = 'Επιλύει προβλήματα με μη-προσβάσιμους ιστοχώρους, την υποβολή φορμών ή άλλες απροσδόκητες συμπεριφορές κάποιων ISP.' luci_components = 'Συστατικά LuCI' +admin_upgrade = 'Flash Firmware' +admin_upgrade_badimage = 'The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.' +admin_upgrade_checksum = 'Checksum' +admin_upgrade_desc = 'Upload an OpenWrt image file to reflash the device.' +admin_upgrade_filesize = 'Size' +admin_upgrade_fwimage = 'Firmware image' +admin_upgrade_keepcfg = 'Keep configuration files' +admin_upgrade_nosupport = 'Sorry. OpenWrt does not support a system upgrade on this platform.
You need to manually flash your device.' +admin_upgrade_running = 'The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.' +admin_upgrade_spaceavail = ' (%s available)' +admin_upgrade_toolarge = 'It appears that you try to flash an image that does not fit into the flash memory, please verify the image file!' +admin_upgrade_upload = 'Upload image' +admin_upgrade_uploaded = 'The flash image was uploaded. Below is the checksum and file size listed, compare them with the original file to ensure data integrity.
Click "Proceed" below to start the flash procedure.' diff --git a/i18n/greek/luasrc/i18n/default.el.lua b/i18n/greek/luasrc/i18n/default.el.lua index 8f30c35f9..c61d9e1ef 100644 --- a/i18n/greek/luasrc/i18n/default.el.lua +++ b/i18n/greek/luasrc/i18n/default.el.lua @@ -12,6 +12,7 @@ essentials = 'Βασικά' apply = 'Εφαρμογή' basicsettings = 'Βασικές Ρυθμίσεις' broadcast = 'IPv4-Broadcast' +cancel = 'Cancel' changes = 'Αλλαγές' channel = 'Κανάλι' cidr6 = 'Παράσταση CIDR: διεύθυνση/πρόθεμα' @@ -69,6 +70,7 @@ overview = 'Επισκόπηση' packagemanager = 'Διαχειριστής Πακέτων' password = 'Κωδικός Πρόσβασης' path = 'Διαδρομή' +proceed 'Proceed' port = 'Θύρα' ports = 'Θύρες' protocol = 'Πρωτόκολλο' diff --git a/i18n/italian/luasrc/i18n/admin-core.it.lua b/i18n/italian/luasrc/i18n/admin-core.it.lua index 2a627880c..4d18aa414 100644 --- a/i18n/italian/luasrc/i18n/admin-core.it.lua +++ b/i18n/italian/luasrc/i18n/admin-core.it.lua @@ -37,7 +37,6 @@ a_s_changepw = 'Password di Amministratore' a_s_p_ipkg = 'Configurazione di OPKG' a_s_sshkeys = 'Chiavi SSHs' a_s_fstab = 'Punti di mount' -a_s_flash = 'Aggiorna firmware' a_s_i_system1 = 'Modifica impostazioni relative al sistema, la sua identificazione, installazioni hardware e software, autenticazione o punti di mount.' a_s_i_system2 = 'Queste impostazioni definiscono la base del tuo sistema.' a_s_i_system3 = 'Fai attenzione perchè una cattiva configurazione qui può impedire al tuo dispositivo di avviarsi o impedirti di entrarvi.' @@ -66,15 +65,6 @@ a_s_fstab_mountpoint = 'Punto di mount' a_s_fstab_device1 = 'Il file del dispositivo di memoria o della partizione (e.s. /dev/sda1)' a_s_fstab_fs1 = 'Il filesystem usato per formattare la memoria (e.s. ext3)' a_s_fstab_swap1 = 'Se la tua memoria è insufficiente i dati non usati possono venire temporaneamente spostati in un'area di swap risultando in un più grande quantitativo di RAM usabile. Sappi che spostare dati in swap è un processo molto lento e che il dispositivo di swap non può essere acceduto alle alte velocità della RAM.' -a_s_flash_flashed = 'Firmware aggiornato con successo. Riavvio il dispositivo...' -a_s_flash_flasherr = 'Aggiornamento fallito' -a_s_flash_fwimage = 'Firmware image' -a_s_flash_received = 'Firmware ricevuto. Mi preparo ad aggiornare il dispositivo. NON SPEGNERE IL DISPOSITIVO!' -a_s_flash_inprogress = 'Scrivendo il firmware...' -a_s_flash_fwupgrade = 'Aggiorna firmware' -a_s_flash_keepcfg = 'Mantieni files di configurazione' -a_s_flash_notimplemented = 'Spiacente, questa funzione non è (ancora) disponibile per la tua piattaforma.' -a_s_flash_upgrade1 = 'Sostituisce il firmware installato con uno nuovo. Il firmware è dipendente dalla piattaforma.' a_s_reboot1 = 'Riavvia il sistema operativo del tuo dispositivo' a_s_reboot_do = 'Esegui un riavvio' a_s_reboot_running = 'Per favore attendi: Riavvio del dispositivo...' @@ -325,3 +315,16 @@ hostnames_address = 'Indirizzo IP' network_interface_encaps = 'PPPoA Encapsulation' m_n_mssfix = "Clamp Segment Size" m_n_mssfix_desc = "Fixes problems with unreachable websites, submitting forms or other unexpected behaviour for some ISPs." +admin_upgrade = 'Flash Firmware' +admin_upgrade_badimage = 'The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.' +admin_upgrade_checksum = 'Checksum' +admin_upgrade_desc = 'Upload an OpenWrt image file to reflash the device.' +admin_upgrade_filesize = 'Size' +admin_upgrade_fwimage = 'Firmware image' +admin_upgrade_keepcfg = 'Keep configuration files' +admin_upgrade_nosupport = 'Sorry. OpenWrt does not support a system upgrade on this platform.
You need to manually flash your device.' +admin_upgrade_running = 'The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.' +admin_upgrade_spaceavail = ' (%s available)' +admin_upgrade_toolarge = 'It appears that you try to flash an image that does not fit into the flash memory, please verify the image file!' +admin_upgrade_upload = 'Upload image' +admin_upgrade_uploaded = 'The flash image was uploaded. Below is the checksum and file size listed, compare them with the original file to ensure data integrity.
Click "Proceed" below to start the flash procedure.' diff --git a/i18n/italian/luasrc/i18n/default.it.lua b/i18n/italian/luasrc/i18n/default.it.lua index 7ffc72910..8a089d8dd 100644 --- a/i18n/italian/luasrc/i18n/default.it.lua +++ b/i18n/italian/luasrc/i18n/default.it.lua @@ -12,6 +12,7 @@ essentials = 'Essenziali' apply = 'Applica' basicsettings = 'Impostazioni di base' broadcast = 'Broadcast IPv4' +cancel = 'Cancella' changes = 'Modifiche' channel = 'Canale' cidr6 = 'Notazione CIDR: indirizzo/prefisso' @@ -71,6 +72,7 @@ password = 'Password' path = 'Percorso' port = 'Porta' ports = 'Porte' +proceed = 'Continuare' protocol = 'Protocollo' reboot = 'Riavvia' reset = 'Reset' diff --git a/i18n/japanese/luasrc/i18n/admin-core.ja.lua b/i18n/japanese/luasrc/i18n/admin-core.ja.lua index 0ec423864..c9c193361 100644 --- a/i18n/japanese/luasrc/i18n/admin-core.ja.lua +++ b/i18n/japanese/luasrc/i18n/admin-core.ja.lua @@ -37,7 +37,6 @@ a_s_changepw = '管理者パスワード' a_s_p_ipkg = 'OPKG設定' a_s_sshkeys = 'SSH鍵' a_s_fstab = 'マウントポイント' -a_s_flash = 'ファームウェア書き込み' a_s_i_system1 = 'Change settings related to the system itself, its identification, installed hard- and software, authentication or mount points.' a_s_i_system2 = 'These settings define the base of your system.' a_s_i_system3 = 'Pay attention as any misconfiguration here may prevent your device from booting or may lock yourself out of it.' @@ -125,15 +124,6 @@ a_s_fstab_mountpoint = 'マウントポイント' a_s_fstab_device1 = 'デバイスファイルかパーティション(例 /dev/sda1)' a_s_fstab_fs1 = 'ファイルシステムは、使用する記憶フォーマットです。(例 ext3)' a_s_fstab_swap1 = '物理メモリが不足した時に、一時的に未使用なデータをもっと大容量RAMによるスワップデバイスへ退避することが出来ます。データの退避は非常に遅い処理なのでスワップデバイスには高い転送レートのRAMにアクセス出来ない事に注意してください。' -a_s_flash_flashed = 'ファームウェアの書き込みに成功しました。再起動中...' -a_s_flash_flasherr = '書き込みに失敗しました。' -a_s_flash_fwimage = 'ファームウェアイメージ' -a_s_flash_received = 'イメージを受けとりました。書き込みプロセスを開始します。デバイスの電源を切らないでください!' -a_s_flash_inprogress = 'ファームウェアを書き込み中...' -a_s_flash_fwupgrade = 'ファームウェアを書き込む' -a_s_flash_keepcfg = '設定ファイルを維持する' -a_s_flash_notimplemented = 'ごめんなさい、この機能はこのプラットホームではまだ使用出来ません。' -a_s_flash_upgrade1 = 'インストールされているファームウェアを新しいものに置き換えます。このファームウェアフォーマットはプラットホーム依存です。' a_s_reboot1 = 'デバイスのオペレーティングシステムを再起動します。' a_s_reboot_do = '再起動を実行' a_s_reboot_running = 'しばらくお待ちください: 再起動中...' @@ -389,3 +379,16 @@ hostnames_hostname = 'ホスト名' hostnames_address = 'IPアドレス' m_n_mssfix = 'Clamp Segment Size' m_n_mssfix_desc = 'Fixes problems with unreachable websites, submitting forms or other unexpected behaviour for some ISPs.' +admin_upgrade = 'Flash Firmware' +admin_upgrade_badimage = 'The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.' +admin_upgrade_checksum = 'Checksum' +admin_upgrade_desc = 'Upload an OpenWrt image file to reflash the device.' +admin_upgrade_filesize = 'Size' +admin_upgrade_fwimage = 'Firmware image' +admin_upgrade_keepcfg = 'Keep configuration files' +admin_upgrade_nosupport = 'Sorry. OpenWrt does not support a system upgrade on this platform.
You need to manually flash your device.' +admin_upgrade_running = 'The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.' +admin_upgrade_spaceavail = ' (%s available)' +admin_upgrade_toolarge = 'It appears that you try to flash an image that does not fit into the flash memory, please verify the image file!' +admin_upgrade_upload = 'Upload image' +admin_upgrade_uploaded = 'The flash image was uploaded. Below is the checksum and file size listed, compare them with the original file to ensure data integrity.
Click "Proceed" below to start the flash procedure.' diff --git a/i18n/japanese/luasrc/i18n/default.ja.lua b/i18n/japanese/luasrc/i18n/default.ja.lua index 3b407ca25..274a0755f 100644 --- a/i18n/japanese/luasrc/i18n/default.ja.lua +++ b/i18n/japanese/luasrc/i18n/default.ja.lua @@ -12,6 +12,7 @@ essentials = '簡易設定' apply = '適用' basicsettings = '簡易設定' broadcast = 'IPv4ブロードキャスト' +cancel = 'Cancel' changes = '変更' channel = 'チャンネル' cidr6 = 'CIDR表記: address/prefix' @@ -71,6 +72,7 @@ password = 'パスワード' path = 'パス' port = 'ポート' ports = 'ポート' +proceed 'Proceed' protocol = 'プロトコル' reboot = '再起動' reset = 'リセット' diff --git a/i18n/portuguese_brazilian/luasrc/i18n/admin-core.pt-br.lua b/i18n/portuguese_brazilian/luasrc/i18n/admin-core.pt-br.lua index 585ba860e..ad1946fd0 100644 --- a/i18n/portuguese_brazilian/luasrc/i18n/admin-core.pt-br.lua +++ b/i18n/portuguese_brazilian/luasrc/i18n/admin-core.pt-br.lua @@ -37,7 +37,6 @@ a_s_changepw = 'Senha do Admin' a_s_p_ipkg = 'Configuração-OPKG' a_s_sshkeys = 'Chaves-SSH' a_s_fstab = 'Pontos de Montagem' -a_s_flash = 'Atualizar Firmware' a_s_i_system1 = 'Altera as configurações relacionadas com o sistema em si, sua identificação, hardware e software instalados, autenticação ou pontos de montagem.' a_s_i_system2 = 'Essas configurações definem a base do seu sistema.' a_s_i_system3 = 'Preste atenção de que qualquer configuração errada aqui pode impedir o seu equipamento de inicilizar ou talvez bloquear seu acesso de fora à ele.' @@ -66,15 +65,6 @@ a_s_fstab_mountpoint = 'Ponto de Montagem' a_s_fstab_device1 = 'O arquivo do dispositivo de memória ou a partição (ex. /dev/sda1)' a_s_fstab_fs1 = 'O sistema que foi usado para formatar a memória (ex. ext3)' a_s_fstab_swap1 = 'Se a sua memória física for insuficiente, os dados poderão ser trocados temporariamente para um dispositivo swap, resultando em uma maior quantidade de memória utilizável RAM. Esteja ciente de que a troca de dados (swap) é um processo muito lento pois o dispositivo swap não pode ser acessado com um nível elevado de memória RAM.' -a_s_flash_flashed = 'Firmware gravado com sucesso. Reiniciando o equipamento...' -a_s_flash_flasherr = 'Falha na gravação' -a_s_flash_fwimage = 'Imagem do firmware' -a_s_flash_received = 'Imagem recebida. Durante o processo de gravação, NÃO DESLIGUE O EQUIPAMENTO!' -a_s_flash_inprogress = 'Gravando firmware...' -a_s_flash_fwupgrade = 'Atualizar Firmware' -a_s_flash_keepcfg = 'Manter arquivos de configuração' -a_s_flash_notimplemented = 'Desculpe, esta função não está (ainda) disponível para sua plataforma.' -a_s_flash_upgrade1 = 'Substitui o firmware instalado por um mais novo. O formato do firmware depende da plataforma.' a_s_reboot1 = 'Reinicia o seu equipamento' a_s_reboot_do = 'Executar reinicialização' a_s_reboot_running = 'Por favor aguarde: Equipamento reiniciando...' @@ -325,3 +315,16 @@ hostnames_address = 'Endereço de IP' network_interface_encaps = 'PPPoA Encapsulation' m_n_mssfix = "Clamp Segment Size" m_n_mssfix_desc = "Fixes problems with unreachable websites, submitting forms or other unexpected behaviour for some ISPs." +admin_upgrade = 'Flash Firmware' +admin_upgrade_badimage = 'The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.' +admin_upgrade_checksum = 'Checksum' +admin_upgrade_desc = 'Upload an OpenWrt image file to reflash the device.' +admin_upgrade_filesize = 'Size' +admin_upgrade_fwimage = 'Firmware image' +admin_upgrade_keepcfg = 'Keep configuration files' +admin_upgrade_nosupport = 'Sorry. OpenWrt does not support a system upgrade on this platform.
You need to manually flash your device.' +admin_upgrade_running = 'The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.' +admin_upgrade_spaceavail = ' (%s available)' +admin_upgrade_toolarge = 'It appears that you try to flash an image that does not fit into the flash memory, please verify the image file!' +admin_upgrade_upload = 'Upload image' +admin_upgrade_uploaded = 'The flash image was uploaded. Below is the checksum and file size listed, compare them with the original file to ensure data integrity.
Click "Proceed" below to start the flash procedure.' diff --git a/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.lua b/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.lua index 26672bdf9..10f188b28 100644 --- a/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.lua +++ b/i18n/portuguese_brazilian/luasrc/i18n/default.pt-br.lua @@ -13,6 +13,7 @@ essentials = 'Básico' apply = 'Aplicar' basicsettings = 'Configurações Básicas' broadcast = 'Broadcast-IPv4' +cancel = 'Cancel' changes = 'Alterações' channel = 'Canal' cidr6 = 'Notação-CIDR: endereço/prefixo' @@ -72,6 +73,7 @@ password = 'Senha' path = 'Caminho' port = 'Porta' ports = 'Portas' +proceed = 'Proceed' protocol = 'Protocolo' reboot = 'Reboot' reset = 'Restaurar' diff --git a/i18n/russian/luasrc/i18n/admin-core.ru.lua b/i18n/russian/luasrc/i18n/admin-core.ru.lua index 4961495d5..68c9cc011 100644 --- a/i18n/russian/luasrc/i18n/admin-core.ru.lua +++ b/i18n/russian/luasrc/i18n/admin-core.ru.lua @@ -37,7 +37,6 @@ a_s_changepw = 'Пароль администратора' a_s_p_ipkg = 'OPKG-Настройка' a_s_sshkeys = 'SSH-Ключи' a_s_fstab = 'Дисковые разделы' -a_s_flash = 'Обновление прошивки' a_s_i_system1 = 'Изменение настроек системы связанных с самоидентификацией, устстанвкой аппаратно и/или програмного обеспечения, идентификацией или дисковыми разделами.' a_s_i_system2 = 'Эти настройки определяют основу вашей системы.' a_s_i_system3 = 'Необходимо тчательно отнестись к нижеследующим настройкам, в результате неправильной конфигурации которых вы можете потерять управление над системой или устройсто может не загружаться.' @@ -66,13 +65,6 @@ a_s_fstab_mountpoint = 'Точка присоединения' a_s_fstab_device1 = 'Устройство или раздел (пример /dev/sda1)' a_s_fstab_fs1 = 'Формат файловой системы (пример ext3)' a_s_fstab_swap1 = 'Если физической RAM не хватает можно воспользоваться временным хранением данных в файле-подкачке. В результате RAM памяти будет доступно в большем количестве. Но помните, файл подкачки работает гораздо медленнее RAM так что не ждите обработки информации на скоростях сравнимых с RAM.' -a_s_flash_flashed = 'Прошивка успешно обновленна. Перезагрузка устройства...' -a_s_flash_flasherr = 'Прошивка невозможна' -a_s_flash_fwimage = 'Файл прошивки' -a_s_flash_fwupgrade = 'Прошить' -a_s_flash_keepcfg = 'Сохранить конфигурационные файлы' -a_s_flash_notimplemented = 'Извините, эта функция пока не доступна на вашей платформе.' -a_s_flash_upgrade1 = 'Заменяет установленную прошивку на новую. Формат прошивки платформо-зависимый.' a_s_reboot1 = 'Сразу произойдёт перезагрузка вашей системы' a_s_reboot_do = 'Выполнить перезагрузку' a_s_reboot_running = 'Позалуйста подождите: Устройство перезагружается...' @@ -267,3 +259,16 @@ network_interface_fwzone_desc = 'Этот интерфейс не принадл network_interface_encaps = 'PPPoA Encapsulation' m_n_mssfix = "Clamp Segment Size" m_n_mssfix_desc = "Fixes problems with unreachable websites, submitting forms or other unexpected behaviour for some ISPs." +admin_upgrade = 'Flash Firmware' +admin_upgrade_badimage = 'The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.' +admin_upgrade_checksum = 'Checksum' +admin_upgrade_desc = 'Upload an OpenWrt image file to reflash the device.' +admin_upgrade_filesize = 'Size' +admin_upgrade_fwimage = 'Firmware image' +admin_upgrade_keepcfg = 'Keep configuration files' +admin_upgrade_nosupport = 'Sorry. OpenWrt does not support a system upgrade on this platform.
You need to manually flash your device.' +admin_upgrade_running = 'The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings.' +admin_upgrade_spaceavail = ' (%s available)' +admin_upgrade_toolarge = 'It appears that you try to flash an image that does not fit into the flash memory, please verify the image file!' +admin_upgrade_upload = 'Upload image' +admin_upgrade_uploaded = 'The flash image was uploaded. Below is the checksum and file size listed, compare them with the original file to ensure data integrity.
Click "Proceed" below to start the flash procedure.' diff --git a/i18n/russian/luasrc/i18n/default.ru.lua b/i18n/russian/luasrc/i18n/default.ru.lua index fe59e45a1..f90777a19 100644 --- a/i18n/russian/luasrc/i18n/default.ru.lua +++ b/i18n/russian/luasrc/i18n/default.ru.lua @@ -8,6 +8,7 @@ essentials = 'Essentials' apply = 'Принять' basicsettings = 'Начальные Установки' broadcast = 'IPv4-Широковещательный' +cancel = 'Cancel' changes = 'Изменения' channel = 'Канал' cidr6 = 'CIDR-Обозначение: адрес/префикс' @@ -66,6 +67,7 @@ password = 'Пароль' path = 'Путь' port = 'Порт' ports = 'Порты' +proceed 'Proceed' protocol = 'Протокол' reboot = 'Перезагрузка' reset = 'Сброс' diff --git a/modules/admin-core/root/sbin/luci-flash b/modules/admin-core/root/sbin/luci-flash index 819be40b5..a9ddc87f2 100755 --- a/modules/admin-core/root/sbin/luci-flash +++ b/modules/admin-core/root/sbin/luci-flash @@ -5,7 +5,7 @@ RAMFS_COPY_BIN="/usr/bin/awk" # extra programs for temporary ramfs root RAMFS_COPY_DATA="" # extra data files export KEEP_PATTERN="" -export VERBOSE=0 +export VERBOSE=1 # parse options while [ -n "$1" ]; do @@ -85,5 +85,9 @@ done [ -n "$sysupgrade_init_conffiles" ] && do_save_conffiles run_hooks "" $sysupgrade_pre_upgrade -v "Switching to ramdisk..." -run_ramfs '. /etc/functions.sh; include /lib/upgrade; do_upgrade' +if [ -n "$(rootfs_type)" ]; then + v "Switching to ramdisk..." + run_ramfs '. /etc/functions.sh; include /lib/upgrade; do_upgrade' +else + do_upgrade +fi diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index efd0e9d6a..33e46b74b 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -2,6 +2,7 @@ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth +Copyright 2008-2009 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -31,7 +32,7 @@ function index() end entry({"admin", "system", "backup"}, call("action_backup"), i18n("a_s_backup"), 70) - entry({"admin", "system", "upgrade"}, call("action_upgrade"), i18n("a_s_flash"), 80) + entry({"admin", "system", "upgrade"}, call("action_upgrade"), i18n("admin_upgrade"), 80) entry({"admin", "system", "reboot"}, call("action_reboot"), i18n("reboot"), 90) end @@ -187,37 +188,118 @@ end function action_upgrade() require("luci.model.uci") - local ret - local plat = luci.fs.mtime("/lib/upgrade/platform.sh") local tmpfile = "/tmp/firmware.img" - local keep_avail = true + + local function image_supported() + -- XXX: yay... + return ( 0 == os.execute( + ". /etc/functions.sh; " .. + "include /lib/upgrade; " .. + "platform_check_image %q >/dev/null" + % tmpfile + ) ) + end + + local function image_checksum() + return (luci.sys.exec("md5sum %q" % tmpfile):match("^([^%s]+)")) + end + + local function storage_size() + local size = 0 + if luci.fs.access("/proc/mtd") then + for l in io.lines("/proc/mtd") do + local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"') + if n == "linux" then + size = tonumber(s, 16) + break + end + end + end + return size + end + + -- Install upload handler local file luci.http.setfilehandler( function(meta, chunk, eof) - if not file then + if not luci.fs.access(tmpfile) and not file and chunk and #chunk > 0 then file = io.open(tmpfile, "w") end - if chunk then + if file and chunk then file:write(chunk) end - if eof then + if file and eof then file:close() end end ) - local fname = luci.http.formvalue("image") - local keepcfg = keep_avail and luci.http.formvalue("keepcfg") - if plat and fname then - ret = function() - return luci.sys.flash(tmpfile, keepcfg and _keep_pattern()) + -- Determine state + local keep_avail = true + local step = tonumber(luci.http.formvalue("step") or 1) + local has_image = luci.fs.access(tmpfile) + local has_support = image_supported() + local has_platform = luci.fs.access("/lib/upgrade/platform.sh") + local has_upload = luci.http.formvalue("image") + + -- This does the actual flashing which is invoked inside an iframe + -- so don't produce meaningful errors here because the the + -- previous pages should arrange the stuff as required. + if step == 4 then + if has_platform and has_image and has_support then + -- Next line is to bypass luci.http layer + luci.http.context.eoh = true + + -- Now invoke sysupgrade + local keepcfg = keep_avail and luci.http.formvalue("keepcfg") == "1" + os.execute("/sbin/luci-flash %s %q" %{ + keepcfg and "-k %q" % _keep_pattern() or "", tmpfile + }) + + -- Make sure the device is rebooted + luci.sys.reboot() end - end - luci.http.prepare_content("text/html") - luci.template.render("admin_system/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail}) + + -- + -- This is step 1-3, which does the user interaction and + -- image upload. + -- + + -- Step 1: file upload, error on unsupported image format + elseif not has_image or not has_support or step == 1 then + -- If there is an image but user has requested step 1 + -- or type is not supported, then remove it. + if has_image then + luci.fs.unlink(tmpfile) + end + + luci.template.render("admin_system/upgrade", { + step=1, + bad_image=(has_image and not has_support or false), + keepavail=keep_avail, + supported=has_platform + } ) + + -- Step 2: present uploaded file, show checksum, confirmation + elseif step == 2 then + luci.template.render("admin_system/upgrade", { + step=2, + checksum=image_checksum(), + filesize=luci.fs.stat(tmpfile).size, + flashsize=storage_size(), + keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1") + } ) + + -- Step 3: load iframe which calls the actual flash procedure + elseif step == 3 then + luci.template.render("admin_system/upgrade", { + step=3, + keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1") + } ) + end end function _keep_pattern() diff --git a/modules/admin-full/luasrc/view/admin_system/upgrade.htm b/modules/admin-full/luasrc/view/admin_system/upgrade.htm index bbc5215c4..ae38cce91 100644 --- a/modules/admin-full/luasrc/view/admin_system/upgrade.htm +++ b/modules/admin-full/luasrc/view/admin_system/upgrade.htm @@ -1,7 +1,7 @@ <%# LuCI - Lua Configuration Interface Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich +Copyright 2008-2009 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -12,41 +12,95 @@ You may obtain a copy of the License at $Id$ -%> + <%+header%> +

<%:system%>

-

<%:a_s_flash%>

-

<%:a_s_flash_upgrade1%>

-
-<% if sysupgrade and not ret then %> -
-
<%:a_s_flash_fwimage%>:
+

<%:admin_upgrade Flash Firmware%>

+ +<% if step == 1 then %> + <% if supported then %> + +

+ <%:admin_upgrade_desc Upload an OpenWrt image file to reflash the device.%> + <% if bad_image then %> +

+

<%:admin_upgrade_badimage The uploaded image file does not + contain a supported format. Make sure that you choose the generic + image format for your platform. %>
+ <% end %> +

+ <%:admin_upgrade_fwimage Firmware image%>:
+

- <% if keep_avail then -%> + <% if keepavail then -%> - <%:a_s_flash_keepcfg%> + <%:admin_upgrade_keepcfg Keep configuration files%> <% end -%> + +
+
-
- -
-
-<% elseif ret then %> -

<%:a_s_flash_received%>

-

<%:a_s_flash_inprogress%>

- - - <% %> - <% local ret = ret() - if ret == 0 then %> -
<%:a_s_flash_flashed%>
+ <% else %> -
<%:a_s_flash_flasherr%>! (<%:code%> <%=ret%>)
+
<%:admin_upgrade_nosupport Sorry. + OpenWrt does not support a system upgrade on this platform.
+ You need to manually flash your device. %>
<% end %> -<% else %> -
<%:a_s_flash_notimplemented%>
+<% elseif step == 2 then %> +

+ <%:admin_upgrade_uploaded The flash image was uploaded. + Below is the checksum and file size listed, + compare them with the original file to ensure data integrity.
+ Click "Proceed" below to start the flash procedure. %> + + <% if flashsize > 0 and filesize > flashsize then %> +

+

<%:admin_upgrade_toolarge It appears that you try to + flash an image that does not fit in the flash memory, please verify + the image file! %>
+ <% end %> + +
+
    +
  • <%:admin_upgrade_checksum Checksum%>: <%=checksum%>
  • +
  • <%:admin_upgrade_filesize Size%>: <% + local w = require "luci.tools.webadmin" + write(w.byte_format(filesize)) + + if flashsize > 0 then + write(luci.i18n.translatef( + "admin_upgrade_spaceavil", + " (%s available)", + w.byte_format(flashsize) + )) + end + %>
  • +
+

+
+
+ + " /> + +
+
+ + " /> + +
+
+<% elseif step == 3 then %> +

<%:admin_upgrade_running The system is flashing now.
+ DO NOT POWER OFF THE DEVICE!
+ Wait a few minutes until you try to reconnect. + It might be necessary to renew the address of your computer to reach the device + again, depending on your settings. %>

+ + <% end %> <%+footer%> -<% if ret == 0 then luci.sys.reboot() end %> + diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index 1a2628072..ad15b076b 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -23,7 +23,7 @@ function index() entry({"mini", "system", "index"}, cbi("mini/system", {autoapply=true}), i18n("general"), 1) entry({"mini", "system", "passwd"}, form("mini/passwd"), i18n("a_s_changepw"), 10) entry({"mini", "system", "backup"}, call("action_backup"), i18n("a_s_backup"), 80) - entry({"mini", "system", "upgrade"}, call("action_upgrade"), i18n("a_s_flash"), 90) + entry({"mini", "system", "upgrade"}, call("action_upgrade"), i18n("admin_upgrade"), 90) entry({"mini", "system", "reboot"}, call("action_reboot"), i18n("reboot"), 100) end @@ -80,37 +80,118 @@ end function action_upgrade() require("luci.model.uci") - local ret = nil - local plat = luci.fs.mtime("/lib/upgrade/platform.sh") local tmpfile = "/tmp/firmware.img" - local keep_avail = true + + local function image_supported() + -- XXX: yay... + return ( 0 == os.execute( + ". /etc/functions.sh; " .. + "include /lib/upgrade; " .. + "platform_check_image %q >/dev/null" + % tmpfile + ) ) + end + + local function image_checksum() + return (luci.sys.exec("md5sum %q" % tmpfile):match("^([^%s]+)")) + end + + local function storage_size() + local size = 0 + if luci.fs.access("/proc/mtd") then + for l in io.lines("/proc/mtd") do + local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"') + if n == "linux" then + size = tonumber(s, 16) + break + end + end + end + return size + end + + -- Install upload handler local file luci.http.setfilehandler( function(meta, chunk, eof) - if not file then + if not luci.fs.access(tmpfile) and not file and chunk and #chunk > 0 then file = io.open(tmpfile, "w") end - if chunk then + if file and chunk then file:write(chunk) end - if eof then + if file and eof then file:close() end end ) - local fname = luci.http.formvalue("image") - local keepcfg = keep_avail and luci.http.formvalue("keepcfg") - if plat and fname then - ret = function() - return luci.sys.flash(tmpfile, keepcfg and _keep_pattern()) + -- Determine state + local keep_avail = true + local step = tonumber(luci.http.formvalue("step") or 1) + local has_image = luci.fs.access(tmpfile) + local has_support = image_supported() + local has_platform = luci.fs.access("/lib/upgrade/platform.sh") + local has_upload = luci.http.formvalue("image") + + -- This does the actual flashing which is invoked inside an iframe + -- so don't produce meaningful errors here because the the + -- previous pages should arrange the stuff as required. + if step == 4 then + if has_platform and has_image and has_support then + -- Next line is to bypass luci.http layer + luci.http.context.eoh = true + + -- Now invoke sysupgrade + local keepcfg = keep_avail and luci.http.formvalue("keepcfg") == "1" + os.execute("/sbin/luci-flash %s %q" %{ + keepcfg and "-k %q" % _keep_pattern() or "", tmpfile + }) + + -- Make sure the device is rebooted + luci.sys.reboot() end - end - luci.http.prepare_content("text/html") - luci.template.render("mini/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail}) + + -- + -- This is step 1-3, which does the user interaction and + -- image upload. + -- + + -- Step 1: file upload, error on unsupported image format + elseif not has_image or not has_support or step == 1 then + -- If there is an image but user has requested step 1 + -- or type is not supported, then remove it. + if has_image then + luci.fs.unlink(tmpfile) + end + + luci.template.render("admin_system/upgrade", { + step=1, + bad_image=(has_image and not has_support or false), + keepavail=keep_avail, + supported=has_platform + } ) + + -- Step 2: present uploaded file, show checksum, confirmation + elseif step == 2 then + luci.template.render("admin_system/upgrade", { + step=2, + checksum=image_checksum(), + filesize=luci.fs.stat(tmpfile).size, + flashsize=storage_size(), + keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1") + } ) + + -- Step 3: load iframe which calls the actual flash procedure + elseif step == 3 then + luci.template.render("admin_system/upgrade", { + step=3, + keepconfig=(keep_avail and luci.http.formvalue("keepcfg") == "1") + } ) + end end function _keep_pattern() @@ -125,4 +206,4 @@ function _keep_pattern() end end return kpattern -end \ No newline at end of file +end diff --git a/modules/admin-mini/luasrc/view/mini/upgrade.htm b/modules/admin-mini/luasrc/view/mini/upgrade.htm index bbc5215c4..425113e62 100644 --- a/modules/admin-mini/luasrc/view/mini/upgrade.htm +++ b/modules/admin-mini/luasrc/view/mini/upgrade.htm @@ -1,7 +1,7 @@ <%# LuCI - Lua Configuration Interface Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich +Copyright 2008-2009 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -12,41 +12,95 @@ You may obtain a copy of the License at $Id$ -%> + <%+header%> +

<%:system%>

-

<%:a_s_flash%>

-

<%:a_s_flash_upgrade1%>

-
-<% if sysupgrade and not ret then %> -
-
<%:a_s_flash_fwimage%>:
+

<%:admin_upgrade Flash Firmware%>

+ +<% if step == 1 then %> + <% if supported then %> + +

+ <%:admin_upgrade_desc Upload an OpenWrt image file to reflash the device.%> + <% if bad_image then %> +

+

<%:admin_upgrade_badimage The uploaded image file does not + contain a supported format. Make sure that you choose the generic + image format for your platform. %>
+ <% end %> +

+ <%:admin_upgrade_fwimage Firmware image%>:
+

- <% if keep_avail then -%> + <% if keepavail then -%> - <%:a_s_flash_keepcfg%> + <%:admin_upgrade_keepcfg Keep configuration files%> <% end -%> + +
+
-
- -
-
-<% elseif ret then %> -

<%:a_s_flash_received%>

-

<%:a_s_flash_inprogress%>

- - - <% %> - <% local ret = ret() - if ret == 0 then %> -
<%:a_s_flash_flashed%>
+ <% else %> -
<%:a_s_flash_flasherr%>! (<%:code%> <%=ret%>)
+
<%:admin_upgrade_nosupport Sorry. + OpenWrt does not support a system upgrade on this platform.
+ You need to manually flash your device. %>
<% end %> -<% else %> -
<%:a_s_flash_notimplemented%>
+<% elseif step == 2 then %> +

+ <%:admin_upgrade_uploaded The flash image was uploaded. + Below is the checksum and file size listed, + compare them with the original file to ensure data integrity.
+ Click "Proceed" below to start the flash procedure. %> + + <% if flashsize > 0 and filesize > flashsize then %> +

+

<%:admin_upgrade_toolarge It appears that you try to + flash an image that does not fit into the flash memory, please verify + the image file! %>
+ <% end %> + +
+
    +
  • <%:admin_upgrade_checksum Checksum%>: <%=checksum%>
  • +
  • <%:admin_upgrade_filesize Size%>: <% + local w = require "luci.tools.webadmin" + write(w.byte_format(filesize)) + + if flashsize > 0 then + write(luci.i18n.translatef( + "admin_upgrade_spaceavail", + " (%s available)", + w.byte_format(flashsize) + )) + end + %>
  • +
+

+
+
+ + " /> + +
+
+ + " /> + +
+
+<% elseif step == 3 then %> +

<%:admin_upgrade_running The system is flashing now.
+ DO NOT POWER OFF THE DEVICE!
+ Wait a few minutes until you try to reconnect. + It might be necessary to renew the address of your computer to reach the device + again, depending on your settings. %>

+ + <% end %> <%+footer%> -<% if ret == 0 then luci.sys.reboot() end %> +