1 |
ee11cc6e
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
|
|
<?php
|
3 |
|
|
/*
|
4 |
|
|
pkg_mgr.php
|
5 |
b49448ac
|
Scott Ullrich
|
Copyright (C) 2004, 2005 Scott Ullrich
|
6 |
ee11cc6e
|
Scott Ullrich
|
All rights reserved.
|
7 |
|
|
|
8 |
|
|
Redistribution and use in source and binary forms, with or without
|
9 |
|
|
modification, are permitted provided that the following conditions are met:
|
10 |
|
|
|
11 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
12 |
|
|
this list of conditions and the following disclaimer.
|
13 |
|
|
|
14 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
15 |
|
|
notice, this list of conditions and the following disclaimer in the
|
16 |
|
|
documentation and/or other materials provided with the distribution.
|
17 |
|
|
|
18 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
|
|
require("guiconfig.inc");
|
31 |
|
|
require("xmlparse_pkg.inc");
|
32 |
|
|
|
33 |
|
|
$a_out = &$pkg_config['packages'];
|
34 |
|
|
|
35 |
|
|
if ($_POST) {
|
36 |
|
|
|
37 |
|
|
$pconfig = $_POST;
|
38 |
|
|
|
39 |
|
|
$retval = 0;
|
40 |
|
|
|
41 |
|
|
if (!file_exists($d_sysrebootreqd_path)) {
|
42 |
|
|
config_lock();
|
43 |
|
|
$retval |= filter_configure();
|
44 |
|
|
config_unlock();
|
45 |
|
|
}
|
46 |
|
|
$savemsg = get_std_save_message($retval);
|
47 |
|
|
|
48 |
|
|
if ($retval == 0) {
|
49 |
|
|
if (file_exists($d_natconfdirty_path))
|
50 |
|
|
unlink($d_natconfdirty_path);
|
51 |
|
|
if (file_exists($d_filterconfdirty_path))
|
52 |
|
|
unlink($d_filterconfdirty_path);
|
53 |
|
|
}
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
?>
|
57 |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
58 |
|
|
<html>
|
59 |
|
|
<head>
|
60 |
|
|
<title><?=gentitle("System: Package Manager");?></title>
|
61 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
62 |
|
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
63 |
|
|
</head>
|
64 |
|
|
|
65 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
66 |
859329c8
|
Scott Ullrich
|
<?php
|
67 |
|
|
include("fbegin.inc");
|
68 |
|
|
?>
|
69 |
ee11cc6e
|
Scott Ullrich
|
<p class="pgtitle">System: Package Manager</p>
|
70 |
|
|
<form action="firewall_nat_out_load_balancing.php" method="post">
|
71 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
72 |
|
|
<?php
|
73 |
859329c8
|
Scott Ullrich
|
|
74 |
|
|
// Allow package location to be overriden
|
75 |
|
|
$config_location = "http://www.pfsense.com/packages/pkg_config.xml";
|
76 |
175ac6e4
|
Scott Ullrich
|
if($config['package_location'])
|
77 |
|
|
$config_location = $config['package_location'];
|
78 |
859329c8
|
Scott Ullrich
|
|
79 |
6c9927fd
|
Bill Marquette
|
if(!file_exists("{$g['tmp_path']}/pkg_config.xml")) {
|
80 |
859329c8
|
Scott Ullrich
|
mwexec("cd {$g['tmp_path']} && /usr/bin/fetch \"" . $config_location . "\" >/dev/null 2>&1 ");
|
81 |
ee11cc6e
|
Scott Ullrich
|
if(!file_exists("{$g['tmp_path']}/pkg_config.xml")) {
|
82 |
|
|
print_info_box_np("Could not download pkg_config.xml from pfSense.com. Check your DNS settings.");
|
83 |
|
|
die;
|
84 |
|
|
}
|
85 |
|
|
}
|
86 |
|
|
|
87 |
75c75837
|
Scott Ullrich
|
$pkg_config = parse_xml_config_pkg("{$g['tmp_path']}/pkg_config.xml", "pfsensepkgs");
|
88 |
ee11cc6e
|
Scott Ullrich
|
|
89 |
|
|
if(!$pkg_config['packages']) {
|
90 |
|
|
print_info_box_np("Could not find any packages in pkg_config.xml");
|
91 |
|
|
}
|
92 |
|
|
?>
|
93 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td>
|
94 |
|
|
<ul id="tabnav">
|
95 |
|
|
<li class="tabact">Available Packages</a></li>
|
96 |
|
|
<li class="tabinact"><a href="pkg_mgr_installed.php">Installed Packages</a></li>
|
97 |
|
|
</ul>
|
98 |
|
|
</td></tr>
|
99 |
|
|
<tr>
|
100 |
|
|
<td class="tabcont">
|
101 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
102 |
|
|
<tr>
|
103 |
a15a15e7
|
Scott Ullrich
|
<td width="10%" class="listhdrr">Package Name</td>
|
104 |
ee11cc6e
|
Scott Ullrich
|
<td width="25%" class="listhdrr">Category</td>
|
105 |
689b5e7b
|
Scott Ullrich
|
<td width="5%" class="listhdrr">Status</td>
|
106 |
ee11cc6e
|
Scott Ullrich
|
<td width="50%" class="listhdr">Description</td>
|
107 |
|
|
</tr>
|
108 |
|
|
|
109 |
|
|
<?php
|
110 |
|
|
$i = 0;
|
111 |
|
|
foreach ($pkg_config['packages']['package'] as $pkg) {
|
112 |
175ac6e4
|
Scott Ullrich
|
$pkgname = "";
|
113 |
|
|
$pkgname = $pkg['name'];
|
114 |
|
|
if($config['installedpackages']['package']) {
|
115 |
|
|
foreach ($config['installedpackages']['package'] as $installed) {
|
116 |
ee11cc6e
|
Scott Ullrich
|
if($installed['name'] == $pkg['name'])
|
117 |
175ac6e4
|
Scott Ullrich
|
$pkgname = "";
|
118 |
ee11cc6e
|
Scott Ullrich
|
}
|
119 |
|
|
}
|
120 |
175ac6e4
|
Scott Ullrich
|
if($pkgname <> "") {
|
121 |
ee11cc6e
|
Scott Ullrich
|
?>
|
122 |
|
|
<tr valign="top">
|
123 |
|
|
<td class="listlr">
|
124 |
6d543069
|
Scott Ullrich
|
<A target="_new" href="<?= $pkg['website'] ?>"><?= $pkg['name'] ?></a>
|
125 |
ee11cc6e
|
Scott Ullrich
|
</td>
|
126 |
|
|
<td class="listlr">
|
127 |
|
|
<?= $pkg['category'] ?>
|
128 |
689b5e7b
|
Scott Ullrich
|
</td>
|
129 |
|
|
<td class="listlr">
|
130 |
e46ea289
|
Scott Ullrich
|
<?= $pkg['status'] ?>
|
131 |
1677823e
|
Scott Ullrich
|
<br>
|
132 |
|
|
<?= $pkg['version'] ?>
|
133 |
ee11cc6e
|
Scott Ullrich
|
</td>
|
134 |
|
|
<td class="listbg">
|
135 |
|
|
<font color="#FFFFFFF">
|
136 |
|
|
<?= $pkg['descr'] ?>
|
137 |
|
|
</td>
|
138 |
|
|
<td valign="middle" class="list" nowrap>
|
139 |
1a05a4ee
|
Scott Ullrich
|
<a onclick="return confirm('Do you really want to install this package?')" href="pkg_mgr_install.php?id=<?=$i;?>"><img src="plus.gif" width="17" height="17" border="0"></a>
|
140 |
ee11cc6e
|
Scott Ullrich
|
</td>
|
141 |
|
|
</tr>
|
142 |
|
|
<?php
|
143 |
|
|
}
|
144 |
c6d21e77
|
Scott Ullrich
|
$i++;
|
145 |
ee11cc6e
|
Scott Ullrich
|
}
|
146 |
ee5fdafc
|
Scott Ullrich
|
if($i == 0) {
|
147 |
|
|
echo "<tr><td colspan=\"3\"><center>There are currently no available packages for installation.</td></tr>";
|
148 |
|
|
}
|
149 |
ee11cc6e
|
Scott Ullrich
|
?>
|
150 |
|
|
</table>
|
151 |
|
|
</td>
|
152 |
|
|
</tr>
|
153 |
|
|
</table>
|
154 |
|
|
</form>
|
155 |
|
|
<?php include("fend.inc"); ?>
|
156 |
|
|
</body>
|
157 |
|
|
</html>
|
158 |
|
|
|
159 |
6c9927fd
|
Bill Marquette
|
<?php system("rm {$g['tmp_path']}/pkg*"); ?>
|