Revision 4c951cc9
Added by Matthew Grooms almost 17 years ago
usr/local/www/pkg_mgr_install.php | ||
---|---|---|
52 | 52 |
|
53 | 53 |
<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> |
54 | 54 |
<?php include("fbegin.inc"); ?> |
55 |
<form action="pkg_mgr_install.php" method="post"> |
|
56 |
|
|
57 |
<?php if ($savemsg) print_info_box($savemsg); ?> |
|
58 |
<?php |
|
59 |
?> |
|
60 |
<div id="mainareapkg"> |
|
61 |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td> |
|
62 |
<?php |
|
63 |
$version = file_get_contents("/etc/version"); |
|
64 |
$tab_array = array(); |
|
65 |
$tab_array[] = array("Available {$version} packages", false, "pkg_mgr.php"); |
|
66 |
$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none"); |
|
67 |
/* $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other"); */ |
|
68 |
$tab_array[] = array("Installed packages", false, "pkg_mgr_installed.php"); |
|
69 |
$tab_array[] = array("Package Installer", true, ""); |
|
70 |
display_top_tabs($tab_array); |
|
71 |
?> |
|
72 |
</td></tr> |
|
73 |
<tr> |
|
74 |
<td class="tabcont"> |
|
75 |
<table width="100%" border="0" cellpadding="6" cellspacing="0"> |
|
76 |
<tr> |
|
77 |
<td> |
|
78 |
<center> |
|
79 |
<table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'> |
|
55 |
<form action="pkg_mgr_install.php" method="post"> |
|
56 |
<div id="mainareapkg"> |
|
57 |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
|
80 | 58 |
<tr> |
81 |
<td background="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height='15' width='5'> |
|
82 |
</td> |
|
83 | 59 |
<td> |
84 |
<table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'><td background="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" valign="top" align="left"><img src='./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'></td></table> |
|
60 |
<?php |
|
61 |
$version = file_get_contents("/etc/version"); |
|
62 |
$tab_array = array(); |
|
63 |
$tab_array[] = array("Available {$version} packages", false, "pkg_mgr.php"); |
|
64 |
$tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none"); |
|
65 |
// $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other"); |
|
66 |
$tab_array[] = array("Installed packages", false, "pkg_mgr_installed.php"); |
|
67 |
$tab_array[] = array("Package Installer", true, ""); |
|
68 |
display_top_tabs($tab_array); |
|
69 |
?> |
|
85 | 70 |
</td> |
86 |
<td background="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height='15' width='5'> |
|
71 |
</tr> |
|
72 |
<tr> |
|
73 |
<td class="tabcont"> |
|
74 |
<center> |
|
75 |
<table height='15' width='420' border='0' colspacing='0' cellpadding='0' cellspacing='0'> |
|
76 |
<tr> |
|
77 |
<td background="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height='15' width='5'> |
|
78 |
</td> |
|
79 |
<td> |
|
80 |
<table id="progholder" name="progholder" height='15' width='410' border='0' colspacing='0' cellpadding='0' cellspacing='0'> |
|
81 |
<td background="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" valign="top" align="left"> |
|
82 |
<img src='./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'> |
|
83 |
</td> |
|
84 |
</table> |
|
85 |
</td> |
|
86 |
<td background="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height='15' width='5'> |
|
87 |
</td> |
|
88 |
</tr> |
|
89 |
</table> |
|
90 |
<br> |
|
91 |
<!-- status box --> |
|
92 |
<textarea cols="60" rows="1" name="status" id="status" wrap="hard"> |
|
93 |
Beginning package installation. |
|
94 |
</textarea> |
|
95 |
<!-- command output box --> |
|
96 |
<textarea cols="60" rows="25" name="output" id="output" wrap="hard"> |
|
97 |
</textarea> |
|
98 |
</center> |
|
87 | 99 |
</td> |
88 | 100 |
</tr> |
89 | 101 |
</table> |
90 |
<br> |
|
91 |
<!-- status box --> |
|
92 |
<textarea cols="60" rows="1" name="status" id="status" wrap="hard">Beginning package installation.</textarea> |
|
93 |
<!-- command output box --> |
|
94 |
<textarea cols="60" rows="25" name="output" id="output" wrap="hard"></textarea> |
|
95 |
</center> |
|
96 |
</td> |
|
97 |
</tr> |
|
98 |
</table> |
|
99 |
</td> |
|
100 |
</tr> |
|
101 |
</table> |
|
102 |
</div> |
|
103 |
</form> |
|
102 |
</div> |
|
103 |
</form> |
|
104 | 104 |
<?php include("fend.inc"); ?> |
105 |
|
|
106 | 105 |
<script type="text/javascript"> |
107 | 106 |
NiftyCheck(); |
108 | 107 |
Rounded("div#mainareapkg","bl br","#FFF","#eeeeee","smooth"); |
109 | 108 |
</script> |
110 |
|
|
111 | 109 |
</body> |
112 | 110 |
</html> |
113 | 111 |
|
... | ... | |
121 | 119 |
|
122 | 120 |
switch($_GET['mode']) { |
123 | 121 |
case "delete": |
124 |
$id = get_pkg_id($_GET['pkg']);
|
|
125 |
$todel = substr(reverse_strrchr($config['installedpackages']['package'][$id]['depends_on_package'], "."), 0, -1);
|
|
126 |
delete_package($todel, htmlspecialchars($_GET['pkg']));
|
|
127 |
delete_package_xml(htmlspecialchars($_GET['pkg']));
|
|
128 |
update_status("Package deleted.");
|
|
129 |
$static_output .= "\nPackage deleted.";
|
|
130 |
update_output_window($static_output);
|
|
131 |
break;
|
|
122 |
$id = get_pkg_id($_GET['pkg']);
|
|
123 |
$todel = substr(reverse_strrchr($config['installedpackages']['package'][$id]['depends_on_package'], "."), 0, -1);
|
|
124 |
delete_package($todel, htmlspecialchars($_GET['pkg']));
|
|
125 |
delete_package_xml(htmlspecialchars($_GET['pkg']));
|
|
126 |
update_status("Package deleted.");
|
|
127 |
$static_output .= "\nPackage deleted.";
|
|
128 |
update_output_window($static_output);
|
|
129 |
break;
|
|
132 | 130 |
case "showlog": |
133 |
$id = htmlspecialchars($_GET['pkg']);
|
|
134 |
if(strpos($id, "."))
|
|
135 |
exit;
|
|
136 |
update_output_window(file_get_contents("/tmp/pkg_mgr_{$id}.log"));
|
|
137 |
break;
|
|
131 |
$id = htmlspecialchars($_GET['pkg']);
|
|
132 |
if(strpos($id, "."))
|
|
133 |
exit; |
|
134 |
update_output_window(file_get_contents("/tmp/pkg_mgr_{$id}.log")); |
|
135 |
break; |
|
138 | 136 |
case "reinstallpkg": |
139 |
$id = get_pkg_id(htmlspecialchars($_GET['pkg']));
|
|
140 |
$todel = substr(reverse_strrchr($config['installedpackages']['package'][$id]['depends_on_package'], "."), 0, -1);
|
|
141 |
delete_package($todel, htmlspecialchars($_GET['pkg']));
|
|
142 |
delete_package_xml(htmlspecialchars($_GET['pkg']));
|
|
143 |
install_package(htmlspecialchars($_GET['pkg']));
|
|
144 |
update_status("Package reinstalled.");
|
|
145 |
$static_output .= "\n\nPackage reinstalled.";
|
|
146 |
start_service(htmlspecialchars($_GET['pkg']));
|
|
147 |
update_output_window($static_output);
|
|
148 |
break;
|
|
137 |
$id = get_pkg_id(htmlspecialchars($_GET['pkg']));
|
|
138 |
$todel = substr(reverse_strrchr($config['installedpackages']['package'][$id]['depends_on_package'], "."), 0, -1);
|
|
139 |
delete_package($todel, htmlspecialchars($_GET['pkg']));
|
|
140 |
delete_package_xml(htmlspecialchars($_GET['pkg']));
|
|
141 |
install_package(htmlspecialchars($_GET['pkg']));
|
|
142 |
update_status("Package reinstalled.");
|
|
143 |
$static_output .= "\n\nPackage reinstalled.";
|
|
144 |
start_service(htmlspecialchars($_GET['pkg']));
|
|
145 |
update_output_window($static_output);
|
|
146 |
break;
|
|
149 | 147 |
case "reinstallxml": |
150 |
delete_package_xml(htmlspecialchars($_GET['pkg']));
|
|
151 |
install_package(htmlspecialchars($_GET['pkg']));
|
|
152 |
$static_output .= "\n\nPackage reinstalled.";
|
|
153 |
start_service(htmlspecialchars($_GET['pkg']));
|
|
154 |
update_output_window($static_output);
|
|
155 |
break;
|
|
148 |
delete_package_xml(htmlspecialchars($_GET['pkg']));
|
|
149 |
install_package(htmlspecialchars($_GET['pkg']));
|
|
150 |
$static_output .= "\n\nPackage reinstalled.";
|
|
151 |
start_service(htmlspecialchars($_GET['pkg']));
|
|
152 |
update_output_window($static_output);
|
|
153 |
break;
|
|
156 | 154 |
case "reinstallall": |
157 |
if($config['installedpackages']['package'])
|
|
155 |
if ($config['installedpackages']['package'])
|
|
158 | 156 |
exec("rm -rf /var/db/pkg/*"); |
159 |
foreach($config['installedpackages']['package'] as $package) |
|
160 |
$todo[] = array('name' => $package['name'], 'version' => $package['version']); |
|
161 |
$pkg_id = 0; |
|
162 |
foreach($todo as $pkgtodo) { |
|
163 |
$static_output = ""; |
|
164 |
if($pkgtodo['name']) { |
|
165 |
update_output_window($static_output); |
|
166 |
delete_package($pkgtodo['name'] . '-' . $pkgtodo['version'], $pkg_id); |
|
167 |
delete_package_xml($pkgtodo['name']); |
|
168 |
install_package($pkgtodo['name']); |
|
169 |
$pkg_id++; |
|
170 |
} |
|
171 |
} |
|
172 |
update_status("All packages reinstalled."); |
|
173 |
$static_output .= "\n\nAll packages reinstalled."; |
|
174 |
start_service(htmlspecialchars($_GET['pkg'])); |
|
175 |
update_output_window($static_output); |
|
176 |
break; |
|
157 |
if (is_array($config['installedpackages']['package'])) |
|
158 |
foreach($config['installedpackages']['package'] as $package) |
|
159 |
$todo[] = array('name' => $package['name'], 'version' => $package['version']); |
|
160 |
$pkg_id = 0; |
|
161 |
foreach($todo as $pkgtodo) { |
|
162 |
$static_output = ""; |
|
163 |
if($pkgtodo['name']) { |
|
164 |
update_output_window($static_output); |
|
165 |
delete_package($pkgtodo['name'] . '-' . $pkgtodo['version'], $pkg_id); |
|
166 |
delete_package_xml($pkgtodo['name']); |
|
167 |
install_package($pkgtodo['name']); |
|
168 |
$pkg_id++; |
|
169 |
} |
|
170 |
} |
|
171 |
update_status("All packages reinstalled."); |
|
172 |
$static_output .= "\n\nAll packages reinstalled."; |
|
173 |
start_service(htmlspecialchars($_GET['pkg'])); |
|
174 |
update_output_window($static_output); |
|
175 |
break; |
|
177 | 176 |
default: |
178 |
$status = install_package(htmlspecialchars($_GET['id']));
|
|
179 |
if($status == -1) {
|
|
180 |
update_status("Installation of " . htmlspecialchars($_GET['id']) . " FAILED!"); |
|
181 |
$static_output .= "\n\nInstallation halted.";
|
|
182 |
} else {
|
|
177 |
$status = install_package(htmlspecialchars($_GET['id']));
|
|
178 |
if($status == -1) {
|
|
179 |
update_status("Installation of " . htmlspecialchars($_GET['id']) . " FAILED!");
|
|
180 |
$static_output .= "\n\nInstallation halted.";
|
|
181 |
} else {
|
|
183 | 182 |
update_status("Installation of " . htmlspecialchars($_GET['id']) . " completed."); |
184 | 183 |
$static_output .= "\n\nInstallation completed. Please check to make sure that the package is configured from the respective menu then start the package."; |
185 |
} |
|
186 |
update_output_window($static_output); |
|
187 |
|
|
184 |
} |
|
185 |
update_output_window($static_output); |
|
188 | 186 |
} |
189 | 187 |
|
190 | 188 |
// Delete all temporary package tarballs and staging areas. |
Also available in: Unified diff
Whitespace and minor bug fixes for package manager pages.