net-irc/znc: Bump to v1.6.1 github/pr/94
authorThomas D <whissi@whissi.de>
Mon, 14 Sep 2015 00:36:25 +0000 (02:36 +0200)
committerThomas D <whissi@whissi.de>
Mon, 14 Sep 2015 00:36:25 +0000 (02:36 +0200)
Non-maintainer commit.

See https://bugs.gentoo.org/show_bug.cgi?id=542168#c7 for detailed changelog.

Bug: https://bugs.gentoo.org/show_bug.cgi?id=542168

net-irc/znc/Manifest
net-irc/znc/files/znc-1.6.1-create-pidfile-per-default.patch [new file with mode: 0644]
net-irc/znc/files/znc-1.6.1-systemwideconfig.patch [new file with mode: 0644]
net-irc/znc/files/znc.confd-r1 [new file with mode: 0644]
net-irc/znc/files/znc.initd-r1 [new file with mode: 0644]
net-irc/znc/znc-1.6.1.ebuild [new file with mode: 0644]

index 7ceadbc650a42595b43b04f3f0a6eb45569ddc73..2e4aebe3fe84b8fc992ee1ad87064d08e2e5d306 100644 (file)
@@ -1,2 +1,4 @@
+DIST gtest-1.7.0.zip 1164254 SHA256 247ca18dd83f53deb1328be17e4b1be31514cedfc1e3424f672bf11fd7e0d60d SHA512 8859369f2dd32cbc2ac01aba029aa3ff20a321f40658b9643aff442d34c33468221866b801b28c66a28af47dbcd362d26941fc98db92b6efb7e41ea5b7be1a07 WHIRLPOOL 0c31a385159551859c1afe76480b3fb1b560d666db9a0afc5cbda92bcd53bf129f85a8f902c6ded0779c2b4c49aacec59ba5a4d5ce316a07bf08174f4fc64049
 DIST znc-1.2.tar.gz 1235150 SHA256 d9a2cd2a484ff23e6fc9cbde8dd8a43efbcd8d288afca7b1268914ca0d18701d SHA512 dff24e56127e5599d64b4c62de967d5d48d8ebf23ca8597d33bf0b3622640512db7a462bfa7c2031cd8307f402bab8efa345f6d1fc813e78eb0dcae581de3cf7 WHIRLPOOL b0810eb66e63be762f74f04eb2289e3634b18d6ecbd36d55f6a6772697e0397637d59b9ea01eaf62ef1cbe5f6e65b06432a254f4ada35194aa06b65c4a2f7994
 DIST znc-1.4.tar.gz 1239648 SHA256 86e98fd0ed182d39828c926809f8075d836ee3b70a6dd43dfbb434822f2a7b52 SHA512 0c33b05e8232084999812cbaa467dc7d37b80cafc1001b82e89c702b4303d8db9a27b948fe653e7090404eb1c66f5492f02f3524bc39efabade4be8bdb476671 WHIRLPOOL 420e665fa193b3f0284a070e021c4c467e3d40a0812eedeef9b2f65a6626a050b7af8bf15a754ac571d12261705832cfa18a0f7a7817cce96d220028a86230cf
+DIST znc-1.6.1.tar.gz 1463397 SHA256 ba49397364f48d6d32ae5242bc1166f21d972f85dd390d6bbe68a63ecbb6c140 SHA512 92c0acca6b585df394cf8d6d295948fc1342ff7b15d081017d2e0ba521129f914fa2b019a82d801f826f1009456294e4f578e978f34677bbfe436e87e2734aba WHIRLPOOL ff4a22742d5e1e8da66325fdc8a2fd88a467674a5f13f6d353b1c3588affd86f2c33c24d48f1b61dfba14311d6f1c13b2939851316cb302ab031073baa05ec17
diff --git a/net-irc/znc/files/znc-1.6.1-create-pidfile-per-default.patch b/net-irc/znc/files/znc-1.6.1-create-pidfile-per-default.patch
new file mode 100644 (file)
index 0000000..8419e93
--- /dev/null
@@ -0,0 +1,23 @@
+Add PidFile option to new configurations per default
+
+Our runscript requires that ZNC creates a pidfile. This patch will add
+the PidFile directive to ZNC's default configuration.
+---
+ src/znc.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/znc.cpp b/src/znc.cpp
+index b33e860..4a02568 100644
+--- a/src/znc.cpp
++++ b/src/znc.cpp
+@@ -575,6 +575,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) {
+       VCString vsLines;
+       vsLines.push_back(MakeConfigHeader());
++      vsLines.push_back("PidFile = /run/znc/znc.pid");
+       vsLines.push_back("Version = " + CString(VERSION_STR));
+       m_sConfigFile = ExpandConfigPath(sConfigFile);
+-- 
+2.5.0
+
diff --git a/net-irc/znc/files/znc-1.6.1-systemwideconfig.patch b/net-irc/znc/files/znc-1.6.1-systemwideconfig.patch
new file mode 100644 (file)
index 0000000..d28fa30
--- /dev/null
@@ -0,0 +1,215 @@
+Add system-wide daemon support.
+
+This patch adds system-wide daemon support to ZNC so that you can run
+one ZNC instance system-wide using the new "--system-wide-config-as"
+option.
+
+Patch is based on @mrueg version from 2012.
+
+X-Gentoo-Bug: 438430
+X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=438430
+---
+ include/znc/znc.h |  3 ++
+ src/main.cpp      | 83 ++++++++++++++++++++++++++++++++++++++++---------------
+ src/znc.cpp       |  7 ++++-
+ 3 files changed, 70 insertions(+), 23 deletions(-)
+
+diff --git a/include/znc/znc.h b/include/znc/znc.h
+index cf2326e..16394f9 100644
+--- a/include/znc/znc.h
++++ b/include/znc/znc.h
+@@ -187,6 +187,8 @@ public:
+       static void DumpConfig(const CConfig* Config);
++      void SetSystemWideConfig(bool systemWideConfig);
++
+ private:
+       CFile* InitPidFile();
+       bool DoRehash(CString& sError);
+@@ -231,6 +233,7 @@ protected:
+       unsigned int           m_uiConnectPaused;
+       TCacheMap<CString>     m_sConnectThrottle;
+       bool                   m_bProtectWebSessions;
++      bool                   m_bSystemWideConfig;
+       bool                   m_bHideVersion;
+ };
+diff --git a/src/main.cpp b/src/main.cpp
+index 09b2c9c..bd5cca6 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -16,6 +16,9 @@
+ #include <znc/znc.h>
+ #include <signal.h>
++#include <sys/types.h>
++#include <pwd.h>
++#include <grp.h>
+ #if defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD)
+ #include <znc/Threads.h>
+@@ -99,34 +102,36 @@ static inline int getopt_long(int argc, char * const argv[], const char *optstri
+ #endif
+ static const struct option g_LongOpts[] = {
+-      { "help",        no_argument,       0, 'h' },
+-      { "version",     no_argument,       0, 'v' },
+-      { "debug",       no_argument,       0, 'D' },
+-      { "foreground",  no_argument,       0, 'f' },
+-      { "no-color",    no_argument,       0, 'n' },
+-      { "allow-root",  no_argument,       0, 'r' },
+-      { "makeconf",    no_argument,       0, 'c' },
+-      { "makepass",    no_argument,       0, 's' },
+-      { "makepem",     no_argument,       0, 'p' },
+-      { "datadir",     required_argument, 0, 'd' },
++      { "help",                  no_argument,       0, 'h' },
++      { "version",               no_argument,       0, 'v' },
++      { "debug",                 no_argument,       0, 'D' },
++      { "foreground",            no_argument,       0, 'f' },
++      { "no-color",              no_argument,       0, 'n' },
++      { "allow-root",            no_argument,       0, 'r' },
++      { "makeconf",              no_argument,       0, 'c' },
++      { "makepass",              no_argument,       0, 's' },
++      { "makepem",               no_argument,       0, 'p' },
++      { "datadir",               required_argument, 0, 'd' },
++      { "system-wide-config-as", required_argument, 0, 'S' },
+       { 0, 0, 0, 0 }
+ };
+ static void GenerateHelp(const char *appname) {
+       CUtils::PrintMessage("USAGE: " + CString(appname) + " [options]");
+       CUtils::PrintMessage("Options are:");
+-      CUtils::PrintMessage("\t-h, --help         List available command line options (this page)");
+-      CUtils::PrintMessage("\t-v, --version      Output version information and exit");
+-      CUtils::PrintMessage("\t-f, --foreground   Don't fork into the background");
+-      CUtils::PrintMessage("\t-D, --debug        Output debugging information (Implies -f)");
+-      CUtils::PrintMessage("\t-n, --no-color     Don't use escape sequences in the output");
+-      CUtils::PrintMessage("\t-r, --allow-root   Don't complain if ZNC is run as root");
+-      CUtils::PrintMessage("\t-c, --makeconf     Interactively create a new config");
+-      CUtils::PrintMessage("\t-s, --makepass     Generates a password for use in config");
++      CUtils::PrintMessage("\t-h, --help                    List available command line options (this page)");
++      CUtils::PrintMessage("\t-v, --version                 Output version information and exit");
++      CUtils::PrintMessage("\t-f, --foreground              Don't fork into the background");
++      CUtils::PrintMessage("\t-D, --debug                   Output debugging information (Implies -f)");
++      CUtils::PrintMessage("\t-n, --no-color                Don't use escape sequences in the output");
++      CUtils::PrintMessage("\t-r, --allow-root              Don't complain if ZNC is run as root");
++      CUtils::PrintMessage("\t-c, --makeconf                Interactively create a new config");
++      CUtils::PrintMessage("\t-s, --makepass                Generates a password for use in config");
+ #ifdef HAVE_LIBSSL
+-      CUtils::PrintMessage("\t-p, --makepem      Generates a pemfile for use with SSL");
++      CUtils::PrintMessage("\t-p, --makepem                 Generates a pemfile for use with SSL");
+ #endif /* HAVE_LIBSSL */
+-      CUtils::PrintMessage("\t-d, --datadir      Set a different ZNC repository (default is ~/.znc)");
++      CUtils::PrintMessage("\t-d, --datadir                 Set a different ZNC repository (default is ~/.znc)");
++      CUtils::PrintMessage("\t-S, --system-wide-config-as   Create a system-wide ZNC daemon configuration");
+ }
+ static void die(int sig) {
+@@ -192,6 +197,8 @@ int main(int argc, char** argv) {
+       bool bMakeConf = false;
+       bool bMakePass = false;
+       bool bAllowRoot = false;
++      bool bSystemWideConfig = false;
++      CString sSystemWideConfigUser = "znc";
+       bool bForeground = false;
+ #ifdef ALWAYS_RUN_IN_FOREGROUND
+       bForeground = true;
+@@ -201,7 +208,7 @@ int main(int argc, char** argv) {
+ #endif
+       CZNC::CreateInstance();
+-      while ((iArg = getopt_long(argc, argv, "hvnrcspd:Df", g_LongOpts, &iOptIndex)) != -1) {
++      while ((iArg = getopt_long(argc, argv, "hvnrcspd:DfS:", g_LongOpts, &iOptIndex)) != -1) {
+               switch (iArg) {
+               case 'h':
+                       GenerateHelp(argv[0]);
+@@ -219,6 +226,10 @@ int main(int argc, char** argv) {
+               case 'c':
+                       bMakeConf = true;
+                       break;
++              case 'S':
++                      bSystemWideConfig = true;
++                      sSystemWideConfigUser = optarg;
++                      break;
+               case 's':
+                       bMakePass = true;
+                       break;
+@@ -254,8 +265,36 @@ int main(int argc, char** argv) {
+               return 1;
+       }
++      if (bSystemWideConfig && getuid() == 0) {
++              struct passwd *pwd;
++
++              pwd = getpwnam(sSystemWideConfigUser.c_str());
++              if (pwd == NULL) {
++                      CUtils::PrintError("Daemon user not found.");
++                      return 1;
++              }
++
++              if ((long) pwd->pw_uid == 0) {
++                      CUtils::PrintError("Please define a daemon user other than root.");
++                      return 1;
++              }
++              if (setgroups(0, NULL) != 0) {
++                      CUtils::PrintError("setgroups: Unable to clear supplementary group IDs");
++                      return 1;
++              }
++              if (setgid((long) pwd->pw_gid) != 0) {
++                      CUtils::PrintError("setgid: Unable to drop group privileges");
++                      return 1;
++              }
++              if (setuid((long) pwd->pw_uid) != 0) {
++                      CUtils::PrintError("setuid: Unable to drop user privileges");
++                      return 1;
++              }
++      }
++
+       CZNC* pZNC = &CZNC::Get();
+       pZNC->InitDirs(((argc) ? argv[0] : ""), sDataDir);
++      pZNC->SetSystemWideConfig(bSystemWideConfig);
+ #ifdef HAVE_LIBSSL
+       if (bMakePem) {
+@@ -304,7 +343,7 @@ int main(int argc, char** argv) {
+               CUtils::PrintStatus(true, "");
+       }
+-      if (isRoot()) {
++      if (isRoot() && !bSystemWideConfig) {
+               CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid");
+               CUtils::PrintError("reasons for this and it can, in theory, cause great damage!");
+               if (!bAllowRoot) {
+diff --git a/src/znc.cpp b/src/znc.cpp
+index 78cda1a..b33e860 100644
+--- a/src/znc.cpp
++++ b/src/znc.cpp
+@@ -55,6 +55,7 @@ CZNC::CZNC() {
+       m_sConnectThrottle.SetTTL(30000);
+       m_pLockFile = NULL;
+       m_bProtectWebSessions = true;
++      m_bSystemWideConfig = false;
+       m_bHideVersion = false;
+       m_uDisabledSSLProtocols = Csock::EDP_SSL;
+       m_sSSLProtocols = "";
+@@ -861,7 +862,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) {
+       CUtils::PrintMessage("");
+       File.UnLock();
+-      return bFileOpen && CUtils::GetBoolInput("Launch ZNC now?", true);
++      return bFileOpen && !m_bSystemWideConfig && CUtils::GetBoolInput("Launch ZNC now?", true);
+ }
+ void CZNC::BackupConfigOnce(const CString& sSuffix) {
+@@ -1973,3 +1974,7 @@ void CZNC::LeakConnectQueueTimer(CConnectQueueTimer *pTimer) {
+ bool CZNC::WaitForChildLock() {
+       return m_pLockFile && m_pLockFile->ExLock();
+ }
++
++void CZNC::SetSystemWideConfig(bool systemWideConfig) {
++      m_bSystemWideConfig = systemWideConfig;
++}
+-- 
+2.5.0
+
diff --git a/net-irc/znc/files/znc.confd-r1 b/net-irc/znc/files/znc.confd-r1
new file mode 100644 (file)
index 0000000..b78e053
--- /dev/null
@@ -0,0 +1,24 @@
+# /etc/conf.d/znc
+
+# Location of the znc configuration folder
+ZNC_DATADIR="/var/lib/znc"
+
+# User to run znc as
+ZNC_USER="znc"
+
+# Group to run znc as
+ZNC_GROUP="znc"
+
+# PID file
+ZNC_PIDFILE="/run/znc/znc.pid"
+
+# You can use this configuration option to pass additional options to the
+# start-stop-daemon, see start-stop-daemon(8) for more details.
+# Per default we wait 1000ms after we have started the service to ensure
+# that the daemon is really up and running.
+ZNC_SSDARGS="--wait 1000"
+
+# The termination timeout (start-stop-daemon parameter "retry") ensures
+# that the service will be terminated within a given time (30 + 5 seconds
+# per default) when you are stopping the service.
+ZNC_TERMTIMEOUT="TERM/30/KILL/5"
diff --git a/net-irc/znc/files/znc.initd-r1 b/net-irc/znc/files/znc.initd-r1
new file mode 100644 (file)
index 0000000..903a4fe
--- /dev/null
@@ -0,0 +1,40 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_commands="config"
+extra_started_commands="reload save"
+command="/usr/bin/znc"
+command_args="--datadir ${ZNC_DATADIR}"
+pidfile="${ZNC_PIDFILE:-/run/znc/znc.pid}"
+user=${ZNC_USER:-znc}
+group=${ZNC_GROUP:-znc}
+start_stop_daemon_args="--chdir \"${ZNC_DATADIR}\" --user ${user} --group ${group} ${ZNC_SSDARGS}"
+retry="${ZNC_TERMTIMEOUT}"
+
+required_dirs="${ZNC_DATADIR}"
+
+depend() {
+       use dns logger
+}
+
+start_pre() {
+       checkpath -d -m 0770 -o ${user}:${group} $(dirname ${pidfile})
+}
+
+stop_post() {
+       rm -f ${pidfile}
+}
+
+reload() {
+       ebegin "Reloading ZNC Configuration File from Disk"
+       start-stop-daemon --signal SIGHUP --pidfile ${pidfile}
+       eend $?
+}
+
+save() {
+       ebegin "Saving ZNC Configuration File to Disk"
+       start-stop-daemon --signal SIGUSR1 --pidfile ${pidfile}
+       eend $?
+}
diff --git a/net-irc/znc/znc-1.6.1.ebuild b/net-irc/znc/znc-1.6.1.ebuild
new file mode 100644 (file)
index 0000000..6098cc0
--- /dev/null
@@ -0,0 +1,198 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python{3_3,3_4} )
+inherit base python-single-r1 systemd user
+
+MY_PV=${PV/_/-}
+GTEST_VER="1.7.0"
+GTEST_URL="https://googletest.googlecode.com/files/gtest-${GTEST_VER}.zip"
+DESCRIPTION="An advanced IRC Bouncer"
+
+if [[ ${PV} == "9999" ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="git://github.com/znc/znc.git"
+       SRC_URI="test? ( ${GTEST_URL} )"
+       KEYWORDS=""
+else
+       SRC_URI="http://znc.in/releases/${PN}-${MY_PV}.tar.gz
+               test? ( ${GTEST_URL} )"
+       KEYWORDS="~amd64 ~arm ~x86"
+fi
+
+HOMEPAGE="http://znc.in"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="daemon debug ipv6 perl python ssl sasl tcl test"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="
+       perl? ( >=dev-lang/perl-5.10 )
+       python? ( ${PYTHON_DEPS} )
+       sasl? ( >=dev-libs/cyrus-sasl-2 )
+       ssl? ( >=dev-libs/openssl-0.9.7d:0 )
+       tcl? ( dev-lang/tcl:0= )
+"
+DEPEND="
+       virtual/pkgconfig
+       perl? (
+               >=dev-lang/swig-2.0.12
+       )
+       python? (
+               >=dev-lang/swig-2.0.12
+       )
+       ${RDEPEND}
+"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.6.1-systemwideconfig.patch
+       "${FILESDIR}"/${PN}-1.6.1-create-pidfile-per-default.patch
+)
+
+ZNC_DATADIR="${ZNC_DATADIR:-"/var/lib/znc"}"
+
+pkg_setup() {
+       if use python; then
+               python-single-r1_pkg_setup
+       fi
+       if use daemon; then
+               enewgroup ${PN}
+               enewuser ${PN} -1 -1 /dev/null ${PN}
+       fi
+}
+
+src_unpack() {
+       if [[ ${PV} == "9999" ]] ; then
+               git-r3_src_unpack
+       else
+               default
+       fi
+
+       if use test; then
+               cd "${S}"/test || die "Failed to chdir into '${S}/test'"
+               unpack $(basename ${GTEST_URL})
+               mv gtest-${GTEST_VER} gtest || die "Failed to rename '${S}/test/gtest-${GTEST_VER}' dir"
+       fi
+}
+
+src_prepare() {
+       if [[ ${PV} == *9999* ]]; then
+               ./autogen.sh
+       fi
+
+       base_src_prepare
+}
+
+src_configure() {
+       econf \
+               --with-systemdsystemunitdir=$(systemd_get_unitdir) \
+               $(use_enable debug) \
+               $(use_enable ipv6) \
+               $(use_enable perl) \
+               $(use python && echo "--enable-python=python3") \
+               $(use_enable sasl cyrus) \
+               $(use_enable ssl openssl) \
+               $(use_enable tcl tcl) \
+               $(use_with test gtest "${S}/test/gtest")
+}
+
+src_install() {
+       emake install DESTDIR="${D%/}"
+       dodoc NOTICE README.md
+       if use daemon; then
+               newinitd "${FILESDIR}"/znc.initd-r1 znc
+               newconfd "${FILESDIR}"/znc.confd-r1 znc
+       fi
+}
+
+pkg_postinst() {
+       if use !daemon; then
+               elog
+               elog "Run 'znc --makeconf' as the user you want to run ZNC as"
+               elog "to make a configuration file"
+               elog
+       else
+               elog
+               elog "An init-script was installed in /etc/init.d"
+               elog "A config file was installed in /etc/conf.d"
+               if [[ ! -d "${EROOT}${ZNC_DATADIR}" ]]; then
+                       elog
+                       elog "Run 'emerge --config znc' to configure ZNC"
+                       elog "as a system-wide daemon."
+                       elog
+                       elog "To generate a new SSL certificate, run:"
+                       elog "  znc --system-wide-config-as znc --makepem -d ${ZNC_DATADIR}"
+                       elog "as root"
+                       elog
+                       elog "If migrating from a user-based install"
+                       elog "you can use your existing config files:"
+                       elog "  mkdir ${ZNC_DATADIR}"
+                       elog "  mv /home/\$USER/.znc/* ${ZNC_DATADIR}"
+                       elog "  rm -rf /home/\$USER/.znc"
+                       elog "  chown -R znc:znc ${ZNC_DATADIR}"
+                       elog
+                       elog "If you already have znc set up and want take advantage of the"
+                       elog "init script but skip of all the above, you can also edit"
+                       elog "  /etc/conf.d/znc"
+                       elog "and adjust the variables to your current znc user and config"
+                       elog "location."
+                       elog
+                       elog "Please make sure that your existing configuration contains"
+                       elog "  PidFile = /run/znc/znc.pid"
+                       elog "or that PidFile value matches the one in /etc/conf.d/znc"
+                       if [[ -d "${EROOT}"/etc/znc ]]; then
+                               elog
+                               ewarn "/etc/znc exists on your system."
+                               ewarn "Due to the nature of the contents of that folder,"
+                               ewarn "we have changed the default configuration to use"
+                               ewarn " ${ZNC_DATADIR}"
+                               ewarn "please move /etc/znc to ${ZNC_DATADIR}"
+                               ewarn "or adjust /etc/conf.d/znc"
+                       fi
+               else
+                       elog "Existing config detected in ${ZNC_DATADIR}"
+                       if ! systemd_is_booted; then
+                               elog
+                               elog "Please make sure that your existing configuration contains"
+                               elog "  PidFile = /run/znc/znc.pid"
+                               elog "or that PidFile value matches the one in /etc/conf.d/znc"
+                       else
+                               elog "You're good to go :)"
+                       fi
+               fi
+               elog
+       fi
+}
+
+pkg_config() {
+       if use daemon && ! [[ -d "${EROOT}${ZNC_DATADIR}" ]]; then
+               einfo "Press ENTER to interactively create a new configuration file for znc."
+               einfo "To abort, press Control-C"
+               read
+               mkdir -p "${EROOT}${ZNC_DATADIR}" || die
+               chown -R ${PN}:${PN} "${EROOT}${ZNC_DATADIR}" ||
+                       die "Setting permissions failed"
+               "${EROOT}"/usr/bin/znc --system-wide-config-as znc -c -r -d "${EROOT}${ZNC_DATADIR}" ||
+                       die "Config failed"
+               echo
+               einfo "To start znc, run '/etc/init.d/znc start'"
+               einfo "or add znc to a runlevel:"
+               einfo "  rc-update add znc default"
+       else
+               if use daemon; then
+                       ewarn "${ZNC_DATADIR} already exists, aborting to avoid damaging"
+                       ewarn "any existing configuration. If you are sure you want"
+                       ewarn "to generate a new configuration, remove the folder"
+                       ewarn "and try again."
+               else
+                       ewarn "To configure znc as a system-wide daemon you have to"
+                       ewarn "enable the 'daemon' use flag."
+               fi
+       fi
+}