summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Wijsman <tomwij@gentoo.org>2013-02-23 20:13:34 +0000
committerTom Wijsman <tomwij@gentoo.org>2013-02-23 20:13:34 +0000
commit55cb6033db6880817a4eed837fd2b464761514ab (patch)
treeb6ec0def390588609a2e5fecf6a5971e882c798e /net-misc/stargazer
parentNew ebuild for stargazer. Contributed by SpiderX. Fixes bug #452916. (diff)
downloadhistorical-55cb6033db6880817a4eed837fd2b464761514ab.tar.gz
historical-55cb6033db6880817a4eed837fd2b464761514ab.tar.bz2
historical-55cb6033db6880817a4eed837fd2b464761514ab.zip
New ebuild for stargazer. Contributed by SpiderX. Fixes bug #452916.
Package-Manager: portage-2.1.11.52/cvs/Linux x86_64 Manifest-Sign-Key: 0x6D34E57D
Diffstat (limited to 'net-misc/stargazer')
-rw-r--r--net-misc/stargazer/Manifest17
-rw-r--r--net-misc/stargazer/metadata.xml55
-rw-r--r--net-misc/stargazer/stargazer-2.408.ebuild541
3 files changed, 612 insertions, 1 deletions
diff --git a/net-misc/stargazer/Manifest b/net-misc/stargazer/Manifest
index c2c51d699699..2dbb96868f77 100644
--- a/net-misc/stargazer/Manifest
+++ b/net-misc/stargazer/Manifest
@@ -1,3 +1,6 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
AUX logrotate 130 SHA256 aa61e339247685708af8661f82e02b9312f733a1b4f3662e79868c95b92f53e9 SHA512 bc6b186ac83fdfdbd26c75fbef6a350e7e3af0b106082cebc4001512b07be501326df23bc260846453b1bb322e8a08abc2a1b111982c71edf1df5c05cb394790 WHIRLPOOL 158eaf9ed5595a101d96922c7f8fe734548019f41eaffe9077e23f404bc0927675556b3390b4765fb44a1f4661ee23dbf33f827e6f7ece56a0031b9b89d6384f
AUX mans/rscriptd.8 1057 SHA256 2858cd9ecebe64b352809a92c2b1228aa761f5b1ddce035161d6a832e74984bc SHA512 2afbd834aceb273a7574012bae43881d9918247524c96a1f60fa31cdc4331757a0e345432155d83a21a21a7c37f494984c175a282f4b16e4f1fb2882754676bc WHIRLPOOL 3fc0a8e7b68f673188b2737ce2fd4c6f67012bb53a83f004e946cd9ea91482656c300dd88c0ff0ed9878a1cd5e3682f03803a0eb4b1f24f1f70c4df0ce6d9c6e
AUX mans/sgauth.8 1146 SHA256 261ed5b23e4cda616e200fbf08aa232a3f9aeff115992ff0539e67c717f146b8 SHA512 724ce9ed66abe53b9c22db273e04e372663d958bb8a70938baa88f844410f7eccaaf3b95515f2d24189b6b93711f26d2588758ffd2cdf8116631c092d18d72c2 WHIRLPOOL 92148933eef8d0076043907f4e1cd7155dcc28ef2c9a1edbbc72ce39c79e84e55d67b55c1edd7d4b25212f6ae2d39830b81854ec16df3539e79c1a548f31662c
@@ -22,5 +25,17 @@ AUX patches/stg-2.408-static-libs.patch 194 SHA256 6e1cd7b76a266335bd49b00decd72
AUX rscriptd 452 SHA256 5edddec4558285b970a202548c8188c26dde1415044bf0ca634042e8dc550092 SHA512 b271a1d554fd70064742d2517c247556245ba0d2ac75fee055998a727c24edba91983758b69794d54fa3e5577131cc5f143a852591665c7279de628b3716156c WHIRLPOOL 79ae200f8208af4bb76b1a62bf118ba5a5a0144f4c4ad4e9e7d5deaaa4c8da01b0f776e20a6f6b277fcdb0d9af25c72630191f562195444c6274540d48914198
AUX sgauth 461 SHA256 03e886b76e434928d32dcfba86c09ab7dcd47334f33c0e68af357578ba714361 SHA512 61a098ca5c376830bbd19a29094880a5b01aa707bdb49edcb0c5d19c33d0735c3a5971fd1329c62b70838b316c2eae539bdaa56ebe470acd0562a735946a810f WHIRLPOOL ff29b1d3842a5bbebfeca3fe6b2de2fff92c9976991feb17337182c1ef8a0eea8295ac8f5a08866d7a7428e07bfef42b3df907e3b69a3104fb075f78786e5b75
DIST stg-2.408.tar.gz 5100291 SHA256 f2de88cba1a07b10dba266df262ba719cdeb8efc169ce52711519d81b3c36fc1 SHA512 200e08cfd629dbacda31ffd3134c2908a1ad58604421cc288ad0ec1bdcd60fe021d51fed50fdc2517bb7c2b61ef23b0b9c71a606babd09bc7804cb899e0b7f75 WHIRLPOOL 3701d0bf16e06dc61474a772566a570a21d04fcf5ac5c28fb61b454f21c1471adc6f45645c3929b3ed15bb33eee10425a942b25f83ea7b3ea94eb15b80df7dad
-EBUILD stargazer-2.408.ebuild 19037 SHA256 e7342f4891d57ae41ec669c3369aa86f5f81b42fe3e398f3f1d41563e38fe4a6 SHA512 f98735fd2a73cd588239088115893e15108defde84ee60072d04c2d7d6703989c14ce4e60f9e55517e6b179ee389ae5adc25a116f78675a8e1d3e3ebb398b41c WHIRLPOOL 993e2f1f576b749770f5b169248ad2aee55c1c94990edd5d63c8b0521e7c11d301b9c4b6afcf3812cfc990b24827cf51a1f3b1a446de2fa9769a81db7bc7a13a
+EBUILD stargazer-2.408.ebuild 19140 SHA256 3544a87b61ad0075f55a442b644cc6c63df08b9d8041872344253227bade94fd SHA512 58f2af5c7327f6f4f95b888b97ffe4fc4776a302ab25ec860bdcf716e07e9e068cf3e6650661446b9354ebca5c86306ec444480d332ca6878915adc5c973677a WHIRLPOOL 3eb2aafc0ccfbdb9b1a7cf9c08c7a3b3b110e4f7c6930d2408bccc6eed5f86b64bebefa85537fa30e98e78c13830084e892eabac27eb287e2235d38eadf34e1b
+MISC ChangeLog 1303 SHA256 d21d4d34fd0b02e441ea80ea93dd2a8e7a841b51bcfd623292a8b2421c03ef66 SHA512 a40bdc828bb695f793cae6f27ddb7bde14002aafc4d6c42f3b03b9ee2c02de7005784549fe8b0500fc8c680b533e3fdff895f1e08548f3ca50b408e1327b9ac0 WHIRLPOOL 77340961b1b1bf66bdec8414cb56102e691ec6e6936515111e1e8dcd0a1956c3ce145bcb09e477c56b5611db8d697a004474980541bb84055c35d594fafb0f99
MISC metadata.xml 4513 SHA256 fae521ed163f64ea8775837c727530ec5f5b876090ffa133368c2f0e7bf66459 SHA512 cdf1d5a15299171789966fc26232709c642a27c56bb9d5e14209f0acc3931927906ee7f346ed2bb50e1c003baf50b29cb4dbee907c76b1c25d2ecea7b042143c WHIRLPOOL 50bfa66304b93000992b8249cf324c74fbec6e4c141489d02a038788356a607ae837ebf83d3255247580d05610d4fbe130036a2d731afc5c1d0db332d22a1a3c
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQEcBAEBCAAGBQJRKSL1AAoJEJWyH81tNOV9GjEH/R9bjRjPQ9vW6yb70WdmJBn6
+bHivSie0hJo83D1BNJ6Y7VCqOpmb8pN9/Lf2tzn/GrpQ4KQYrUfmbsC3B2Cb/RwW
+i8nVwx8h1friZ6VG2ZvuZHwDNYd1h5X4diW4kVtMwEmxhIOfJVFE4c/w40FW233D
+K6wTejCTYsUxfBxAw9JVLSW8dDJ6nvNx1AtWcenxZYzKhdPYkssZ/4C2wXxwd5z5
+G9CBXFakRLASNI1zKDYF9fotCEucB6OKDtEy3geoHqc/JC47RuMICLggSdvGfgDX
+FGgfotKJmjes0w1/buQbghFcJQcoH4xjVFMAcW37GlTSjkJBvUO9n+WzTlsf92Q=
+=3NVc
+-----END PGP SIGNATURE-----
diff --git a/net-misc/stargazer/metadata.xml b/net-misc/stargazer/metadata.xml
new file mode 100644
index 000000000000..3f51b2b29135
--- /dev/null
+++ b/net-misc/stargazer/metadata.xml
@@ -0,0 +1,55 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>spiderx@spiderx.dp.ua</email>
+ <name>Vladimir Pavljuchenkov</name>
+ <description>Primary maintainer.</description>
+ </maintainer>
+ <maintainer>
+ <email>TomWij@gentoo.org</email>
+ <name>Tom Wijsman</name>
+ <description>Committer, please CC him.</description>
+ </maintainer>
+ <longdescription>
+ Stargazer is a powerful (inter)net billing system, capable of gathering
+ traffic statistics from many sources (such as NetFlow protocol,
+ ethernet packets capture, or IPQ subsystem), managing and billing user
+ accounts according to specified fees and rules (including time-based rules,
+ traffic source/destination rules and a payoff system).
+ This ebuild allows you to compile it yourself depending of your needs.
+ </longdescription>
+ <use>
+ <flag name="sgconv">Enable build of utility to convert Stargazer data between storage backends.</flag>
+ <flag name="radius">Enable build of FreeRADIUS module for data access via Stargazer.</flag>
+ <flag name="rscriptd">Enable build of remote script execute daemon for Stargazer, which run scripts when receive special signal from Stargazer.</flag>
+ <flag name="sgauth">Enable build of command-line utility for authorization in Stargazer.</flag>
+ <flag name="sgconf">Enable build of command-line utility for configuring Stargazer.</flag>
+ <flag name="sgconf_xml">Enable build of command-line xml-based utility for configuring Stargazer.</flag>
+ <flag name="stargazer">Enable build of Stargazer billing system.</flag>
+ <flag name="debug">Enable extra debug codepaths, like asserts and extra output.</flag>
+ <flag name="doc">Adds extra documentation (API, doc, etc).</flag>
+ <flag name="examples">Install examples, usually source code.</flag>
+ <flag name="static-libs">Install static libraries.</flag>
+ <flag name="module_auth_always_online">Enable build of "Always Online" authentication module for Stargazer.</flag>
+ <flag name="module_auth_internet_access">Enable build of "InetAccess" authentication module for Stargazer. InetAccess is a Stargazer specific authentication protocol.</flag>
+ <flag name="module_auth_freeradius">Enable build of "Radius" authentication module for Stargazer. This module capable of using RADIUS procotol for user authentication.</flag>
+ <flag name="module_capture_ether">Enable build of "Ethernet" traffic capture module for Stargazer. This module uses RAW sockets to capture traffic.</flag>
+ <flag name="module_capture_ipq">Enable build of "IPQ" traffic capture module for Stargazer. This module uses IPQ subsystem to capture traffic.</flag>
+ <flag name="module_capture_netflow">Enable build of "NetFlow" traffic capture module for Stargazer. This module capable of receiving traffic data by NetFlow protocol.</flag>
+ <flag name="module_config_rpcconfig">Enable build of "XMLRPC" configuration module for Stargazer. This module uses XML-RPC protocol for configuring Stargazer.</flag>
+ <flag name="module_config_sgconfig">Enable build of "SGConf" configuration module for Stargazer. This module uses Stargazer specific protocol for configuring Stargazer.</flag>
+ <flag name="module_other_ping">Enable build of "Ping" module for Stargazer. This module pings connected users from time to time to ensure they are alive.</flag>
+ <flag name="module_other_remote_script">Enable build of "Remote Script" module for Stargazer. This module control rscriptd daemon over the net and makes it execute scripts in reaction to different Stargazer events.</flag>
+ <flag name="module_other_smux">Enable build of SMUX module for Stargazer. This module uses SMUX protocol to provide various information about Stargazer.</flag>
+ <flag name="module_store_files">Enable build of storage plugin for Stargazer based on plain files.</flag>
+ <flag name="module_store_firebird">Enable build of storage plugin for Stargazer, which uses Firebird database for storage.</flag>
+ <flag name="module_store_mysql">Enable build of storage plugin for Stargazer, which uses MySQL for storage.</flag>
+ <flag name="module_store_postgres">Enable build of storage plugin for Stargazer, which uses PostgreSQL for storage.</flag>
+ </use>
+ <upstream>
+ <changelog>http://stg.dp.ua/server_dl.php</changelog>
+ <doc>http://stg.dp.ua/doc.php</doc>
+ <bugs-to>mailto:faust@stg.dp.ua</bugs-to>
+ </upstream>
+</pkgmetadata>
diff --git a/net-misc/stargazer/stargazer-2.408.ebuild b/net-misc/stargazer/stargazer-2.408.ebuild
new file mode 100644
index 000000000000..c810392f3e6d
--- /dev/null
+++ b/net-misc/stargazer/stargazer-2.408.ebuild
@@ -0,0 +1,541 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/stargazer/stargazer-2.408.ebuild,v 1.1 2013/02/23 20:13:31 tomwij Exp $
+
+EAPI="5"
+
+inherit eutils linux-info multilib
+
+DESCRIPTION="Billing system for small home and office networks"
+HOMEPAGE="http://stg.dp.ua/"
+LICENSE="GPL-2"
+
+MY_P="stg-${PV}"
+SRC_URI="http://stg.dp.ua/download/server/${PV}/${MY_P}.tar.gz"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+S="${WORKDIR}/${MY_P}"
+
+REQUIRED_USE="stargazer? ( ^^ ( module_store_files module_store_firebird module_store_mysql module_store_postgres ) )"
+
+RDEPEND="module_config_rpcconfig? ( dev-libs/xmlrpc-c[abyss] sys-libs/zlib )
+ module_config_sgconfig? ( dev-libs/expat )
+ module_store_firebird? ( >=dev-db/firebird-2.0.3.12981.0-r6 )
+ module_store_mysql? ( dev-db/mysql )
+ module_store_postgres? ( dev-db/postgresql-base dev-libs/openssl sys-libs/zlib )
+ sgconf? ( dev-libs/expat )
+ sgconf_xml? ( dev-libs/expat )"
+
+DEPEND="${RDEPEND}
+ doc? ( dev-libs/libxslt )"
+
+PROJECTS="sgconv rlm_stg rscriptd sgauth sgconf sgconf_xml stargazer"
+
+STG_MODULES_AUTH="always_online internet_access freeradius"
+STG_MODULES_CAPTURE="ipq ether netflow"
+STG_MODULES_CONFIG="sgconfig rpcconfig"
+STG_MODULES_OTHER="ping smux remote_script"
+STG_MODULES_STORE="files firebird mysql postgres"
+
+declare -A MODULES
+MODULES=( [module_auth_always_online]="authorization\/ao:mod_ao"
+ [module_auth_internet_access]="authorization\/inetaccess:mod_ia"
+ [module_auth_freeradius]="other\/radius:mod_radius"
+ [module_capture_ipq]="capture\/ipq_linux:mod_cap_ipq"
+ [module_capture_ether]="capture\/ether_linux:mod_cap_ether"
+ [module_capture_netflow]="capture\/cap_nf:mod_cap_nf"
+ [module_config_sgconfig]="configuration\/sgconfig:mod_sg"
+ [module_config_rpcconfig]="configuration\/rpcconfig:mod_rpc"
+ [module_other_ping]="other\/ping:mod_ping"
+ [module_other_smux]="other\/smux:mod_smux"
+ [module_other_remote_script]="other\/rscript:mod_remote_script"
+ [module_store_files]="store\/files:store_files"
+ [module_store_firebird]="store\/firebird:store_firebird"
+ [module_store_mysql]="store\/mysql:store_mysql"
+ [module_store_postgres]="store\/postgresql:store_postgresql"
+)
+
+IUSE="sgconv radius rscriptd sgauth sgconf sgconf_xml stargazer debug doc examples static-libs"
+
+for module in ${STG_MODULES_AUTH} ; do IUSE="${IUSE} module_auth_${module}" ; done
+for module in ${STG_MODULES_CAPTURE} ; do IUSE="${IUSE} module_capture_${module}" ; done
+for module in ${STG_MODULES_CONFIG} ; do IUSE="${IUSE} module_config_${module}" ; done
+for module in ${STG_MODULES_OTHER} ; do IUSE="${IUSE} module_other_${module}" ; done
+for module in ${STG_MODULES_STORE} ; do IUSE="${IUSE} module_store_${module}" ; done
+
+IUSE=${IUSE/stargazer/+stargazer}
+IUSE=${IUSE/module_store_files/+module_store_files}
+
+src_prepare() {
+ # Patches already in upstream's trunk
+ # Rename convertor to sgconv to avoid possible file name collisions
+ mv "${S}"/projects/convertor/ "${S}"/projects/sgconv/
+ mv "${S}"/projects/sgconv/convertor.conf "${S}"/projects/sgconv/sgconv.conf
+ epatch "${FILESDIR}"/patches/stg-2.408-sgconv-upstream.patch
+
+ # Fix dependency on fbclient for module_store_firebird
+ epatch "${FILESDIR}"/patches/stg-2.408-makefile-firebird-upstream.patch
+
+ # Debug support. Install radius lib to /usr/lib/freeradius
+ epatch "${FILESDIR}"/patches/stg-2.408-makefile-build-upstream.patch
+
+ # Don't compile sgconv always with debug. Remove MAKEOPTS=-j1
+ epatch "${FILESDIR}"/patches/stg-2.408-build-upstream.patch
+
+ # Rewrite config for rscriptd
+ epatch "${FILESDIR}"/patches/stg-2.408-rscriptd.conf-upstream.patch
+
+ # Rewrite config for sgauth
+ epatch "${FILESDIR}"/patches/stg-2.408-sgauth.conf-upstream.patch
+
+ # Standardization of 'On-scripts'
+ epatch "${FILESDIR}"/patches/stg-2.408-on-upstream.patch
+
+ # FreeBSD install directory
+ epatch "${FILESDIR}"/patches/stg-2.408-radius-upstream.patch
+
+ # Install demo scripts for rscriptd
+ epatch "${FILESDIR}"/patches/stg-2.408-rscriptd-upstream.patch
+
+ # Fix crush on stop
+ epatch "${FILESDIR}"/patches/stg-2.408-fix-crash-on-stop.patch
+
+ for project in ${PROJECTS} ; do
+ # Rename build script to configure for further econf launch in every projects
+ mv "${S}"/projects/${project}/build "${S}"/projects/${project}/configure
+
+ # Change check for debug build
+ sed -i 's/if \[ "$1" = "debug" \]/if \[ "${10}" = "--enable-debug" \]/' "${S}"/projects/${project}/configure
+ done
+
+ # Correct working directory, user and group for sgconv.conf, store_files.conf
+ # Correct paths for rscriptd.conf, store_firebird.conf, mod_remote_scriptd.conf, stargazer.conf, rpcconfig.cpp, 00-base-00.sql
+ epatch "${FILESDIR}"/patches/stg-2.408-correct-paths.patch
+
+ # Correct target install-data for stargazer, rscriptd, sgauth, remove debug symbols stripping
+ epatch "${FILESDIR}"/patches/stg-2.408-makefile.patch
+
+ # Remove make from script (for keeping symbols), always add variable to Makefile.conf for all projects
+ epatch "${FILESDIR}"/patches/stg-2.408-build.patch
+
+ # Remove static-libs if not needed
+ use static-libs || epatch "${FILESDIR}"/patches/stg-2.408-static-libs.patch
+
+ # Define which module to compile
+ for module in ${!MODULES[@]} ; do
+ use $module || sed -i "s/${MODULES[$module]%:*}//" "${S}"/projects/stargazer/configure
+ done
+
+ # Correct Gentoo init script provided by upstream (TODO: Remove in further releases, already fixed in upstream's trunk)
+ use stargazer && sed -i 's/opts/extra_commands/' "${S}"/projects/stargazer/inst/linux/etc/init.d/stargazer.gentoo
+
+ # Correct Gentoo init script dependencies
+ use module_store_files && sed -i '11d' "${S}"/projects/stargazer/inst/linux/etc/init.d/stargazer.gentoo
+ use module_store_firebird && sed -i '11d;s/need net/need net firebird/' "${S}"/projects/stargazer/inst/linux/etc/init.d/stargazer.gentoo
+ use module_store_mysql && sed -i '11d;s/need net/need net mysql/' "${S}"/projects/stargazer/inst/linux/etc/init.d/stargazer.gentoo
+ use module_store_postgres && sed -i '11d;s/need net/need net postgresql/' "${S}"/projects/stargazer/inst/linux/etc/init.d/stargazer.gentoo
+
+ # Check for IPQ subsystem availability
+ ( use module_capture_ipq && kernel_is ge 3 5 ) && die "IPQ subsystem is gone since Linux kernel 3.5. You can't compile module_capture_ipq with your current kernel."
+}
+
+src_configure() {
+ # Define local variables, strip '+' symbol for used by default USE flags
+ local USEFLAGS=(${IUSE//+})
+ local PROJECTS=($PROJECTS)
+
+ for (( i = 0 ; i < ${#PROJECTS[@]} ; i++ )) ; do
+ if use ${USEFLAGS[$i]} ; then
+ cd "${S}"/projects/${PROJECTS[$i]} || die "cd to ${PROJECTS[$i]} failed"
+ econf $(use_enable debug)
+ fi
+ done
+}
+
+src_compile() {
+ # Define local variables, strip '+' symbol for used by default USE flags
+ local USEFLAGS=(${IUSE//+})
+ local PROJECTS=($PROJECTS)
+
+ # Set jobs to 1 for debug build
+ use debug && MAKEOPTS="-j1"
+
+ # Build necessary libraries first
+ touch "${S}"/Makefile.conf
+ cd "${S}"/stglibs
+ emake STG_LIBS="ia.lib srvconf.lib"
+
+ for (( i = 0 ; i < ${#PROJECTS[@]} ; i++ )) ; do
+ if use ${USEFLAGS[$i]} ; then
+ cd "${S}"/projects/${PROJECTS[$i]} || die "cd to ${PROJECTS[$i]} failed"
+ emake
+ fi
+ done
+
+ if use doc ; then
+ cd "${S}"/doc/xmlrpc
+
+ emake
+ fi
+}
+
+src_install() {
+ dodoc ChangeLog
+
+ if use rscriptd || use stargazer ; then
+ # Install config file for logrotate
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/logrotate stargazer
+
+ # Keeping logs directory
+ diropts -m 755 -o stg -g stg
+ keepdir /var/log/stargazer
+ if use stargazer ; then
+ diropts -m 775 -o stg -g stg
+ keepdir /var/lib/stargazer
+ fi
+ fi
+
+ if use doc ; then
+ # Install files into docs directory
+ dodoc "${S}"/projects/stargazer/inst/var/base.dia
+ dodoc "${S}"/doc/proto_client.gif
+ dodoc "${S}"/doc/proto_server.gif
+
+ # Install html documentation
+ docinto html/xmlrpc
+ dohtml -r "${S}"/doc/xmlrpc/book/
+ fi
+
+ if use examples ; then
+ # Install files into specified directory
+ insinto /usr/share/stargazer
+ doins -r "${S}"/projects/stargazer/scripts
+ doins "${S}"/doc/xmlrpc.php
+ fi
+
+ if use sgconv ; then
+ cd "${S}"/projects/sgconv
+
+ emake DESTDIR="${D}" PREFIX="${D}" install
+
+ # Install files into specified directory
+ insinto /etc/stargazer
+ doins "${S}"/projects/sgconv/sgconv.conf
+
+ # Install manual page
+ doman "${FILESDIR}"/mans/sgconv.1
+ fi
+
+ if use radius ; then
+ cd "${S}"/projects/rlm_stg
+
+ emake DESTDIR="${D}" PREFIX="${D}" install
+ fi
+
+ if use rscriptd ; then
+ cd "${S}"/projects/rscriptd
+
+ emake DESTDIR="${D}" PREFIX="${D}" install
+
+ # Install Gentoo init script
+ doinitd "${FILESDIR}"/rscriptd
+
+ # Correct permissions for file
+ fperms 0640 /etc/stargazer/rscriptd.conf
+
+ # Install manual page
+ doman "${FILESDIR}"/mans/rscriptd.8
+ fi
+
+ if use sgauth ; then
+ cd "${S}"/projects/sgauth
+
+ emake DESTDIR="${D}" PREFIX="${D}" install
+
+ # Correct permissions for file
+ fperms 0640 /etc/stargazer/sgauth.conf
+
+ # Install manual page
+ doman "${FILESDIR}"/mans/sgauth.8
+ fi
+
+ if use sgconf ; then
+ cd "${S}"/projects/sgconf
+
+ emake DESTDIR="${D}" PREFIX="${D}" install
+
+ # Install manual page
+ doman "${FILESDIR}"/mans/sgconf.1
+ fi
+
+ if use sgconf_xml ; then
+ cd "${S}"/projects/sgconf_xml
+
+ emake DESTDIR="${D}" PREFIX="${D}" install
+
+ # Install manual page
+ doman "${FILESDIR}"/mans/sgconf_xml.1
+ fi
+
+ if use stargazer ; then
+ cd "${S}"/projects/stargazer
+
+ emake DESTDIR="${D}" PREFIX="${D}" install
+
+ # Install docs
+ dodoc BUGS CHANGES README TODO
+
+ # Install and rename Gentoo init script
+ newinitd "${S}"/projects/stargazer/inst/linux/etc/init.d/stargazer.gentoo stargazer
+
+ # Install manual page
+ doman "${FILESDIR}"/mans/stargazer.8
+
+ # Install files needed for module_store_files
+ if use module_store_files ; then
+ # Install files into specified directory
+ insinto /var/lib
+ doins -r "${S}"/projects/stargazer/inst/var/stargazer
+
+ # Correct user and group for files and directories
+ fowners -R stg:stg /var/lib/stargazer
+ fi
+
+ if use module_store_firebird ; then
+ # Install files into specified directory
+ insinto /usr/share/stargazer/db/firebird
+ doins \
+ "${S}"/projects/stargazer/inst/var/00-base-00.sql \
+ "${S}"/projects/stargazer/inst/var/00-alter-01.sql
+ fi
+
+ if use module_store_mysql ; then
+ # Install file into specified directory
+ insinto /usr/share/stargazer/db/mysql
+ doins "${S}"/projects/stargazer/inst/var/00-mysql-01.sql
+ fi
+
+ if use module_store_postgres ; then
+ # Install files into specified directory
+ insinto /usr/share/stargazer/db/postgresql
+ doins \
+ "${S}"/projects/stargazer/inst/var/00-base-00.postgresql.sql \
+ "${S}"/projects/stargazer/inst/var/00-alter-01.postgresql.sql
+ fi
+
+ if use module_other_smux ; then
+ # Install files into specified directory
+ insinto /usr/share/snmp/mibs
+ doins "${S}"/projects/stargazer/plugins/other/smux/STG-MIB.mib
+ fi
+
+ if use module_other_remote_script ; then
+ # Create subnets file based on example from mod_remote_script.conf
+ grep 192 "${S}"/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/mod_remote_script.conf | sed 's/# //' > "${D}"/etc/stargazer/subnets
+
+ # Correct permissions for file
+ fperms 0640 /etc/stargazer/subnets
+ fi
+
+ # Correct permissions for files
+ fperms 0640 \
+ /etc/stargazer/rules \
+ /etc/stargazer/stargazer.conf
+
+ # Install files into specified directory for selected modules
+ insinto /etc/stargazer/conf-available.d
+ insopts -m 0640
+
+ for module in ${!MODULES[@]} ; do
+ use $module && doins "${S}"/projects/stargazer/inst/linux/etc/stargazer/conf-available.d/${MODULES[$module]#*:}.conf
+ done
+
+ # Create symlinks of configs for selected modules
+ for module in ${!MODULES[@]} ; do
+ use $module && dosym /etc/stargazer/conf-available.d/${MODULES[$module]#*:}.conf /etc/stargazer/conf-enabled.d/${MODULES[$module]#*:}.conf
+ done
+ fi
+
+ # Correct user and group for files and directories
+ ( use sgconv || use rscriptd || use sgauth || use stargazer ) && fowners -R stg:stg /etc/stargazer
+
+ # Put the files in the right folder to support multilib
+ mv "${ED}"/usr/lib "${ED}"/usr/$(get_libdir)
+}
+
+pkg_setup() {
+ # Add user and group to system only when necessary
+ if use sgconv || use rscriptd || use sgauth || use stargazer ; then
+ enewgroup stg
+
+ # Add stg user to system (no home directory specified, because otherwise it will be result in stg:root ownership on it)
+ enewuser stg -1 -1 -1 stg
+ fi
+}
+
+pkg_postinst() {
+ if use sgconv ; then
+ einfo "\nSgconv:"
+ einfo "----------"
+ einfo " For further use of sgconv please edit /etc/stargazer/sgconv.conf depending on your needs."
+ fi
+
+ if use radius ; then
+ einfo "\nRadius:"
+ einfo "-------"
+ einfo " For further use of radius, emerge net-dialup/freeradius.\n"
+
+ einfo " Example config:\n"
+
+ einfo " stg {"
+ einfo " local_port = 6667"
+ einfo " server = localhost"
+ einfo " port = 6666"
+ einfo " password = 123456"
+ einfo " }\n"
+
+ einfo " You should place 'stg' into section Instantiate, Authorize."
+ einfo " In section Authentificate 'stg' should go in sub-section Auth-Type before other authentifications modules:\n"
+
+ einfo " Auth-Type PAP {"
+ einfo " stg"
+ einfo " pap"
+ einfo " }\n"
+
+ einfo " It also may be used in section Accounting and Post-Auth."
+
+ use !module_auth_freeradius || einfo "\n For use RADIUS data processing you should also enable USE-flag module_auth_freeradius."
+ fi
+
+ if use rscriptd ; then
+ einfo "\nRemote Script Executer:"
+ einfo "-----------------------"
+ einfo " For further use of rscriptd please edit /etc/stargazer/rscriptd.conf depending on your needs."
+ einfo " You have to change 'Password' field at least."
+ fi
+
+ if use sgauth ; then
+ einfo "\nSgauth:"
+ einfo "-------"
+ einfo " For further use of sgauth please edit /etc/stargazer/sgauth.conf depending on your needs."
+ einfo " You have to change 'ServerName', 'Login', 'Password' fields at least."
+ fi
+
+ if use sgconf ; then
+ einfo "\nSgconf:"
+ einfo "-------"
+ use !module_config_sgconfig || einfo " For further use of sgconf utility you should also enable USE-flag module_config_sgconfig."
+ fi
+
+ if use sgconf_xml ; then
+ einfo "\nSgconf_xml:"
+ einfo "-----------"
+ use !module_config_rpcconfig || einfo " For further use of sgconf_xml utility you should also enable USE-flag module_config_rpcconfig."
+ fi
+
+ if use stargazer ; then
+ einfo "\nStargazer:"
+ einfo "----------"
+ einfo " Modules availability:\n"
+
+ if use module_auth_always_online ; then
+ einfo " * module_auth_always_online available."
+ fi
+
+ if use module_auth_internet_access ; then
+ einfo " * module_auth_internet_access available."
+ fi
+
+ if use module_auth_freeradius ; then
+ einfo " * module_auth_freeradius available.\n"
+ einfo " For further use of module, emerge net-dialup/freeradius.\n"
+ use radius || einfo "\n For use RADIUS data processing you should also enable use USE-flag radius."
+ fi
+
+ if use module_capture_ipq ; then
+ einfo " * module_capture_ipq available."
+ fi
+
+ if use module_capture_ether ; then
+ einfo " * module_capture_ether available."
+ fi
+
+ if use module_capture_netflow ; then
+ einfo " * module_capture_netflow available.\n"
+ einfo " For further use of module, emerge net-firewall/ipt_netflow or net-analyzer/softflowd.\n"
+ fi
+
+ if use module_config_sgconfig ; then
+ einfo " * module_config_sgconfig available."
+ fi
+
+ if use module_config_rpcconfig ; then
+ einfo " * module_config_rpcconfig available.\n"
+ einfo " KNOWN BUG: Sometimes you can't configure Stargazer through xml-based configurator,"
+ einfo " because module is not responding."
+ einfo " This bug is introduced by xmlrpc-c library. This bug proceeds very rare, but it still exists.\n"
+ fi
+
+ if use module_other_ping ; then
+ einfo " * module_other_ping available."
+ fi
+
+ if use module_other_smux ; then
+ einfo " * module_other_smux available.\n"
+ einfo " For further use of module emerge net-analyzer/net-snmp.\n"
+ fi
+
+ if use module_other_remote_script ; then
+ einfo " * module_other_remote_script available.\n"
+ einfo " Don't forget to edit /etc/stargazer/subnets file depending on your needs."
+ fi
+
+ if use module_store_files ; then
+ einfo " * module_store_files available.\n"
+ einfo " Necessary and sufficient rights to the directory /var/lib/stargazer for this backend is 0755."
+ einfo " You may fix it if needed.\n"
+ fi
+
+ if use module_store_firebird ; then
+ einfo " * module_store_firebird available.\n"
+ einfo " Necessary and sufficient rights to the directory /var/lib/stargazer for this backend is 0775."
+ einfo " Check that it was so, and fix it if needed."
+ einfo " You should add 'firebird' user to stg group:\n"
+ einfo " # usermod -a -G stg firebird\n"
+ einfo " and restart firebird:\n"
+ einfo " # /etc/init.d/firebird restart\n"
+ einfo " Stargazer DB schema for Firebird is here: /usr/share/stargazer/db/firebird"
+ einfo " For new setup you should execute 00-base-00.sql:\n"
+ einfo " # fbsql -q -i /usr/share/stargazer/db/firebird/00-base-00.sql\n"
+ einfo " For upgrade from version 2.406 you should execute 00-alter-01.sql:\n"
+ einfo " # fbsql -q -u <username> -p <password> -d <database> -i /usr/share/stargazer/db/firebird/00-alter-01.sql\n"
+ fi
+
+ if use module_store_mysql ; then
+ einfo " * module_store_mysql available.\n"
+ einfo " For upgrade from version 2.406 you should execute 00-mysql-01.sql:\n"
+ einfo " # mysql -h <hostname> -P <port> -u <username> -p <password> <database> < /usr/share/stargazer/db/mysql/00-mysql-01.sql\n"
+ fi
+
+ if use module_store_postgres ; then
+ einfo " * module_store_postgres available.\n"
+ einfo " Stargazer DB schema for PostgresSQL is here: /usr/share/stargazer/db/postgresql"
+ einfo " For new setup you should execute 00-base-00.postgresql.sql:\n"
+ einfo " # psql -h <hostname> -p <port> -U <username> -d <database> -W -f /usr/share/stargazer/db/postgresql/00-base-00.postgresql.sql\n"
+ einfo " For upgrade from version 2.406 you should execute 00-alter-01.sql:\n"
+ einfo " # psql -h <hostname> -p <port> -U <username> -d <database> -W -f /usr/share/stargazer/db/postgresql/00-alter-01.sql\n"
+ fi
+
+ einfo "\n For all storage backends:\n"
+ einfo " * Default admin login - admin, default admin password - 123456."
+ einfo " * Default subscriber login - test, default subscriber password - 123456.\n"
+ einfo "Don't run newer versions without reading their ChangeLog first,"
+ einfo "it can be found in /usr/share/doc/${PF}"
+ fi
+
+ if use debug ; then
+ ewarn "\nThis is a debug build. You should avoid to use it in production.\n"
+ fi
+}