summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-06-27 15:24:58 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-06-27 15:24:58 +0000
commitc23a386eb73b16c26ef8fcb98b879f48b6a5f512 (patch)
tree82c8e43622a5df7213e97029c122c7c85d013e79 /applications
parent6411c89b4ccfc148062a80abe18c9729fbb35462 (diff)
applications/luci-statistics: prepare lucid configuration on firstboot
Diffstat (limited to 'applications')
-rwxr-xr-xapplications/luci-statistics/root/etc/init.d/luci_statistics28
1 files changed, 25 insertions, 3 deletions
diff --git a/applications/luci-statistics/root/etc/init.d/luci_statistics b/applications/luci-statistics/root/etc/init.d/luci_statistics
index 21ed41eadb..b33536441e 100755
--- a/applications/luci-statistics/root/etc/init.d/luci_statistics
+++ b/applications/luci-statistics/root/etc/init.d/luci_statistics
@@ -1,6 +1,27 @@
#!/bin/sh /etc/rc.common
START=79
+boot() {
+ ### prepare publisher
+ if ! uci get lucid.rrdimg >/dev/null 2>/dev/null; then
+ uci batch <<-EOF
+set lucid.rrdimg=DirectoryPublisher
+set lucid.rrdimg.name='Statistics Images'
+set lucid.rrdimg.physical=/tmp/rrdimg
+set lucid.rrdimg.virtual=/rrdimg
+set lucid.rrdimg.domain=''
+
+add_list lucid.http.publisher=rrdimg
+add_list lucid.https.publisher=rrdimg
+
+commit lucid
+EOF
+ /etc/init.d/lucid restart
+ fi
+
+ start
+}
+
start() {
### replace shipped config with symlink
if [ ! -L /etc/collectd.conf ]; then
@@ -13,9 +34,10 @@ start() {
/usr/bin/stat-genconfig > /var/etc/collectd.conf
### prepare rrdimg directory
- if [ ! -L /www/rrdimg ]; then
- imagepath="$(uci get luci_statistics.rrdtool.image_path)"
- ln -s ${imagepath:-/tmp/rrdimg}/ /www/rrdimg
+ if [ "$(uci get luci_statistics.rrdtool.image_path 2>/dev/null)" != "$(uci get lucid.rrdimg.physical 2>/dev/null)" ]; then
+ uci set lucid.rrdimg.physical=$(uci get luci_statistics.rrdtool.image_path)
+ uci commit lucid
+ /etc/init.d/lucid restart
fi
### flush LuCI index cache