1
|
#!/usr/local/bin/php
|
2
|
<?php
|
3
|
/*
|
4
|
pkg_mgr.php
|
5
|
Copyright (C) 2004 Scott Ullrich
|
6
|
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
|
<?php
|
67
|
$config_tmp = $config;
|
68
|
$config = $pfSense_config;
|
69
|
include("fbegin.inc");
|
70
|
$config = $config_tmp;
|
71
|
?>
|
72
|
<p class="pgtitle">System: Package Manager</p>
|
73
|
<form action="firewall_nat_out_load_balancing.php" method="post">
|
74
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
75
|
<?php
|
76
|
$configa = $config;
|
77
|
|
78
|
// Allow package location to be overriden
|
79
|
$config_location = "http://www.pfsense.com/packages/pkg_config.xml";
|
80
|
if($configa['package_location'])
|
81
|
$config_location = $configa['package_location'];
|
82
|
|
83
|
if(!file_exists("/tmp/pkg_config.xml")) {
|
84
|
mwexec("cd {$g['tmp_path']} && /usr/bin/fetch \"" . $config_location . "\" >/dev/null 2>&1 ");
|
85
|
if(!file_exists("{$g['tmp_path']}/pkg_config.xml")) {
|
86
|
print_info_box_np("Could not download pkg_config.xml from pfSense.com. Check your DNS settings.");
|
87
|
die;
|
88
|
}
|
89
|
}
|
90
|
|
91
|
$pkg_config = parse_xml_config("{$g['tmp_path']}/pkg_config.xml", "pfsensepkgs");
|
92
|
|
93
|
if(!$pkg_config['packages']) {
|
94
|
print_info_box_np("Could not find any packages in pkg_config.xml");
|
95
|
}
|
96
|
?>
|
97
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td>
|
98
|
<ul id="tabnav">
|
99
|
<li class="tabact">Available Packages</a></li>
|
100
|
<li class="tabinact"><a href="pkg_mgr_installed.php">Installed Packages</a></li>
|
101
|
</ul>
|
102
|
</td></tr>
|
103
|
<tr>
|
104
|
<td class="tabcont">
|
105
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
106
|
<tr>
|
107
|
<td width="25%" class="listhdrr">Package Name</td>
|
108
|
<td width="25%" class="listhdrr">Category</td>
|
109
|
<td width="50%" class="listhdr">Description</td>
|
110
|
</tr>
|
111
|
|
112
|
<?php
|
113
|
$i = 0;
|
114
|
foreach ($pkg_config['packages']['package'] as $pkg) {
|
115
|
if(is_array($configa['installedpackages']['package'])) {
|
116
|
foreach ($configa['installedpackages']['package'] as $installed) {
|
117
|
if($installed['name'] == $pkg['name'])
|
118
|
$pkg['name'] = "";
|
119
|
}
|
120
|
}
|
121
|
if($pkg['name'] <> "") {
|
122
|
?>
|
123
|
<tr valign="top">
|
124
|
<td class="listlr">
|
125
|
<?= $pkg['name'] ?>
|
126
|
</td>
|
127
|
<td class="listlr">
|
128
|
<?= $pkg['category'] ?>
|
129
|
</td>
|
130
|
<td class="listbg">
|
131
|
<font color="#FFFFFFF">
|
132
|
<?= $pkg['descr'] ?>
|
133
|
</td>
|
134
|
<td valign="middle" class="list" nowrap>
|
135
|
<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>
|
136
|
</td>
|
137
|
</tr>
|
138
|
<?php
|
139
|
}
|
140
|
$i++;
|
141
|
}
|
142
|
if($i == 0) {
|
143
|
echo "<tr><td colspan=\"3\"><center>There are currently no available packages for installation.</td></tr>";
|
144
|
}
|
145
|
?>
|
146
|
</table>
|
147
|
</td>
|
148
|
</tr>
|
149
|
</table>
|
150
|
</form>
|
151
|
<?php include("fend.inc"); ?>
|
152
|
</body>
|
153
|
</html>
|
154
|
|
155
|
<?php system("rm /tmp/pkg*"); ?>
|
156
|
|