Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightsquid - remove PBI crap #15

Merged
merged 6 commits into from
Dec 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion www/pfSense-pkg-Lightsquid/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-Lightsquid
PORTVERSION= 2.43
PORTVERSION= 2.44
CATEGORIES= www
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
94 changes: 2 additions & 92 deletions www/pfSense-pkg-Lightsquid/files/usr/local/pkg/lightsquid.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,7 @@ if (file_exists('/usr/local/pkg/squid.inc')) {
echo "No squid.inc found. You must have Squid/Squid3 package installed to use LightSquid.";
}

global $pfs_version;
$pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3);
switch ($pfs_version) {
case "2.1":
define('LIGHTSQUID_BASE', '/usr/pbi/lightsquid-' . php_uname("m"));
break;
case "2.2":
define('LIGHTSQUID_BASE', '/usr/pbi/lightsquid-' . php_uname("m") . '/local');
break;
default:
define('LIGHTSQUID_BASE', '/usr/local');
break;
}
define('LIGHTSQUID_BASE', '/usr/local');

// configuration settings !-- CHECK THIS --!
define('LS_CONFIGPATH', LIGHTSQUID_BASE . '/etc/lightsquid');
Expand Down Expand Up @@ -113,23 +101,6 @@ function lightsquid_install() {
// create lightsquid reports directory
lightsquid_create_reportdir();

// ugly PBI hacks
if (LIGHTSQUID_BASE != '/usr/local') {
// check and fix perl paths
lightsquid_fix_perl();

if (!is_dir('/usr/local/etc/lightsquid') && is_dir(LS_CONFIGPATH)) {
symlink(LS_CONFIGPATH, '/usr/local/etc/lightsquid');
}

if (is_dir('/usr/local/www/lightsquid'))
$_gc = exec('rm -rf /usr/local/www/lightsquid');

if (is_dir(LS_WWWPATH)) {
symlink(LS_WWWPATH, '/usr/local/www/lightsquid');
}
}

// template symlinks
foreach (array('novopf', 'novosea') as $tpl) {
if (is_dir(LS_TEMPLATEPATH . '/' . $tpl)) {
Expand All @@ -143,78 +114,17 @@ function lightsquid_install() {
function lightsquid_deinstall() {
// remove cronjobs
lightsquid_setup_cron(false);
// undo PBI hacks
lightsquid_unfix_perl();
if (is_dir("/usr/local/www/sqstat/")) {
mwexec("/bin/rm -rf /usr/local/www/sqstat/");
}
}

/*
* Ugly PBI hacks around perl paths; only needed for pfSense <2.3
*/
/* Create perl links on package install */
function lightsquid_fix_perl() {
if (LIGHTSQUID_BASE != '/usr/local') {
/* Clean up a broken perl link first if needed. */
$perl_path = '/usr/bin/perl';
if (file_exists($perl_path) && is_link($perl_path)) {
$target = readlink($perl_path);
if (!file_exists($target) || !is_executable($target)) {
unlink($target);
}
}
/* Find usable perl and create perl symlink to $perl_path */
if (!file_exists($perl_path)) {
if (is_executable("/usr/local/bin/perl")) {
symlink("/usr/local/bin/perl", "{$perl_path}");
} elseif (is_executable(LIGHTSQUID_BASE . "/bin/perl")) {
symlink(LIGHTSQUID_BASE . "/bin/perl", "{$perl_path}");
}
}
if (!is_dir("/usr/local/lib/perl5") && is_dir(LIGHTSQUID_BASE . "/lib/perl5")) {
symlink(LIGHTSQUID_BASE . "/lib/perl5", "/usr/local/lib/perl5");
}
}
}
/* Remove perl links on package uninstall */
function lightsquid_unfix_perl() {
if (LIGHTSQUID_BASE != '/usr/local') {
$perl_path = '/usr/bin/perl';
if (file_exists($perl_path) && is_link($perl_path)) {
$target = readlink($perl_path);
$ls_target = LIGHTSQUID_BASE . "/bin/perl";
if ($target === $ls_target) {
unlink($perl_path);
}
}
$perl_libpath = "/usr/local/lib/perl5";
if (is_dir($perl_libpath) && is_link($perl_libpath)) {
$target = readlink($perl_libpath);
$ls_target = LIGHTSQUID_BASE . "/lib/perl5";
if ($target === $ls_target) {
unlink($perl_libpath);
}
}
}
}

/*
* Package configuration routines
*/
function lightsquid_resync() {
global $config, $pfs_version;

// Ugly PBI hacks
if (LIGHTSQUID_BASE != '/usr/local') {
// check perl paths
if (!file_exists("/usr/bin/perl")) {
lightsquid_fix_perl();
}

// Fixup library path so GD can find its libraries for graphs.
mwexec("/sbin/ldconfig -m " . LIGHTSQUID_BASE . "/lib/");
}
global $config;

lightsquid_create_reportdir();
mwexec("/bin/chmod -R u+w " . LIGHTSQUID_BASE . "/etc/lightsquid");
Expand Down
9 changes: 3 additions & 6 deletions www/pfSense-pkg-Lightsquid/files/usr/local/pkg/lightsquid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@
]]>
</copyright>
<name>lightsquid</name>
<version>2.42</version>
<version>2.44</version>
<title>Squid Proxy Reports: Settings</title>
<category>Status</category>
<include_file>/usr/local/pkg/lightsquid.inc</include_file>
<menu>
<name>Squid Proxy Reports</name>
<tooltiptext>Proxy Server Statistic Reports</tooltiptext>
<section>Status</section>
<url>/pkg_edit.php?xml=lightsquid.xml</url>
</menu>
Expand Down Expand Up @@ -258,10 +257,8 @@
<description>
<![CDATA[
1/ <strong>Enable 'Access Logging' in the Squid package!</strong> It is strongly suggested to leave the 'Log Store Directory' in Squid package at default '/var/squid/logs' value.<br/><br/>
2a/ <strong>ONLY if Squid is NOT set up as transparent proxy:</strong><br/>
- Configure Squid - General - Proxy Interface(s) to include <strong>'loopback'</strong> interface (in addition to any other interfaces you want Squid to bind on).<br/>
2b/ <strong>ONLY if using Squid 2.7 package</strong> (this is not needed for Squid 3.x.):<br/>
- Add '127.0.0.1' to Squid - Access Control - External Cache-Managers.<br/><br/>
2/ <strong>ONLY if Squid is NOT set up as transparent proxy:</strong><br/>
- Configure Squid - General - Proxy Interface(s) to include <strong>'loopback'</strong> interface (in addition to any other interfaces you want Squid to bind on).<br/>
3/ <strong>Configure 'Report Template Settings' and 'Reporting Settings and Scheduler' below and Save when finished.</strong><br/><br/>
4/ <strong>Use the Refresh buttons in the 'Manual Refresh' section below to create initial LightSquid reports</strong>; otherwise you will get an error diagnostic page.<br/>
- <em>"Refresh now"</em> will (re)parse today's entries only in Squid's current access.log.<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,15 @@
<package>
<name>Lightsquid</name>
<descr><![CDATA[LightSquid is a high performance web proxy reporting tool. Includes proxy realtime statistics (SQStat).
&lt;strong&gt;Requires Squid3 or Squid package.&lt;/strong&gt;]]></descr>
&lt;strong&gt;Requires Squid3 package.&lt;/strong&gt;]]></descr>
<website>http://lightsquid.sf.net/</website>
<category>Network Management</category>
<version>2.43</version>
<version>2.44</version>
<maintainer>dv_serg@mail.ru</maintainer>
<port_category>www</port_category>
<run_depends>libexec/lightsquid/ip2name.list:www/lightsquid</run_depends>
<depends_on_package_pbi>lightsquid-1.8_2-##ARCH##.pbi</depends_on_package_pbi>
<build_pbi>
<ports_before>graphics/gd graphics/p5-GD</ports_before>
<port>www/lightsquid</port>
</build_pbi>
<build_options>lightsquid_SET_FORCE=GD;libgd_UNSET_FORCE=FONTCONFIG XPM;perl_UNSET_FORCE=MULTIPLICITY</build_options>
<status>RC</status>
<required_version>2.2</required_version>
<config_file>https://packages.pfsense.org/packages/config/lightsquid/lightsquid.xml</config_file>
<required_version>2.3</required_version>
<configurationfile>lightsquid.xml</configurationfile>
<noembedded>true</noembedded>
<after_install_info>Please visit Status - Squid Proxy Reports - Settings and read the configuration and usage instructions.</after_install_info>
</package>
</pfsensepkgs>
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ function update_stop() {
</script>

<!-- HTML start -->
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>

<?php
Expand Down Expand Up @@ -138,10 +137,7 @@ function update_stop() {
</div>

<!-- HTML end -->
<?php include("fend.inc"); ?>
</body>
</html>

<?php include("foot.inc"); ?>

<?php

Expand Down
3 changes: 1 addition & 2 deletions www/pfSense-pkg-Lightsquid/pkg-descr
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
LightSquid is a high performance web proxy reporting tool. Includes proxy
realtime statistics (SQStat).
<strong>Requires Squid3 or Squid package.</strong>
realtime statistics (SQStat). Requires Squid3 package.