Changeset c7c0d88 in freewrt


Ignore:
Timestamp:
Jul 3, 2007, 7:19:19 PM (18 years ago)
Author:
Thorsten Glaser <tg@…>
Children:
4c47aa6
Parents:
d2b81cc
Message:

implement reload and reboot (or so I hope)

git-svn-id: svn://www.freewrt.org/trunk/freewrt@3115 afb5a338-a214-0410-bd46-81f09a774fd1

Location:
package/fwwif
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • package/fwwif/Makefile

    rd2b81cc rc7c0d88  
    99PKG_NAME=               fwwif
    1010PKG_VERSION=            20070703
    11 PKG_RELEASE=            4
     11PKG_RELEASE=            5
    1212NO_DISTFILES=           1
    1313
  • package/fwwif/extra/fwwif.ecpp

    rd2b81cc rc7c0d88  
    8282% reply.out() << global_index;
    8383 <li style="list-style:none;">&nbsp;</li>
    84  <li><a href="mgmt?op=commit">commit changes to flash</a> (FWCF)</li>
     84 <li><a href="mgmt?op=commit">Commit changes to flash</a> (FWCF)</li>
     85 <li><a href="mgmt?op=reload">Reload webinterface</a> (FWWIF)</li>
     86 <li><a href="mgmt?op=reboot">Reboot embedded system</a> (FreeWRT)</li>
    8587 <li><a href="version">version information</a> (FWWIF)</li>
    8688</ul>
  • package/fwwif/extra/mgmt.ecpp

    rd2b81cc rc7c0d88  
    5353                utilname = "fwcf commit";
    5454                okay = true;
     55        } else if (op == "reload") {
     56                pageheader = "reload webinterface";
     57                pagetitle_run = "Reloading webinterface";
     58                pagetitle_wrong = "Reload failed";
     59                text_wrong = "Reloading webinterface failed.";
     60                pagetitle_ok = "Reloaded successfully";
     61                text_ok = "The webinterface was reloaded.";
     62                utilname = "/etc/init.d/fwwif restart";
     63                okay = true;
     64        } else if (op == "reboot") {
     65                pageheader = "reboot";
     66                pagetitle_run = "Rebooting";
     67                pagetitle_wrong = "Reboot failed";
     68                text_wrong = "Reboot failed.";
     69                pagetitle_ok = "Rebooted successfully";
     70                text_ok = "The embedded system was rebooted.";
     71                utilname = "/bin/busybox reboot";
     72                okay = true;
    5573        }
    5674        runComp2(header, title, pageheader);
     
    6179<h1>Management functions</h1>
    6280<p>Please choose one of the following management functions.</p><ul>
    63  <li><a href="mgmt?op=commit">Commit changes to flash (FWCF)</a></li>
    64  <li><a href="version">FWWIF Version Information</a></li>
     81 <li><a href="mgmt?op=commit">Commit changes to flash</a> (FWCF)</li>
     82 <li><a href="mgmt?op=reload">Reload webinterface</a> (FWWIF)</li>
     83 <li><a href="mgmt?op=reboot">Reboot embedded system</a> (FreeWRT)</li>
     84 <li><a href="version">version information</a> (FWWIF)</li>
    6585</ul>
    6686%       } else if (really == "yes" && ick && ick == checkpoint) {
     
    6989<%cpp>
    7090                int i = 0;
    71                 const char *s;
    7291                char *text;
    73 
    74                 if (op == "commit") {
    75                         s = "fwcf commit";
    76                 }
    7792
    7893                reply.setDirectMode(); // flush output
    7994
    8095                checkpoint = arc4random();      /* prevent re-use */
    81                 text = c_exec(s, &i);
     96                text = c_exec(utilname.c_str(), &i);
    8297                if (i) {
    8398                        reply.out() << "<h1>";
     
    101116                } while (!checkpoint);
    102117
    103                 if (op == "commit") {
     118                if (op == "commit" || op == "reboot") {
    104119                        int i;
    105120                        char *changes;
    106121
    107122                        changes = c_exec("/sbin/fwcf status", &i);
    108                         if (changes) {
    109123</%cpp>
     124%                       if (op == "commit") {
     125<h1>Commit to flash</h1>
     126%                       } else if (op == "reboot") {
     127<h1>Reboot embedded system</h1>
     128%                       }
     129%                       if (changes) {
    110130<p class="blkbeg">The following files have been modified:</p>
    111131<pre class="blkmid"><$ *changes ? changes : "No files modified." $></pre>
     132%                               if (op == "commit") {
    112133<p class="blkend">Do you really want to commit all these changes
     134 into flash to retain them over system reboots?</p>
     135%                               } else if (op == "reboot") {
     136<p class="blkend">Do you really want to reboot without saving these changes?</p>
     137%                               }
    113138%                               free(changes);
    114139%                       } else {
    115 <h1>Commit to flash</h1>
    116140<p>Do you really want to commit all changes to <tt>/etc</tt>
     141 into flash to retain them over system reboots?</p>
    117142%                       }
    118  into flash to retain them over system reboots?</p>
     143%               } else if (op == "reload") {
     144<h1>Reload the webinterface</h1>
     145<p>Do you really want to stop and restart the webinterface?</p>
     146%               }
    119147<table width="100%">
    120148 <tr>
    121149  <td>&nbsp;</td>
    122150  <td style="background-color:#00FF00;width:60px;height:32px;font-size:big;text-align:center;"><a
    123    href="commit?op=commit&amp;really=yes&amp;ck=<$checkpoint$>">Yes</a></td>
     151   href="commit?op=<$op$>&amp;really=yes&amp;ck=<$checkpoint$>">Yes</a></td>
    124152  <td style="background-color:#FF0000;width:60px;height:32px;font-size:big;text-align:center;"><a
    125153   href="/">No</a></td>
     
    127155 </tr>
    128156</table>
    129 %               }
    130157%       }
    131158<& footer>
Note: See TracChangeset for help on using the changeset viewer.