Changeset 5345ae3 in freewrt for package/fwwif/extra/mgmt.ecpp
- Timestamp:
- Jul 3, 2007, 6:18:07 PM (18 years ago)
- Children:
- cb6d2db
- Parents:
- 0040a26
- File:
-
- 1 moved
-
package/fwwif/extra/mgmt.ecpp (moved) (moved from package/fwwif/extra/commit.ecpp ) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
package/fwwif/extra/mgmt.ecpp
r0040a26 r5345ae3 32 32 really; 33 33 ck; 34 op; 34 35 </%args> 35 36 <%application> 36 37 unsigned checkpoint; 37 38 </%application> 38 % runComp2(header, title, "commit to fwcf (flash)"); 39 % unsigned ick; 40 % ick = strtoul(ck.c_str(), NULL, 0); 41 % if (really == "yes" && ick && ick == checkpoint) { 42 <h1>Committing to flash…</h1> 39 <%cpp> 40 bool okay = false; 41 std::string pageheader = "management"; 42 std::string pagetitle_run, pagetitle_wrong, pagetitle_ok, utilname; 43 std::string text_wrong, text_ok; /* HTML ok in these */ 44 if (op == "commit") { 45 pageheader = "commit to fwcf (flash)"; 46 pagetitle_run = "Committing to flash"; 47 pagetitle_wrong = "Commit failed"; 48 text_wrong = "Committing to flash failed."; 49 pagetitle_ok = "Committed successfully"; 50 text_ok = "The changes to <tt>/etc</tt> were "; 51 text_ok += "successfully committed to flash using the "; 52 text_ok += "FreeWRT Configuration Filesystem."; 53 utilname = "fwcf commit"; 54 okay = true; 55 } 56 runComp2(header, title, pageheader); 57 unsigned ick; 58 ick = strtoul(ck.c_str(), NULL, 0); 59 if (!okay) { 60 </%cpp> 61 <h1>Management functions</h1> 62 <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> 65 </ul> 66 % } else if (really == "yes" && ick && ick == checkpoint) { 67 <h1><$pagetitle_run$>…</h1> 43 68 <p>Please wait…</p> 44 69 <%cpp> 45 70 int i = 0; 46 const char *s = "fwcf commit";71 const char *s; 47 72 char *text; 73 74 if (op == "commit") { 75 s = "fwcf commit"; 76 } 48 77 49 78 reply.setDirectMode(); // flush output … … 52 81 text = c_exec(s, &i); 53 82 if (i) { 83 reply.out() << "<h1>"; 84 reply.sout() << text_wrong; 85 reply.out() << "!</h1>\n<p>" << text_wrong << "</p>\n"; 86 } else { 87 reply.out() << "<h1>"; 88 reply.sout() << text_ok; 89 reply.out() << ".</h1>\n<p>" << text_ok << "</p>\n"; 90 } 54 91 </%cpp> 55 <h1>Commit failed!</h1> 56 <p>Committing to flash failed.</p> 57 % } else { 58 <h1>Committed successfully.</h1> 59 <p>The changes to <tt>/etc</tt> were successfully committed 60 to flash using the FreeWRT Configuration Filesystem.</p> 61 % } 62 <p class="blkbeg">The “fwcf commit” utility returned the following output:</p> 92 <p class="blkbeg">The “<$utilname$>” utility returned the following output:</p> 63 93 <pre class="blkmid"> 64 94 % reply.sout() << text ? (*text ? text : "(no output)") : "(null)"; 65 95 </pre><p class="blkend">The exit code was <$ WEXITSTATUS(i) $>.</p> 66 96 <p>Go <a href="javascript:back();">back</a> or to the <a href="/">index</a>.</p> 67 % } else { 68 % int i; 69 % char *changes; 70 % 71 % do { 72 % checkpoint = arc4random(); /* authorisation */ 73 % } while (!checkpoint); 74 % changes = c_exec("/sbin/fwcf status", &i); 75 % if (changes) { 97 <%cpp> 98 } else { 99 do { 100 checkpoint = arc4random(); /* authorisation */ 101 } while (!checkpoint); 102 103 if (op == "commit") { 104 int i; 105 char *changes; 106 107 changes = c_exec("/sbin/fwcf status", &i); 108 if (changes) { 109 </%cpp> 76 110 <p class="blkbeg">The following files have been modified:</p> 77 111 <pre class="blkmid"><$ *changes ? changes : "No files modified." $></pre> 78 112 <p class="blkend">Do you really want to commit all these changes 79 % free(changes);80 % } else {113 % free(changes); 114 % } else { 81 115 <h1>Commit to flash</h1> 82 116 <p>Do you really want to commit all changes to <tt>/etc</tt> 83 % }117 % } 84 118 into flash to retain them over system reboots?</p> 85 119 <table width="100%"> … … 87 121 <td> </td> 88 122 <td style="background-color:#00FF00;width:60px;height:32px;font-size:big;text-align:center;"><a 89 href="commit? really=yes&ck=<$checkpoint$>">Yes</a></td>123 href="commit?op=commit&really=yes&ck=<$checkpoint$>">Yes</a></td> 90 124 <td style="background-color:#FF0000;width:60px;height:32px;font-size:big;text-align:center;"><a 91 125 href="/">No</a></td> … … 93 127 </tr> 94 128 </table> 129 % } 95 130 % } 96 131 <& footer>
Note:
See TracChangeset
for help on using the changeset viewer.
