Revision e44e5f3a
Added by Jim Pingle over 14 years ago
usr/local/www/pkg_mgr.php | ||
---|---|---|
80 | 80 |
<tr> |
81 | 81 |
<td> |
82 | 82 |
<?php |
83 |
$version = file_get_contents("/etc/version"); |
|
84 |
$dash = strpos($version, "."); |
|
85 |
$hyphen = strpos($version, "-"); |
|
86 |
$major = substr($version, 0, $dash); |
|
87 |
$minor = substr($version, $dash + 1, $hyphen - $dash - 1); |
|
88 |
$testing_version = substr($version, $hyphen + 1, strlen($version) - $hyphen); |
|
83 |
$version = rtrim(file_get_contents("/etc/version")); |
|
89 | 84 |
|
90 | 85 |
$tab_array = array(); |
91 | 86 |
$tab_array[] = array(gettext("Available Packages"), $requested_version <> "" ? false : true, "pkg_mgr.php"); |
... | ... | |
113 | 108 |
if(!$pkg_info) { |
114 | 109 |
echo "<tr><td colspan=\"5\"><center>" . gettext("There are currently no packages available for installation.") . "</td></tr>"; |
115 | 110 |
} else { |
116 |
$installed_pfsense_version = rtrim(file_get_contents("/etc/version")); |
|
117 |
$dash = strpos($installed_pfsense_version, "-"); |
|
118 |
$installed_pfsense_version = substr($installed_pfsense_version, 0, $dash); |
|
119 | 111 |
$pkgs = array(); |
120 | 112 |
$instpkgs = array(); |
121 | 113 |
if($config['installedpackages']['package'] != "") |
... | ... | |
134 | 126 |
if($g['platform'] == "nanobsd") |
135 | 127 |
if($index['noembedded']) |
136 | 128 |
continue; |
137 |
$dash = strpos($index['required_version'], "-"); |
|
138 |
$index['major_version'] = substr($index['required_version'], 0, $dash); |
|
129 |
/* If we are on not on HEAD, and the package wants it, skip */ |
|
139 | 130 |
if ($version <> "HEAD" && |
140 | 131 |
$index['required_version'] == "HEAD" && |
141 | 132 |
$requested_version <> "other") |
142 | 133 |
continue; |
134 |
/* If there is no required version, and the requested package |
|
135 |
version is not 'none', then skip */ |
|
143 | 136 |
if (empty($index['required_version']) && |
144 | 137 |
$requested_version <> "none") |
145 | 138 |
continue; |
146 |
if($index['major_version'] > $major && |
|
147 |
$requested_version <> "other") |
|
148 |
continue; |
|
149 |
if(isset($index['major_version']) && |
|
150 |
$requested_version == "none") |
|
139 |
/* If the requested version is not 'other', and the required version is newer than what we have, skip. */ |
|
140 |
if($requested_version <> "other" && |
|
141 |
(pfs_version_compare("", $version, $index['required_version']) < 0)) |
|
151 | 142 |
continue; |
152 |
if($index['major_version'] == $major && |
|
153 |
$requested_version == "other") |
|
143 |
/* If the requestion version is 'other' and we are on the version requested, skip. */ |
|
144 |
if($requested_version == "other" && |
|
145 |
(pfs_version_compare("", $version, $index['required_version']) == 0)) |
|
154 | 146 |
continue; |
155 |
/* Package is for a newer version, lets skip */ |
|
156 |
if($installed_pfsense_version < $index['required_version']) |
|
147 |
/* Package is only for an older version, lets skip */ |
|
148 |
if($index['maximum_version'] && |
|
149 |
(pfs_version_compare("", $version, $index['maximum_version']) > 0)) |
|
157 | 150 |
continue; |
158 |
if($index['maximum_version']) |
|
159 |
if($installed_pfsense_version > $index['maximum_version']) |
|
160 |
continue; |
|
161 | 151 |
?> |
162 | 152 |
<tr valign="top"> |
163 | 153 |
<td class="listlr"> |
Also available in: Unified diff
Simplify package version checking code and use the existing pfs_version_compare function that does much (and more) of what the old code was trying to do on its own.