diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/squid-8/squid.inc | 50 | ||||
-rw-r--r-- | config/squid-8/squid.xml | 2 | ||||
-rw-r--r-- | config/squid-8/squid_cache.xml | 2 |
3 files changed, 38 insertions, 16 deletions
diff --git a/config/squid-8/squid.inc b/config/squid-8/squid.inc index 36556bbd..86fb61a0 100644 --- a/config/squid-8/squid.inc +++ b/config/squid-8/squid.inc @@ -40,6 +40,7 @@ if(!function_exists("filter_configure")) require_once("filter.inc"); define('SQUID_CONFBASE', '/usr/local/etc/squid'); +define('SQUID_BASE', '/var/squid/'); define('SQUID_ACLDIR', '/var/squid/acl'); define('SQUID_PASSWD', '/var/etc/squid.passwd'); @@ -76,6 +77,11 @@ function squid_chown_recursive($dir, $user, $group) { function squid_dash_z() { global $config; $settings = $config['installedpackages']['squidcache']['config'][0]; + + // If the cache system is null, there is no need to initialize the (irrelevant) cache dir. + if ($settings['harddisk_cache_system'] == "null") + return; + $cachedir =($settings['harddisk_cache_location'] ? $settings['harddisk_cache_location'] : '/var/squid/cache'); if(!is_dir($cachedir.'/')) { @@ -214,15 +220,16 @@ if [ -z "`ps auxw | grep "[s]quid -D"|awk '{print $2}'`" ];then EOD; update_status("Writing rc.d files... One moment please..."); + conf_mount_rw(); write_rcfile($rc); exec("chmod a+rx /usr/local/libexec/squid/dnsserver"); foreach (array( SQUID_CONFBASE, SQUID_ACLDIR, - ) as $dir) { - make_dirs($dir); - squid_chown_recursive($dir, 'proxy', 'proxy'); + SQUID_BASE ) as $dir) { + make_dirs($dir); + squid_chown_recursive($dir, 'proxy', 'proxy'); } /* kill any running proxy alarm scripts */ @@ -261,7 +268,7 @@ function squid_deinstall_command() { squid_install_cron(false); $settings = &$config['installedpackages']['squidcache']['config'][0]; $cachedir =($settings['harddisk_cache_location'] ? $settings['harddisk_cache_location'] : '/var/squid/cache'); - $logdir = ($settings['log_dir'] ? $settings['log_dir'] : '/var/squid/log'); + $logdir = ($settings['log_dir'] ? $settings['log_dir'] : '/var/squid/logs'); update_status("Removing swap.state ... One moment please..."); update_output_window("$plswait_txt"); mwexec('rm -rf $cachedir/swap.state'); @@ -611,7 +618,7 @@ function squid_resync_general() { $hostname = ($settings['visible_hostname'] ? $settings['visible_hostname'] : 'localhost'); $email = ($settings['admin_email'] ? $settings['admin_email'] : 'admin@localhost'); - $logdir = ($settings['log_dir'] ? $settings['log_dir'] : '/var/squid/log'); + $logdir = ($settings['log_dir'] ? $settings['log_dir'] : '/var/squid/logs'); $logdir_cache = $logdir . '/cache.log'; $logdir_access = ($settings['log_enabled'] == 'on' ? $logdir . '/access.log' : '/dev/null'); @@ -676,13 +683,12 @@ EOD; function squid_resync_cache() { - global $config; + global $config, $g; $settings = $config['installedpackages']['squidcache']['config'][0]; $cachedir =($settings['harddisk_cache_location'] ? $settings['harddisk_cache_location'] : '/var/squid/cache'); $disk_cache_size = ($settings['harddisk_cache_size'] ? $settings['harddisk_cache_size'] : 100); - $disk_cache_system = ($settings['harddisk_cache_system'] ? $settings['harddisk_cache_system'] : 'aufs'); $level1 = ($settings['level1_subdirs'] ? $settings['level1_subdirs'] : 16); $memory_cache_size = ($settings['memory_cache_size'] ? $settings['memory_cache_size'] : 8); $max_objsize = ($settings['maximum_object_size'] ? $settings['maximum_object_size'] : 10); @@ -691,6 +697,16 @@ function squid_resync_cache() { $memory_policy = ($settings['memory_replacement_policy'] ? $settings['memory_replacement_policy'] : 'heap GDSF'); $offline_mode = ($settings['enable_offline'] == 'on' ? 'on' : 'off'); + if (!isset($settings['harddisk_cache_system'])) { + if ($g['platform'] == "nanobsd") { + $disk_cache_system = 'null'; + } else { + $disk_cache_system = 'aufs'; + } + } else { + $disk_cache_system = $settings['harddisk_cache_system']; + } + if ($disk_cache_system == "null") { $disk_cache_opts = "{$disk_cache_system} /tmp"; } else { @@ -1086,9 +1102,9 @@ function squid_resync() { foreach (array( SQUID_CONFBASE, SQUID_ACLDIR, - ) as $dir) { - make_dirs($dir); - squid_chown_recursive($dir, 'proxy', 'proxy'); + SQUID_BASE ) as $dir) { + make_dirs($dir); + squid_chown_recursive($dir, 'proxy', 'proxy'); } file_put_contents(SQUID_CONFBASE . '/squid.conf', $conf); @@ -1105,12 +1121,17 @@ function squid_resync() { if (!is_service_running('squid')) { log_error("Starting Squid"); - mwexec_bg("/usr/local/sbin/squid -D"); + mwexec("/usr/local/sbin/squid -D"); } else { log_error("Reloading Squid for configuration sync"); mwexec("/usr/local/sbin/squid -k reconfigure"); } + // Sleep for a couple seconds to give squid a chance to fire up fully. + for ($i=0; $i < 10; $i++) { + if (!is_service_running('squid')) + sleep(1); + } filter_configure(); conf_mount_ro(); } @@ -1242,12 +1263,13 @@ function squid_generate_rules($type) { global $config; $squid_conf = $config['installedpackages']['squid']['config'][0]; - if (!is_service_running('squid')) { - log_error("SQUID is installed but not started. Not installing redirect rules."); + + if (($squid_conf['transparent_proxy'] != 'on') || ($squid_conf['allow_interface'] != 'on')) { return; } - if (($squid_conf['transparent_proxy'] != 'on') || ($squid_conf['allow_interface'] != 'on')) { + if (!is_service_running('squid')) { + log_error("SQUID is installed but not started. Not installing \"{$type}\" rules."); return; } diff --git a/config/squid-8/squid.xml b/config/squid-8/squid.xml index f79cc8d2..e83800f0 100644 --- a/config/squid-8/squid.xml +++ b/config/squid-8/squid.xml @@ -195,7 +195,7 @@ <type>input</type> <size>60</size> <required/> - <default_value>/var/squid/log</default_value> + <default_value>/var/squid/logs</default_value> </field> <field> <fielddescr>Log rotate</fielddescr> diff --git a/config/squid-8/squid_cache.xml b/config/squid-8/squid_cache.xml index 2a4b7e3d..8fb310cf 100644 --- a/config/squid-8/squid_cache.xml +++ b/config/squid-8/squid_cache.xml @@ -92,7 +92,7 @@ <field> <fielddescr>Hard disk cache system</fielddescr> <fieldname>harddisk_cache_system</fieldname> - <description>This specifies the kind of storage system to use. <p> <b> ufs </b> is the old well-known Squid storage format that has always been there. <p> <b> aufs </b> uses POSIX-threads to avoid blocking the main Squid process on disk-I/O. (Formerly known as async-io.) <p> <b> diskd </b> uses a separate process to avoid blocking the main Squid process on disk-I/O. <p> <b> null </b> Does not use any storage.</description> + <description>This specifies the kind of storage system to use. <p> <b> ufs </b> is the old well-known Squid storage format that has always been there. <p> <b> aufs </b> uses POSIX-threads to avoid blocking the main Squid process on disk-I/O. (Formerly known as async-io.) <p> <b> diskd </b> uses a separate process to avoid blocking the main Squid process on disk-I/O. <p> <b> null </b> Does not use any storage. Ideal for Embedded/NanoBSD.</description> <type>select</type> <default_value>aufs</default_value> <options> |