--- /dev/null
+#!/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 = <F>;
+
+ 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};
+ }
+}
a_s_p_ipkg = 'OPKG-Configuration'
a_s_sshkeys = '<abbr title="Secure Shell">SSH</abbr>-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.'
a_s_fstab_device1 = 'The device file of the memory or partition (<abbr title="for example">e.g.</abbr> <code>/dev/sda1</code>)'
a_s_fstab_fs1 = 'The filesystem that was used to format the memory (<abbr title="for example">e.g.</abbr> <samp><abbr title="Third Extended Filesystem">ext3</abbr></samp>)'
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 <abbr title="Random Access Memory">RAM</abbr>. Be aware that swapping data is a very slow process as the swap-device cannot be accessed with the high datarates of the <abbr title="Random Access Memory">RAM</abbr>.'
-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...'
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.<br /> You need to manually flash your device.'
+admin_upgrade_running = 'The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> 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.<br /> Click "Proceed" below to start the flash procedure.'
apply = 'Apply'
basicsettings = 'Basic Settings'
broadcast = '<abbr title="Internet Protocol Version 4">IPv4</abbr>-Broadcast'
+cancel = 'Cancel'
changes = 'Changes'
channel = 'Channel'
cidr6 = '<abbr title="Classless Inter-Domain Routing">CIDR</abbr>-Notation: address/prefix'
path = 'Path'
port = 'Port'
ports = 'Ports'
+proceed = 'Proceed'
protocol = 'Protocol'
reboot = 'Reboot'
reset = 'Reset'
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.'
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...'
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.<br /> You need to manually flash your device.'
+admin_upgrade_running = 'The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> 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.<br /> Click "Proceed" below to start the flash procedure.'
apply = 'Appliquer'
basicsettings = 'Paramètres de base'
broadcast = 'Broadcast <abbr title="Internet Protocol Version 4">IPv4</abbr>'
+cancel = 'Annuler'
changes = 'Changements'
channel = 'Canal'
cidr6 = 'Notation <abbr title="Classless Inter-Domain Routing">CIDR</abbr> : adresse/prefixe'
path = 'Chemin'
port = 'Port'
ports = 'Ports'
+proceed = 'Continuer'
protocol = 'Protocole'
reboot = 'Redémarrage'
reset = 'Remise à zéro'
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'
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 <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr> können Netzwerkteilnehmer automatisch Einstellungen wie <abbr title="Internet Protocol">IP</abbr>-Adresse, Präfix, <abbr title="Domain Name System">DNS</abbr>-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.<br /> Sie müssen das Gerät manuell neu flashen.'
+admin_upgrade_running = 'Der Flashvorgang läuft jetzt.<br /> SCHALTEN SIE NICHT DEN STROM AUS!<br /> 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.<br /> Klicken Sie auf "Fortfahren" um den Flashvorgang zu starten.'
back = 'zurück'
basicsettings = 'Grundeinstellungen'
broadcast = 'IPv4-Broadcast'
+cancel = 'Abbrechen'
changes = 'Änderungen'
channel = 'Kanal'
cidr6 = 'CIDR-Notation: Adresse/Prefix'
path = 'Pfad'
port = 'Port'
ports = 'Ports'
+proceed = 'Fortfahren'
protocol = 'Protokoll'
reboot = 'Neu Starten'
reset = 'Zurücksetzen'
a_s_p_ipkg = 'Παραμετροποίηση OPKG'
a_s_sshkeys = 'Κλειδιά <abbr title="Secure Shell">SSH</abbr>'
a_s_fstab = 'Σημεία Προσάρτησης'
-a_s_flash = 'Φλασάρισμα Firmware'
a_s_i_system1 = 'Αλλαγή ρυθμίσεων σχετικών με το σύστημα, την ταυτότητά του, το εγκατεστημένο υλικό και λογισμικό, την εξουσιοδότηση ή τα σημεία προσάρτησης.'
a_s_i_system2 = 'Αυτές οι ρυθμίσεις ορίζουν τη βάση του συστήματος.'
a_s_i_system3 = 'Δώστε ιδιαίτερη προσοχή γιατί οποιαδήποτε λάθος ρύθμιση εδώ μπορεί να αποτρέψει την συσκευή σας από το να εκκινήσει ή μπορεί να κλειδώσετε τον εαυτό σας έξω.'
a_s_fstab_device1 = 'Το αρχείο συσκευής της μνήμης ή του διαμέρισματος (<abbr title="παραδείγματος χάρην">π.χ.</abbr> <code>/dev/sda1</code>)'
a_s_fstab_fs1 = 'Το σύστημα αρχείων που χρησιμοποιήθηκε για διαμόρφωση (<abbr title="παραδείγματος χάρην">π.χ.</abbr> <samp><abbr title="Third Extended Filesystem">ext3</abbr></samp>)'
a_s_fstab_swap1 = 'Αν η φυσική μνήμη δεν είναι αρκετή, μη-χρησιμοποιούμενα δεδομένα μπορούν προσωρινά να εναλλάσσονται σε μία συσκευή swap με αποτέλεσμα περισσότερη ενεργή <abbr title="Random Access Memory">RAM</abbr>. Η εναλλαγή δεδομένων είναι μία πολύ αργή διαδικασία αφού η συσκευή swap δεν μπορεί να προσπελαστεί με τους υψηλούς ρυθμούς μεταφοράς δεδομένων που διαθέτει η <abbr title="Random Access Memory">RAM</abbr>.'
-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 = 'Παρακαλώ περιμένετε: Η συσκευή επανεκκινεί...'
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.<br /> You need to manually flash your device.'
+admin_upgrade_running = 'The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> 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.<br /> Click "Proceed" below to start the flash procedure.'
apply = 'Εφαρμογή'
basicsettings = 'Βασικές Ρυθμίσεις'
broadcast = '<abbr title="Internet Protocol Version 4">IPv4</abbr>-Broadcast'
+cancel = 'Cancel'
changes = 'Αλλαγές'
channel = 'Κανάλι'
cidr6 = 'Παράσταση <abbr title="Classless Inter-Domain Routing">CIDR</abbr>: διεύθυνση/πρόθεμα'
packagemanager = 'Διαχειριστής Πακέτων'
password = 'Κωδικός Πρόσβασης'
path = 'Διαδρομή'
+proceed 'Proceed'
port = 'Θύρα'
ports = 'Θύρες'
protocol = 'Πρωτόκολλο'
a_s_p_ipkg = 'Configurazione di OPKG'
a_s_sshkeys = 'Chiavi <abbr title="Secure Shell">SSH</abbr>s'
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.'
a_s_fstab_device1 = 'Il file del dispositivo di memoria o della partizione (<abbr title="per esempio">e.s.</abbr> <code>/dev/sda1</code>)'
a_s_fstab_fs1 = 'Il filesystem usato per formattare la memoria (<abbr title="per esempio">e.s.</abbr> <samp><abbr title="Third Extended Filesystem">ext3</abbr></samp>)'
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 <abbr title="Random Access Memory">RAM</abbr> 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 <abbr title="Random Access Memory">RAM</abbr>.'
-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...'
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.<br /> You need to manually flash your device.'
+admin_upgrade_running = 'The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> 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.<br /> Click "Proceed" below to start the flash procedure.'
apply = 'Applica'
basicsettings = 'Impostazioni di base'
broadcast = 'Broadcast <abbr title="Internet Protocol Version 4">IPv4</abbr>'
+cancel = 'Cancella'
changes = 'Modifiche'
channel = 'Canale'
cidr6 = 'Notazione <abbr title="Classless Inter-Domain Routing">CIDR</abbr>: indirizzo/prefisso'
path = 'Percorso'
port = 'Porta'
ports = 'Porte'
+proceed = 'Continuare'
protocol = 'Protocollo'
reboot = 'Riavvia'
reset = 'Reset'
a_s_p_ipkg = 'OPKG設定'
a_s_sshkeys = '<abbr title="Secure Shell">SSH</abbr>鍵'
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.'
a_s_fstab_device1 = 'デバイスファイルかパーティション(<abbr title="for example">例</abbr> <code>/dev/sda1</code>)'
a_s_fstab_fs1 = 'ファイルシステムは、使用する記憶フォーマットです。(<abbr title="for example">例</abbr> <samp><abbr title="Third Extended Filesystem">ext3</abbr></samp>)'
a_s_fstab_swap1 = '物理メモリが不足した時に、一時的に未使用なデータをもっと大容量<abbr title="Random Access Memory">RAM</abbr>によるスワップデバイスへ退避することが出来ます。データの退避は非常に遅い処理なのでスワップデバイスには高い転送レートの<abbr title="Random Access Memory">RAM</abbr>にアクセス出来ない事に注意してください。'
-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 = 'しばらくお待ちください: 再起動中...'
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.<br /> You need to manually flash your device.'
+admin_upgrade_running = 'The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> 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.<br /> Click "Proceed" below to start the flash procedure.'
apply = '適用'
basicsettings = '簡易設定'
broadcast = '<abbr title="Internet Protocol Version 4">IPv4</abbr>ブロードキャスト'
+cancel = 'Cancel'
changes = '変更'
channel = 'チャンネル'
cidr6 = '<abbr title="Classless Inter-Domain Routing">CIDR</abbr>表記: address/prefix'
path = 'パス'
port = 'ポート'
ports = 'ポート'
+proceed 'Proceed'
protocol = 'プロトコル'
reboot = '再起動'
reset = 'リセット'
a_s_p_ipkg = 'Configuração-OPKG'
a_s_sshkeys = 'Chaves-<abbr title="Shell Seguro">SSH</abbr>'
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.'
a_s_fstab_device1 = 'O arquivo do dispositivo de memória ou a partição (<abbr title="por exemplo">ex.</abbr> <code>/dev/sda1</code>)'
a_s_fstab_fs1 = 'O sistema que foi usado para formatar a memória (<abbr title="por exemplo">ex.</abbr> <samp><abbr title="Sistema de Arquivos ext3">ext3</abbr></samp>)'
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 <abbr title="Memória de Acesso Aleatório">RAM</abbr>. 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 <abbr title="Memória de Acesso Aleatório">RAM</abbr>.'
-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...'
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.<br /> You need to manually flash your device.'
+admin_upgrade_running = 'The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> 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.<br /> Click "Proceed" below to start the flash procedure.'
apply = 'Aplicar'
basicsettings = 'Configurações Básicas'
broadcast = 'Broadcast-<abbr title="Protocolo de Internet Versão 4">IPv4</abbr>'
+cancel = 'Cancel'
changes = 'Alterações'
channel = 'Canal'
cidr6 = 'Notação-<abbr title="Roteamento entre Domínios sem Classe">CIDR</abbr>: endereço/prefixo'
path = 'Caminho'
port = 'Porta'
ports = 'Portas'
+proceed = 'Proceed'
protocol = 'Protocolo'
reboot = 'Reboot'
reset = 'Restaurar'
a_s_p_ipkg = '<abbr title="Openmoko Package Management System">OPKG</abbr>-Настройка'
a_s_sshkeys = '<abbr title="Secure Shell">SSH</abbr>-Ключи'
a_s_fstab = 'Дисковые разделы'
-a_s_flash = 'Обновление прошивки'
a_s_i_system1 = 'Изменение настроек системы связанных с самоидентификацией, устстанвкой аппаратно и/или програмного обеспечения, идентификацией или дисковыми разделами.'
a_s_i_system2 = 'Эти настройки определяют основу вашей системы.'
a_s_i_system3 = 'Необходимо тчательно отнестись к нижеследующим настройкам, в результате неправильной конфигурации которых вы можете потерять управление над системой или устройсто может не загружаться.'
a_s_fstab_device1 = 'Устройство или раздел (<abbr title="for example">пример</abbr> <code>/dev/sda1</code>)'
a_s_fstab_fs1 = 'Формат файловой системы (<abbr title="for example">пример</abbr> <samp><abbr title="Third Extended Filesystem">ext3</abbr></samp>)'
a_s_fstab_swap1 = 'Если физической <abbr title="Random Access Memory">RAM</abbr> не хватает можно воспользоваться временным хранением данных в файле-подкачке. В результате <abbr title="Random Access Memory">RAM</abbr> памяти будет доступно в большем количестве. Но помните, файл подкачки работает гораздо медленнее <abbr title="Random Access Memory">RAM</abbr> так что не ждите обработки информации на скоростях сравнимых с <abbr title="Random Access Memory">RAM</abbr>.'
-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 = 'Позалуйста подождите: Устройство перезагружается...'
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.<br /> You need to manually flash your device.'
+admin_upgrade_running = 'The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> 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.<br /> Click "Proceed" below to start the flash procedure.'
apply = 'Принять'
basicsettings = 'Начальные Установки'
broadcast = '<abbr title="Интернет протокол версии 4">IPv4</abbr>-Широковещательный'
+cancel = 'Cancel'
changes = 'Изменения'
channel = 'Канал'
cidr6 = '<abbr title="Беcклассовая адресация">CIDR</abbr>-Обозначение: адрес/префикс'
path = 'Путь'
port = 'Порт'
ports = 'Порты'
+proceed 'Proceed'
protocol = 'Протокол'
reboot = 'Перезагрузка'
reset = 'Сброс'
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
[ -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
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
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
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()
<%#
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
$Id$
-%>
+
<%+header%>
+
<h2><a id="content" name="content"><%:system%></a></h2>
-<h3><%:a_s_flash%></h3>
-<p><%:a_s_flash_upgrade1%></p>
-<br />
-<% if sysupgrade and not ret then %>
-<form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
- <div class="left"><%:a_s_flash_fwimage%>:</div>
+<h3><%:admin_upgrade Flash Firmware%></h3>
+
+<% if step == 1 then %>
+ <% if supported then %>
+ <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
+ <p>
+ <%:admin_upgrade_desc Upload an OpenWrt image file to reflash the device.%>
+ <% if bad_image then %>
+ <br /><br />
+ <div class="error"><%: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. %></div>
+ <% end %>
+ </p>
<div>
+ <%:admin_upgrade_fwimage Firmware image%>:<br />
+ <input type="hidden" name="step" value="2" />
<input type="file" size="30" name="image" />
<br />
<br />
- <% if keep_avail then -%>
+ <% if keepavail then -%>
<input type="checkbox" name="keepcfg" value="1" checked="checked" />
- <span class="bold"><%:a_s_flash_keepcfg%></span>
+ <span class="bold"><%:admin_upgrade_keepcfg Keep configuration files%></span>
<% end -%>
+
+ <br />
+ <input class="cbi-button cbi-button-apply" type="submit" value="<%:admin_upgrade_upload Upload image%>" />
</div>
- <div>
- <input type="submit" value="<%:a_s_flash_fwupgrade%>" />
- </div>
-</form>
-<% elseif ret then %>
- <p><%:a_s_flash_received%></p>
- <p><%:a_s_flash_inprogress%></p>
-
-<!-- <%=string.rep(" ", 2048)%> -->
- <% %>
- <% local ret = ret()
- if ret == 0 then %>
-<div class="ok"><%:a_s_flash_flashed%></div>
+ </form>
<% else %>
-<div class="error"><%:a_s_flash_flasherr%>! (<%:code%> <%=ret%>)</div>
+ <div class="error"><%:admin_upgrade_nosupport Sorry.
+ OpenWrt does not support a system upgrade on this platform.<br />
+ You need to manually flash your device. %></div>
<% end %>
-<% else %>
-<div class="error"><%:a_s_flash_notimplemented%></div>
+<% elseif step == 2 then %>
+ <p>
+ <%: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.<br />
+ Click "Proceed" below to start the flash procedure. %>
+
+ <% if flashsize > 0 and filesize > flashsize then %>
+ <br /><br />
+ <div class="error"><%: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! %></div>
+ <% end %>
+
+ <br />
+ <ul>
+ <li><%:admin_upgrade_checksum Checksum%>: <code><%=checksum%></code></li>
+ <li><%: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
+ %></li>
+ </ul>
+ </p>
+ <div class="cbi-page-actions right">
+ <form style="display:inline">
+ <input type="hidden" name="step" value="3" />
+ <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
+ <input class="cbi-button cbi-button-apply" type="submit" value="<%:proceed Proceed%>" />
+ </form>
+ <form style="display:inline">
+ <input type="hidden" name="step" value="1" />
+ <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
+ <input class="cbi-button cbi-button-reset" type="submit" value="<%:cancel Cancel%>" />
+ </form>
+ </div>
+<% elseif step == 3 then %>
+ <p><%:admin_upgrade_running The system is flashing now.<br />
+ DO NOT POWER OFF THE DEVICE!<br />
+ 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. %></p>
+
+ <iframe src="<%=REQUEST_URI%>?step=4&keepcfg=<%=keepconfig and "1" or "0"%>" style="border:1px solid black; width:100%; height:150px"></iframe>
<% end %>
<%+footer%>
-<% if ret == 0 then luci.sys.reboot() end %>
+
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
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()
end
end
return kpattern
-end
\ No newline at end of file
+end
<%#
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
$Id$
-%>
+
<%+header%>
+
<h2><a id="content" name="content"><%:system%></a></h2>
-<h3><%:a_s_flash%></h3>
-<p><%:a_s_flash_upgrade1%></p>
-<br />
-<% if sysupgrade and not ret then %>
-<form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
- <div class="left"><%:a_s_flash_fwimage%>:</div>
+<h3><%:admin_upgrade Flash Firmware%></h3>
+
+<% if step == 1 then %>
+ <% if supported then %>
+ <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
+ <p>
+ <%:admin_upgrade_desc Upload an OpenWrt image file to reflash the device.%>
+ <% if bad_image then %>
+ <br /><br />
+ <div class="error"><%: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. %></div>
+ <% end %>
+ </p>
<div>
+ <%:admin_upgrade_fwimage Firmware image%>:<br />
+ <input type="hidden" name="step" value="2" />
<input type="file" size="30" name="image" />
<br />
<br />
- <% if keep_avail then -%>
+ <% if keepavail then -%>
<input type="checkbox" name="keepcfg" value="1" checked="checked" />
- <span class="bold"><%:a_s_flash_keepcfg%></span>
+ <span class="bold"><%:admin_upgrade_keepcfg Keep configuration files%></span>
<% end -%>
+
+ <br />
+ <input class="cbi-button cbi-button-apply" type="submit" value="<%:admin_upgrade_upload Upload image%>" />
</div>
- <div>
- <input type="submit" value="<%:a_s_flash_fwupgrade%>" />
- </div>
-</form>
-<% elseif ret then %>
- <p><%:a_s_flash_received%></p>
- <p><%:a_s_flash_inprogress%></p>
-
-<!-- <%=string.rep(" ", 2048)%> -->
- <% %>
- <% local ret = ret()
- if ret == 0 then %>
-<div class="ok"><%:a_s_flash_flashed%></div>
+ </form>
<% else %>
-<div class="error"><%:a_s_flash_flasherr%>! (<%:code%> <%=ret%>)</div>
+ <div class="error"><%:admin_upgrade_nosupport Sorry.
+ OpenWrt does not support a system upgrade on this platform.<br />
+ You need to manually flash your device. %></div>
<% end %>
-<% else %>
-<div class="error"><%:a_s_flash_notimplemented%></div>
+<% elseif step == 2 then %>
+ <p>
+ <%: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.<br />
+ Click "Proceed" below to start the flash procedure. %>
+
+ <% if flashsize > 0 and filesize > flashsize then %>
+ <br /><br />
+ <div class="error"><%: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! %></div>
+ <% end %>
+
+ <br />
+ <ul>
+ <li><%:admin_upgrade_checksum Checksum%>: <code><%=checksum%></code></li>
+ <li><%: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
+ %></li>
+ </ul>
+ </p>
+ <div class="cbi-page-actions right">
+ <form style="display:inline">
+ <input type="hidden" name="step" value="3" />
+ <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
+ <input class="cbi-button cbi-button-apply" type="submit" value="<%:proceed Proceed%>" />
+ </form>
+ <form style="display:inline">
+ <input type="hidden" name="step" value="1" />
+ <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
+ <input class="cbi-button cbi-button-reset" type="submit" value="<%:cancel Cancel%>" />
+ </form>
+ </div>
+<% elseif step == 3 then %>
+ <p><%:admin_upgrade_running The system is flashing now.<br />
+ DO NOT POWER OFF THE DEVICE!<br />
+ 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. %></p>
+
+ <iframe src="<%=REQUEST_URI%>?step=4&keepcfg=<%=keepconfig and "1" or "0"%>" style="border:1px solid black; width:100%; height:150px"></iframe>
<% end %>
<%+footer%>
-<% if ret == 0 then luci.sys.reboot() end %>
+