PKG_NAME:=znc
PKG_VERSION:=0.098
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://znc.in/releases
define Package/znc-mod-$(strip $(1))/install
$(INSTALL_DIR) $$(1)/usr/lib/znc/
$(INSTALL_BIN) $$(PKG_BUILD_DIR)/modules/$(strip $(3))$(subst -,_,$(strip $(1))).so $$(1)/usr/lib/znc/
+ # include webadmin page templates if existing
+ if [ -d $$(PKG_BUILD_DIR)/modules/$(strip $(3))$(subst -,_,$(strip $(1))) ]; then \
+ $(INSTALL_DIR) $$(1)/usr/share/znc/ ;\
+ $(CP) -r $$(PKG_BUILD_DIR)/modules/$(strip $(3))$(subst -,_,$(strip $(1))) $$(1)/usr/share/znc/ ;\
+ fi
endef
ZNC_MODULES += znc-mod-$(strip $(1))
$(if $(CONFIG_PACKAGE_znc-mod-$(strip $(1))),ZNC_MODULE_TARGETS += $(strip $(3))$(subst -,_,$(strip $(1))).so)
endef
+define webadmin
+ define Package/znc-mod-webadmin
+ $(Package/znc/default)
+ TITLE+= (webadmin plugin)
+ DEPENDS:=znc
+ endef
+
+ define Package/znc-mod-webadmin/description
+ Allows you to add/remove/edit users and settings on the fly via a web browser.
+ endef
+
+ define Package/znc-mod-webadmin/install
+ $(INSTALL_DIR) $$(1)/usr/lib/znc/
+ $(INSTALL_BIN) $$(PKG_BUILD_DIR)/modules/webadmin.so $$(1)/usr/lib/znc/
+ $(INSTALL_DIR) $$(1)/usr/share/znc/
+ $(CP) -r $$(PKG_BUILD_DIR)/modules/webadmin $$(1)/usr/share/znc/
+ $(INSTALL_DIR) $$(1)/usr/share/znc/webskins/
+ $(CP) -r $$(PKG_BUILD_DIR)/webskins/_default_ $$(1)/usr/share/znc/webskins/
+ endef
+
+ ZNC_MODULES += znc-mod-webadmin
+ $(if $(CONFIG_PACKAGE_znc-mod-webadmin),ZNC_MODULE_TARGETS += webadmin.so)
+endef
+
+define webskin
+ define Package/znc-webskin-$(strip $(1))
+ $(Package/znc/default)
+ TITLE+= ($(strip $(1)) webskin)
+ DEPENDS:=znc-mod-webadmin
+ endef
+
+ define Package/znc-webskin-$(strip $(1))/description
+ $(strip $(1)) webskin for webadmin
+ endef
+
+ define Package/znc-webskin-$(strip $(1))/install
+ $(INSTALL_DIR) $$(1)/usr/share/znc/webskins/
+ $(CP) -r $$(PKG_BUILD_DIR)/webskins/$(strip $(1)) $$(1)/usr/share/znc/webskins/
+ endef
+ ZNC_MODULES += znc-webskin-$(strip $(1))
+endef
, := ,
$(eval $(call module,watch,Monitor activity for specific text patterns from \
specific users and have the text sent to a special query window.))
-$(eval $(call module,webadmin,Allows you to add/remove/edit users and settings \
- on the fly via a web browser.))
-
$(eval $(call module,antiidle,Hides your idle time.,extra/))
$(eval $(call module,autovoice,Autovoices everyone who joins some channel., \
$(eval $(call module,shell,Have your unix shell in a query window right inside \
of your IRC client.,extra/))
+$(eval $(call webadmin))
+
+$(eval $(call webskin,dark-clouds))
+$(eval $(call webskin,forest))
+$(eval $(call webskin,ice))
PKG_CONFIG_DEPENDS := $(patsubst %,CONFIG_PACKAGE_%,$(ZNC_MODULES))
config znc
# where to listen for connections
list listener '192.168.1.1 1234'
+ # If using SSL sockets, use the following certifcate:
+ # option znc_ssl_cert '/etc/znc.cert'
+
# load global modules (You need to install them first):
# list module 'fail2ban'
START=60
-PID_FILE=/tmp/etc/znc/znc.pid
-ZNC_CONFIG=/tmp/etc/znc/configs/znc.conf
+ZNC_CONFIG_PATH=/tmp/etc/znc
+PID_FILE=${ZNC_CONFIG_PATH}/znc.pid
+ZNC_CONFIG=${ZNC_CONFIG_PATH}/configs/znc.conf
+
+EXTERNAL_CONFIG=0
+
+RUNAS_USER=
+RUNAS_GROUP=
add_param() {
echo "$1 = $2" >> $ZNC_CONFIG
local maxbuffersize
local connectdelay
local serverthrottle
+ local znc_config_path
+ local znc_pem_file
+
+ config_get znc_config_path "$znc" znc_config_path
+
+ config_get RUNAS_USER "$znc" runas_user
+ config_get RUNAS_GROUP "$znc" runas_group
+
+ if [ "${znc_config_path}" ]
+ then
+ ZNC_CONFIG_PATH=$znc_config_path
+ EXTERNAL_CONFIG=1
+ else
+ mkdir -p $ZNC_CONFIG_PATH/configs/
+ [ ! -f "$ZNC_CONFIG" ] || rm "$ZNC_CONFIG"
+ config_get anoniplimit "$znc" anoniplimit
+ config_get maxbuffersize "$znc" maxbuffersize
+ config_get connectdelay "$znc" connectdelay
+ config_get serverthrottle "$znc" serverthrottle
+ config_get znc_pem_file "$znc" znc_ssl_cert
- config_get anoniplimit "$znc" anoniplimit
- config_get maxbuffersize "$znc" maxbuffersize
- config_get connectdelay "$znc" connectdelay
- config_get serverthrottle "$znc" serverthrottle
+ [ -z $znc_pem_file -o -f $ZNC_CONFIG_PATH/znc.pem ] || ln -s "$znc_pem_file" $ZNC_CONFIG_PATH/znc.pem
- [ -z $anoniplimit ] || echo "AnonIPLimit = $anoniplimit" >> $ZNC_CONFIG
- [ -z $maxbuffersize ] || echo "MaxBufferSize = $maxbuffersize" >> $ZNC_CONFIG
- [ -z $connectdelay ] || echo "ConnectDelay = $connectdelay" >> $ZNC_CONFIG
- [ -z $serverthrottle ] || echo "ServerThrottle = $anoniplimit" >> $ZNC_CONFIG
+ [ -z $anoniplimit ] || echo "AnonIPLimit = $anoniplimit" >> $ZNC_CONFIG
+ [ -z $maxbuffersize ] || echo "MaxBufferSize = $maxbuffersize" >> $ZNC_CONFIG
+ [ -z $connectdelay ] || echo "ConnectDelay = $connectdelay" >> $ZNC_CONFIG
+ [ -z $serverthrottle ] || echo "ServerThrottle = $anoniplimit" >> $ZNC_CONFIG
- echo "PidFile = $PID_FILE" >> $ZNC_CONFIG
+ echo "PidFile = $PID_FILE" >> $ZNC_CONFIG
- config_list_foreach "$znc" listener "add_param Listener"
- config_list_foreach "$znc" module "add_param LoadModule"
+ config_list_foreach "$znc" listener "add_param Listener"
+ config_list_foreach "$znc" module "add_param LoadModule"
- add_param LoadModule "droproot nobody nogroup"
+ add_param LoadModule "droproot ${RUNAS_USER:-nobody} ${RUNAS_GROUP:-nogroup}"
+ fi
}
add_user() {
start() {
- mkdir -p /tmp/etc/znc/configs/
- [ -f "$ZNC_CONFIG" ] && rm "$ZNC_CONFIG"
config_load znc
config_foreach znc_global znc
- config_foreach add_listener listener
- config_foreach add_user user
- chown -R nobody:nogroup /tmp/etc/znc
- /usr/bin/znc -d/tmp/etc/znc -r >/dev/null &
+ if [ "$EXTERNAL_CONFIG" -eq 0 ]
+ then
+ config_foreach add_listener listener
+ config_foreach add_user user
+
+ chown -R ${RUNAS_USER:-nobody}:${RUNAS_GROUP:-nogroup} /tmp/etc/znc
+ fi
+
+ if [ "$EXTERNAL_CONFIG" -eq 1 -a "$RUNAS_USER" ]
+ then
+ local SU=$(which su)
+ if [ "$SU" ]
+ then
+ $SU -c "/usr/bin/znc -d$ZNC_CONFIG_PATH >/dev/null &" $RUNAS_USER
+ else
+ logger -s -t ZNC -p daemon.err "Could not run ZNC as user $RUNAS_USER: su not found."
+ exit 1
+ fi
+ else
+ /usr/bin/znc -d$ZNC_CONFIG_PATH >/dev/null &
+ fi
}
stop() {
- [ -f "$PID_FILE" ] && kill $(cat "$PID_FILE")
+ if [ -f "$PID_FILE" ]
+ then
+ kill $(cat "$PID_FILE")
+ else
+ killall znc
+ fi
}
--- /dev/null
+From 94aff4c3389111fc85054eb06b40bea26a216d0c Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jonas.gorski+openwrt@gmail.com>
+Date: Sat, 16 Apr 2011 05:51:04 +0200
+Subject: [PATCH] Don't rebuild everything when the Makefile's timestamp changed
+
+---
+ Makefile.in | 2 +-
+ modules/Makefile.in | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -96,7 +96,7 @@ clean:
+ distclean: clean
+ rm -rf $(DISTCLEAN)
+
+-%.o: %.cpp Makefile
++%.o: %.cpp
+ @mkdir -p .depend
+ $(E) Building $@...
+ $(Q)$(CXX) $(CXXFLAGS) -c -o $@ $< -MMD -MF .depend/$@.dep
+--- a/modules/Makefile.in
++++ b/modules/Makefile.in
+@@ -114,7 +114,7 @@ install_metadirs: create_install_dir
+ clean:
+ rm -rf $(CLEAN)
+
+-%.so: %.cpp Makefile
++%.so: %.cpp
+ @mkdir -p .depend
+ @mkdir -p extra
+ $(E) Building $(if $(filter %extra/,$(dir $<)),extra )module $(notdir $(basename $@))...