From 65a36bbf84c3401bc79f49290493a0913fdb4936 Mon Sep 17 00:00:00 2001 From: phildd Date: Fri, 1 Mar 2013 14:59:48 +0545 Subject: bandwidthd for nanobsd Make bandwidth on nanobsd write graph files and cdf log files to /var/bandwidthd rw memory filesystem, so it can run with /usr mounted read-only --- config/bandwidthd/bandwidthd.inc | 55 +++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 12 deletions(-) (limited to 'config') diff --git a/config/bandwidthd/bandwidthd.inc b/config/bandwidthd/bandwidthd.inc index 34532c18..c0115d81 100644 --- a/config/bandwidthd/bandwidthd.inc +++ b/config/bandwidthd/bandwidthd.inc @@ -54,6 +54,8 @@ function bandwidthd_install_config() { global $config, $g; /* bandwidthd doesn't have a way to pass a custom config path, unfortunately */ + /* the conf file must be ./etc/bandwidthd.conf relative to the current dir */ + $bandwidthd_base_dir = PKG_BANDWIDTHD_BASE; $bandwidthd_config_dir = PKG_BANDWIDTHD_BASE . "/etc"; conf_mount_rw(); @@ -143,7 +145,7 @@ function bandwidthd_install_config() { # This file was automatically generated by the pfSense # package management system. Changing this file # will lead to it being overwritten again when -# the package manage resyncs. +# the package manager resyncs. # #################################################### # Bandwidthd.conf @@ -206,18 +208,47 @@ EOF; fwrite($fd, $config_file); fclose($fd); - /* write out rc.d start/stop file */ - write_rcfile(array( - "file" => "bandwidthd.sh", - "start" => "/usr/local/bandwidthd/bandwidthd {$bandwidthd_config_dir}/bandwidthd.conf", - "stop" => "/usr/bin/killall bandwidthd" - ) - ); + $rc = array(); + $rc['file'] = 'bandwidthd.sh'; + $rc['stop'] = << " . PKG_BANDWIDTHD_BASE . "/htdocs/index.html"); + exec("/bin/rm /usr/local/www/bandwidthd"); + exec("/bin/ln -s " . $bandwidthd_htdocs_dir . " /usr/local/www/bandwidthd"); + exec("echo \"Please start bandwidthd to populate this directory.\" > " . $bandwidthd_htdocs_dir . "/index.html"); conf_mount_ro(); config_unlock(); @@ -227,4 +258,4 @@ EOF; } -?> \ No newline at end of file +?> -- cgit v1.2.3