summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Alexander <wired@gentoo.org>2012-11-21 18:11:33 +0000
committerAlex Alexander <wired@gentoo.org>2012-11-21 18:11:33 +0000
commit76a9b72ed5631539a7bde7df37a25f7702730cca (patch)
treec2ed33a846b9bae663250e49764f1e0bc3658c07 /net-irc/znc
parentAdd ~amd64 (diff)
downloadhistorical-76a9b72ed5631539a7bde7df37a25f7702730cca.tar.gz
historical-76a9b72ed5631539a7bde7df37a25f7702730cca.tar.bz2
historical-76a9b72ed5631539a7bde7df37a25f7702730cca.zip
version bump, bug #438430. added system-wide daemon use flag that installs init.d/conf.d files, bug #415389. systemWideConfig patch.
Package-Manager: portage-2.2.0_alpha142/cvs/Linux x86_64 Manifest-Sign-Key: 0xEB9B4AFA
Diffstat (limited to 'net-irc/znc')
-rw-r--r--net-irc/znc/ChangeLog11
-rw-r--r--net-irc/znc/Manifest29
-rw-r--r--net-irc/znc/files/znc-1.0-systemwideconfig.patch147
-rw-r--r--net-irc/znc/files/znc.confd7
-rw-r--r--net-irc/znc/files/znc.initd39
-rw-r--r--net-irc/znc/metadata.xml1
-rw-r--r--net-irc/znc/znc-1.0.ebuild138
7 files changed, 369 insertions, 3 deletions
diff --git a/net-irc/znc/ChangeLog b/net-irc/znc/ChangeLog
index 672f41f2c3e0..d96061329484 100644
--- a/net-irc/znc/ChangeLog
+++ b/net-irc/znc/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for net-irc/znc
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-irc/znc/ChangeLog,v 1.59 2012/05/29 17:49:40 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-irc/znc/ChangeLog,v 1.60 2012/11/21 18:11:31 wired Exp $
+
+*znc-1.0 (21 Nov 2012)
+
+ 21 Nov 2012; Alex Alexander <wired@gentoo.org> +znc-1.0.ebuild,
+ +files/znc-1.0-systemwideconfig.patch, +files/znc.confd, +files/znc.initd,
+ metadata.xml:
+ version bump, bug #438430. added system-wide daemon use flag that installs
+ init.d/conf.d files, bug #415389. systemWideConfig patch. Many thanks to
+ Manuel Rüger and Uli Schlachter.
*znc-0.206 (29 May 2012)
diff --git a/net-irc/znc/Manifest b/net-irc/znc/Manifest
index 0ead82a5c933..aba12f267ed5 100644
--- a/net-irc/znc/Manifest
+++ b/net-irc/znc/Manifest
@@ -1,15 +1,40 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
AUX znc-0.096-clearbuffersonmsg-fix.patch 1567 SHA256 1d9a4a7d60e3ad0333544feb2933097e8faa2336c66c4fa231d5febbc53c0cb9 SHA512 ab81adaf3f767ff448e73099e8da14a62797633a0883bc586cd87baf140d3f7087dc9c1f7ed3e85a06ad3895a43b9c31cff168c3e1eadd26a32b3a1f581b15c4 WHIRLPOOL 23e54c66a85ddc08ca101f7d439117bed4e5c909b26a323a15b85acdfbfe1dd926efb37afb2a1618d5dda11d933c1b7f3b394b7492dc03819884ede5e9feb958
AUX znc-0.098-modpython-as-needed.patch 820 SHA256 a4d1d2ef2e32a673e6e019ed6a874ce020dfa9170675613e867e79e335edae45 SHA512 dbbdaf93fb48ff01926e3cff78f160a21871c04f272e62fc92f62561c0df193bcfa6ac960594a1bad475edc806f341d6eae9817ae78b9768b7842a348d9e437e WHIRLPOOL 4658ba75e0dca9a47a6b8a0dbaace1d5283b9899d21a16de3a3093b300c8ebe35fc937384e53776b565fcc8a7b615f54774471b580bea70b1c79c19a66a5a75d
AUX znc-0.200-segfault-fix.patch 829 SHA256 230afba64b775a15e543222e92302b36e98c28e57351bba21bbf66106ddf95ea SHA512 ceaa0356f0cbb269fc9bdb56f8a1b1b091474771216b3855274860ee3a4ae821b2606390783bf73ddc5d377dc5de77e669b40514401a027a042334a8e99561c8 WHIRLPOOL 5dfc183725268859b07d75be1ce15b0f14403531c87627557e29f3170f6fdfd5285d82ef1276dc6e3be0fc4d187185050dfe884590ca7475312d8e57b406ac73
AUX znc-0.202-bouncedcc-dos-fix.patch 1509 SHA256 0c975d930571d5edc48bec2f85e0415ea43f85c65c7290c8ab517bd36c40808a SHA512 3c4d66b88263c2dfded105604cc91db22ba247ab57f0017e7fb39448f3d69f6af30390587c6d3e041cdad910d37c59a48d4de2a81a695ab292e73bce82cd306d WHIRLPOOL 3fdf9c31a70bc4df2bc939ae8b8431ebb1e908e8b76c95d33b9600137834dc9684e1915a7b57f8360753b325676ddc690d87d665fe6ecd1d0468bf1b2daa04ac
+AUX znc-1.0-systemwideconfig.patch 4252 SHA256 1ddd5e95b299ef3c2293ce89829bae290a5c8fdc8e260ff09ae7f22264b8fbc9 SHA512 4527317f8b45c77e329167cedd792eb7886b85eeb9cb0b39f7bb117edff9bdde406d3fc4aa81410a3b1f9f7957e8ac312cdd168469fdaefd234ddbbae279341e WHIRLPOOL 3556fef6a5a840657ed50e5e283d913ab441c73b3becdfd5e05661dd312cf9670677407734ec5ba8d4254a1e22a6d3274563ab8ff81b04b16fadc9c16029e933
+AUX znc.confd 119 SHA256 a0c377eb428488dc9a3e3ae2ff0b6908bb0ad4402e4be8af36de60a0fc103982 SHA512 86fc40d0d4718f3bf0b803ebcde88cab86da10e4fd5adf3ced50d395e5a3a800896df194c27a1377d6c6bdfc99931bd859d6bcf9df4e23491d2008019d327a44 WHIRLPOOL ce087deb69d1d37789058fea556b3ed23b0148410d1b2a3b0f91956b4d64cfd982dabbb62afc5ee565cd174ca8068e89a0e1125d41e49991879d7bc97d598d30
+AUX znc.initd 910 SHA256 9df9e738efca0e6ace045bdb6a1419082408119ba92c032566c6d4a61b1844b5 SHA512 0d1b9bf71cde1b803e9deddc64006528778dc628603bb4ba8cca17098dcb6b8fc34dcb43eca7de7dec61ce84832dd07d76c7ccb2d9175f859d5aee2a349e8045 WHIRLPOOL 0640b8c30c7ff64b772998c86f06fcaae06759a5af7e0384a5ffbd1a1c4c85923c9d87362720a2ae6fb5a164d1a298d12e4493617a1e66813f3dfee0b40d04ce
DIST znc-0.094.tar.gz 603191 SHA256 a673ebec938c1285509da5cacb480c30b2b348941f3bac7907aa4b3dc094f94a SHA512 c6304821a86bd99e6f1772cbf568713487804b4ff2b58d8605aa41d8ddce77ac5a0c21d2fff26158044ddabcfafa02cad00297e61058195ec2bb80064d31dda3 WHIRLPOOL ca552d1183379d3f9be862995a099be2f5fb2082473d8da5310fbd7fcdc6f36b957ff3fdd5d046cce753057faf8b22c2154a7ab00394c44a6174dbec3c64ef87
DIST znc-0.202.tar.gz 654083 SHA256 48d95e7fc57cbcaee192bc1988fa7dcd35544286775d3b02ee4eb822ea57cc1a SHA512 d3222abe86dd3aaad1461a9369aa8ac6e464b9653b52ad1a47ff737f33a8cc340ff7e200d0902f97f8709bfa7fe5313e12697ba512634c5d9e04177844b47ebb WHIRLPOOL f11f553a346bfc0ee3abde46dfa3f3e711ed98dc7ba80aa1a429301a133da1a169bb87318b383c7045686c5588e3395c99945cfd7ea12c0e6295b93876164de5
DIST znc-0.204.tar.gz 654739 SHA256 80c5ec527fd0b95fd6bec0755e86b07ac8925b97d6ee1576cfe1e0e656a7b050 SHA512 e4b97d341667fd8fea0fc345226c51db7f4470c8c7eeb31a763892998d2cad8379cd69c5ae65005fee5711810009fe9b27edd80e84a580188199e451eaa38cd9 WHIRLPOOL 54f7bf8fcc3e8226646e7ce8b479b3ddc999af454c98a363a041a5b61633f0c6b6e7b592039fbfc46fb40155b1dff684c3d4c0ad225cd13b1199050d8c4aa855
DIST znc-0.206.tar.gz 655140 SHA256 39977850ab624374b2573a8bdc4d0280687c1334649a089f035ff979bafb996d SHA512 38ecd8ce78588078ffa9d5c5b3a32c3e59aa31515e4c7c6c0daca89f0228e4463c9de2df4464a4e84667860e5381288fd3a4b003f7ac912a48dc3422345f433a WHIRLPOOL abdf542ae34cc506bdd6eda282153a6937a7fdb323a061e8eb9b02e9d92cfc5331afa1dd253081cb049e540fe580378d433a987284fd47323b28f6420a9b3d62
+DIST znc-1.0.tar.gz 1222361 SHA256 a85539da42697b26e4d46205def36bb799f83d6aeef401d53c49ee674142062a SHA512 4219cdd32296e5851f6cd99a8ac6e14d2579df10e8e111bb09d6c3789e400e2fcdc173968afd54808d286f0fb4945aa57d2d0f3b62a20e761de64500c8938e35 WHIRLPOOL 864c45762f8508c8d724246153345554b660336789a5340e9633b83aed249c901f976d2aa6207a82ce8e7836d680fc30fca03cafbc8942932745c6f1584e99cc
EBUILD znc-0.094.ebuild 1253 SHA256 e675c956d3853f8d5545991c8fbad588de1d50f2ae9606fc76893e86a02f997d SHA512 0147fe55e8d620e81e7a1eb78f198d665cc3e504b6ecce905629f7b2f0fe7aea2b2b33c4fc9a0e03947cc32f4a66005d6f8641fb00cf2e6015ff6a168ddd29c8 WHIRLPOOL 7a77578f8eb24f1c9130cf803d3bf55d96c5f561773c6d24e5f09a4c0117e19eb34cce6bb1121f90fe8f5aed90ef2ecbe2d3005d8deba7487493aa782f01c42e
EBUILD znc-0.202-r1.ebuild 1659 SHA256 8a1428ce6cd8b312253a162afd262bd8eab672e31115f223bc9ee727dc002f85 SHA512 d07b8da7345d35207d0a667ae33dcdc13313f6603eb78174747c9b30b9a4f159ab0d65da96b96a6e63f9a701531866f64445ed220ea5b65f33690138d762079e WHIRLPOOL bf247832f6b5eb6ea9488f26000d739f3357471e4ea26c0e4de622c17ae95df124073ad298c2e2abf7221275e15b74029f7578d26be5b857e5443834c7c243bb
EBUILD znc-0.204.ebuild 1477 SHA256 1f670e4b63b45e7c4accb3e7743571580b3d070acfb223efaac066410137ec47 SHA512 410ffa8a1359f14264954fcc9499dd8e3d05e9a53da7b9dcec0ea55860893296b7711fc088b52c6c384be91e721ff0fec0d2f8916744ea19603b7b3dd4328a70 WHIRLPOOL bff748d865cc41b272a1ecd11b47720701bcffb0ef661b7f78ea9126784af607c9bc6809e72e3392fa126d51104e5866904f43b2412a9baa92f61bee0c42b344
EBUILD znc-0.206.ebuild 1475 SHA256 b4ff5200f27bcc7e611bf7850ee1b0af5e0b151543f0722cb0840da48324d3b3 SHA512 d68ac0f5fb9e184da076952ade6660c2d538150d7401ab4859553cb06135f1fa6feab767b7da463285ba3ae4c764c9eebff3a0edeb74690baf5a7c0dc9cfc35e WHIRLPOOL 71ea9fd52c86d94a8c053e27d6ffa0ee9cafd3e8a440f7edb24125dc43c419287bbcfa8d7105b6421457055752ac4181a2411f73f49cc34d0d6aed519128a86d
+EBUILD znc-1.0.ebuild 3626 SHA256 d1e3d3dda84966e7c8a7b923a408d3f5958947a830d4893ad456339e0b20808b SHA512 2476a5ff38a7b3752fa9a81913654668f404bcbf5fb7bcb20cd546ba73828e4ac82d43e3c06a105a257b2bdb30ea12c8fb1d02549934e224686eb34d588086b8 WHIRLPOOL 0b8e8c850270a248c88a262f419998436375df98c9b181f65879ca40d25663cf430f723c8e0078cda6c0136eb4a2ca56d8462a5ec2e6a9b2243a24d84a10c66b
EBUILD znc-9999.ebuild 1600 SHA256 4db76c476b6995c7df1d2f7cad896a265a049ed59585575db84b2514dde84ad2 SHA512 deea11b5e8fcde0f4ff4181aa0cc5ec64c379afdf1989a2c1a6e7286c5d133a83bf78b0c6e274eb29b820c46e013d016ae6d04baba2e7cfb44d63088d5cf8958 WHIRLPOOL fd10a8374987936e7ab2c90bdaa4818461aa29269c1ffd31b7fc26271b35238dbd861b240f40006c6ae788c5da35e93dcd4c1ba2a9d8365677ab0e23bce6cdc3
-MISC ChangeLog 8117 SHA256 0dfb4512ee6f0847026a4e84c3b11eed6236f529cc12b410deb14b6e05fdd876 SHA512 6e4d85b30e65809306d9ee2e30c97f269f63bf429ba8b08f5e66f858f7f7d951a781f9806f5d2b08af4f626889b74218b1c7d5d02161ce11ab69aa6c096c30af WHIRLPOOL 3f525b030794637533d20be4053857eb93a7d503784d365b3c646d6186eaaf574637c12507ec6ff301de7c7fd4eb3858dec572cdaa8ddc9293568bd971f80d62
-MISC metadata.xml 545 SHA256 021f87a697862b805466feb93bfc772c746c2fe0cb7db1165d15a10b2648be2d SHA512 b8762f3f8a7b435edc9cce1db862cb3facda6437921e7046251676124920c0c9edefbd9eae189a4f911f902bf7969e694430edf0d99ce9e1afc748212b248234 WHIRLPOOL 17b1c6de7e52df119d4d3aa3ada81241d7018a39317254a9c044c9df6006530aee31de1266b4a7c4adbeab875fd261ead193f8e3994caeacb9f33374b8c10282
+MISC ChangeLog 8490 SHA256 b9b49f183456582c38c54b6a2856b9910eb136c5bac3ffa5ec7f3529d043986b SHA512 0185f324e76626177fd2e44f5c958ff161ddf0f416ef308416ea33a67f0f6648b97b73eee5545f0c2bb3ac5ce4996c98ec8aed88686b93a917c168b13ee414d5 WHIRLPOOL 9c73a57451116c4401f12fd22965a8b2c67b796319318f0f7458882f464ff0f6ad263eacac7b55140ea76c2189131c1238aaa0096f824a4e85609650e1c1de3d
+MISC metadata.xml 670 SHA256 eabd1a6970bff39045159c5c8a946c594e7d7aae2779506d7bfd21330c4fd425 SHA512 706979be68b734ffc8684fc1d015fa17b06c2202fb926a028378ba88fe79c4c6cffadd7f2c69443ea29e441b2a352d79168b18efd588037d8aaeb3126b5938c3 WHIRLPOOL 00f10736a1a26b48d685ab44c5b81d01000bef037f0865a9abe32d58ef284e89be9b952e8922d4b0417aa9021b9138307750fc1fc5e04c9ef9728a23d29bc4c7
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQIcBAEBCAAGBQJQrRllAAoJEDZF8K7rm0r6nzsP/0YhXuinlDd63PJYE7mIgMUY
++RWUFCS6TCtezPkvoTLsqVqa3itFxcLMYcCcD/1DUSX9OM8qrto8hKbzo2DsjP9M
+4tACJF6Z3qeoJNONsGJ0Zlq+1zxH8VBX1BPMJo1NpxZUW1gst/oEgJvM1dcDufaK
+SZC5uHDECcEuobH18chf6cEHYBwM7bty2HLDAN8NQQNL1PJvCaUnH8qWel47Dv+e
+jzxAexIfoF+vNv/aKOJVKIUZEGiOB8j5uZ+/kZYtbGw5fQRqJGKNV84UtmPrX6Ap
+XHlIxkpVSm1vDmLSvuV/xU7zDpjqrDnb3hbAKuN25ord8IwU4I21ocRkTtamryMy
+8iqPEm+My3lnhfpOpxCYUjAVjAncLtXAI2EIHCN5tsXAo55lsdbAOEUnbIL4WNi2
+cEEFiWU6ChGy3Y4stJHCydDiD+fucCChv9WZDM7KAYe/Ve+rJYgFGl1Js5CXDEpl
+wPJ1jIAHNXmJqy52SQd9Yx8gqnuNJRbGgQ2DDRwXUUJyAQANnhC1lm8jwoc4JFpd
+KOL4QggUoC/xhRDazMjKWzAGa1YgOR3V6mEmwFcYH3M+EoGoxeQqZKTxwvHGWmTd
+Be4hzYwREtDLW2bSEU47yb3a3yHKZfy3x0PVL0mZzRAFgjDaKHKlisPOCG6AOZGT
+BCKFfPRvS64yU124HqLU
+=xirM
+-----END PGP SIGNATURE-----
diff --git a/net-irc/znc/files/znc-1.0-systemwideconfig.patch b/net-irc/znc/files/znc-1.0-systemwideconfig.patch
new file mode 100644
index 000000000000..336163dd6a0c
--- /dev/null
+++ b/net-irc/znc/files/znc-1.0-systemwideconfig.patch
@@ -0,0 +1,147 @@
+diff --git a/include/znc/znc.h b/include/znc/znc.h
+index 03be646..f493c83 100644
+--- a/include/znc/znc.h
++++ b/include/znc/znc.h
+@@ -169,6 +169,8 @@ public:
+
+ static void DumpConfig(const CConfig* Config);
+
++ void SetSystemWideConfig(bool systemWideConfig);
++
+ private:
+ CFile* InitPidFile();
+ bool DoRehash(CString& sError);
+@@ -209,6 +211,7 @@ protected:
+ unsigned int m_uiConnectPaused;
+ TCacheMap<CString> m_sConnectThrottle;
+ bool m_bProtectWebSessions;
++ bool m_bSystemWideConfig;
+ };
+
+ #endif // !_ZNC_H
+diff --git a/src/main.cpp b/src/main.cpp
+index a1f3904..4950911 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -10,6 +10,9 @@
+ #include <znc/FileUtils.h>
+ #include <sys/wait.h>
+ #include <signal.h>
++#include <sys/types.h>
++#include <pwd.h>
++#include <grp.h>
+
+ using std::cout;
+ using std::endl;
+@@ -46,6 +49,7 @@ static const struct option g_LongOpts[] = {
+ { "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 }
+ };
+
+@@ -127,6 +131,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;
+@@ -135,7 +141,7 @@ int main(int argc, char** argv) {
+ bool bMakePem = false;
+ #endif
+
+- 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]);
+@@ -153,6 +159,10 @@ int main(int argc, char** argv) {
+ case 'c':
+ bMakeConf = true;
+ break;
++ case 'S':
++ bSystemWideConfig = true;
++ sSystemWideConfigUser = optarg;
++ break;
+ case 's':
+ bMakePass = true;
+ break;
+@@ -187,8 +197,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) {
+@@ -229,7 +267,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 9469790..297b021 100644
+--- a/src/znc.cpp
++++ b/src/znc.cpp
+@@ -47,6 +47,7 @@ CZNC::CZNC() {
+ m_sConnectThrottle.SetTTL(30000);
+ m_pLockFile = NULL;
+ m_bProtectWebSessions = true;
++ m_bSystemWideConfig = false;
+ }
+
+ CZNC::~CZNC() {
+@@ -952,7 +953,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);
+ }
+
+ size_t CZNC::FilterUncommonModules(set<CModInfo>& ssModules) {
+@@ -1971,3 +1972,7 @@ void CZNC::LeakConnectQueueTimer(CConnectQueueTimer *pTimer) {
+ bool CZNC::WaitForChildLock() {
+ return m_pLockFile && m_pLockFile->ExLock();
+ }
++
++void CZNC::SetSystemWideConfig(bool systemWideConfig) {
++ m_bSystemWideConfig = systemWideConfig;
++}
diff --git a/net-irc/znc/files/znc.confd b/net-irc/znc/files/znc.confd
new file mode 100644
index 000000000000..44bb497eab5a
--- /dev/null
+++ b/net-irc/znc/files/znc.confd
@@ -0,0 +1,7 @@
+# /etc/conf.d/znc
+
+# Location of the znc configuration folder
+ZNC_CONF="/etc/znc"
+
+# User to run znc as
+ZNC_USER="znc"
diff --git a/net-irc/znc/files/znc.initd b/net-irc/znc/files/znc.initd
new file mode 100644
index 000000000000..8b7c8bca5ee4
--- /dev/null
+++ b/net-irc/znc/files/znc.initd
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-irc/znc/files/znc.initd,v 1.1 2012/11/21 18:11:31 wired Exp $
+
+extra_commands="config"
+extra_started_commands="reload save"
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting ZNC"
+ start-stop-daemon --start --user ${ZNC_USER} --name znc \
+ --exec /usr/bin/znc -- -d ${ZNC_CONF}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ZNC"
+ start-stop-daemon --signal SIGINT --name znc \
+ --exec /usr/bin/znc -- -d ${ZNC_CONF}
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading ZNC Configuration File from Disk"
+ start-stop-daemon --signal SIGHUP --name znc \
+ --exec /usr/bin/znc -- -d ${ZNC_CONF}
+ eend $?
+}
+
+save() {
+ ebegin "Saving ZNC Configuration File to Disk"
+ start-stop-daemon --signal SIGUSR1 --name znc \
+ --exec /usr/bin/znc -- -d ${ZNC_CONF}
+ eend $?
+}
diff --git a/net-irc/znc/metadata.xml b/net-irc/znc/metadata.xml
index ea5a9ff6de88..851c2f9c4ffa 100644
--- a/net-irc/znc/metadata.xml
+++ b/net-irc/znc/metadata.xml
@@ -7,6 +7,7 @@
<name>Alex Alexander</name>
</maintainer>
<use>
+ <flag name="daemon">Allow znc to run as a system-wide service. Installs an init script and creates a znc user:group.</flag>
<flag name="extras">Enable some additional modules</flag>
<flag name="ares">Enables support for asynchronous DNS using the c-ares library</flag>
<flag name="dns-threads">Use threads for DNS resolving</flag>
diff --git a/net-irc/znc/znc-1.0.ebuild b/net-irc/znc/znc-1.0.ebuild
new file mode 100644
index 000000000000..e61cd17d7f64
--- /dev/null
+++ b/net-irc/znc/znc-1.0.ebuild
@@ -0,0 +1,138 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-irc/znc/znc-1.0.ebuild,v 1.1 2012/11/21 18:11:31 wired Exp $
+
+EAPI=5
+
+PYTHON_DEPEND="python? 3"
+inherit base python user
+
+MY_PV=${PV/_/-}
+DESCRIPTION="An advanced IRC Bouncer"
+HOMEPAGE="http://znc.in"
+SRC_URI="http://znc.in/releases/${PN}-${MY_PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="daemon debug ipv6 perl python ssl sasl tcl"
+
+RDEPEND="
+ perl? ( >=dev-lang/perl-5.10 )
+ sasl? ( >=dev-libs/cyrus-sasl-2 )
+ ssl? ( >=dev-libs/openssl-0.9.7d )
+ tcl? ( dev-lang/tcl )
+"
+DEPEND="
+ virtual/pkgconfig
+ perl? ( dev-lang/swig )
+ python? (
+ >=dev-lang/swig-2.0.2
+ >=dev-lang/perl-5.10
+ )
+ ${RDEPEND}
+"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+PATCHES=(
+ "${FILESDIR}/${P}-systemwideconfig.patch"
+)
+
+pkg_setup() {
+ if use python; then
+ python_set_active_version 3
+ python_pkg_setup
+ fi
+ if use daemon; then
+ enewgroup ${PN}
+ enewuser ${PN} -1 -1 /dev/null ${PN}
+ fi
+}
+
+src_configure() {
+ econf \
+ $(use_enable debug) \
+ $(use_enable ipv6) \
+ $(use_enable perl) \
+ $(use python && echo "--enable-python=python-$(python_get_version)") \
+ $(use_enable sasl cyrus) \
+ $(use_enable ssl openssl) \
+ $(use_enable tcl tcl)
+}
+
+src_install() {
+ emake install DESTDIR="${D}"
+ dodoc AUTHORS README.md
+ if use daemon; then
+ newinitd "${FILESDIR}"/znc.initd znc
+ newconfd "${FILESDIR}"/znc.confd 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 "If you are using SSL you should also run 'znc --makepem'"
+ 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}"/etc/znc ]]; then
+ elog
+ elog "Run 'emerge --config znc' to configure ZNC"
+ elog "as a system-wide daemon."
+ elog
+ elog "If you are using SSL you should also run:"
+ elog " znc --system-wide-config-as znc --makepem -d /etc/znc"
+ elog "as root"
+ elog
+ elog "If migrating from a user-based install"
+ elog "you can use your existing config files:"
+ elog " mkdir /etc/znc"
+ elog " mv /home/\$USER/.znc/* /etc/znc/"
+ elog " rm -rf /home/\$USER/.znc"
+ elog " chown -R znc:znc /etc/znc"
+ 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."
+ else
+ elog "Existing config detected in /etc/znc"
+ elog "You're good to go :)"
+ fi
+ elog
+ fi
+}
+
+pkg_config() {
+ if use daemon && ! [[ -d "${EROOT}"/etc/znc ]]; then
+ einfo "Press ENTER to interactively create a new configuration file for znc."
+ einfo "To abort, press Control-C"
+ read
+ mkdir -p "${EROOT}"/etc/znc || die
+ chown -R ${PN}:${PN} "${EROOT}"/etc/znc ||
+ die "Setting permissions failed"
+ "${EROOT}"/usr/bin/znc --system-wide-config-as znc -c -r -d "${EROOT}"/etc/znc ||
+ 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 "/etc/znc 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
+}