From 95353eb4b263ca9751df3d7f8f84e3ac3c6f8e36 Mon Sep 17 00:00:00 2001 From: layman Date: Sun, 21 Jan 2018 15:10:05 +0000 Subject: Add systemd unit for linode longview ebuild. --- net-analyzer/linode-longview/Manifest | 4 - net-analyzer/linode-longview/files/longview.openrc | 31 ------ .../linode-longview-1.1.4-r1.ebuild | 64 ------------ .../linode-longview/linode-longview-9999.ebuild | 63 ------------ net-analyzer/longview/Manifest | 3 + net-analyzer/longview/files/longview | 23 +++++ net-analyzer/longview/longview-1.1.5.ebuild | 111 +++++++++++++++++++++ 7 files changed, 137 insertions(+), 162 deletions(-) delete mode 100644 net-analyzer/linode-longview/Manifest delete mode 100644 net-analyzer/linode-longview/files/longview.openrc delete mode 100644 net-analyzer/linode-longview/linode-longview-1.1.4-r1.ebuild delete mode 100644 net-analyzer/linode-longview/linode-longview-9999.ebuild create mode 100644 net-analyzer/longview/Manifest create mode 100644 net-analyzer/longview/files/longview create mode 100644 net-analyzer/longview/longview-1.1.5.ebuild diff --git a/net-analyzer/linode-longview/Manifest b/net-analyzer/linode-longview/Manifest deleted file mode 100644 index 5afe586..0000000 --- a/net-analyzer/linode-longview/Manifest +++ /dev/null @@ -1,4 +0,0 @@ -AUX longview.openrc 780 SHA256 ed324c0efe5dcaaa62b75e4b103af401f830f8f53013905c493ec11b1ed4cf42 SHA512 ef3f34d60a182551fbf30ecceee983de457da2e586bbb5b643b5fea9ab4a1ed3f258909831d8e1d680ccf8fb5b4adb1a3ca85b3cf8f64678370a71a6343d47d5 WHIRLPOOL a775ceaab03b9fab2c76fc44d8efbcba076ebbabab20cc754c3df7966978bbcd8965d4b9ce9e75865b50208e87e95838d104822d3b59fcf6e03f14a760532b20 -DIST linode-longview-1.1.4.tar.gz 38110 SHA256 735811fd9118af91f03a4659d7aaa1b9ccb1c29043ebc97dfeb4b08994a18638 SHA512 6b4c2ea2cbd7ecc632332b305876438fa6de22a6ce5d84807e5164cd06dce3215e907380ff5eea90ec2fe3482e811ed832b56850e2c70c990dbe74e9131682eb WHIRLPOOL ca074f7ebf4eed5cadc744c3ae66ce972c8892087a4ddfc566be05374b39df6aa4fc8a84107eedd7b4a848ac7652e6339077078bb3f9c9b8961dc28cdac8c579 -EBUILD linode-longview-1.1.4-r1.ebuild 1626 SHA256 721284c0a1919199069b54761e7a18041431064ff12fc34b604e09b3a9e8839e SHA512 fe2f26f9b4a5802dbc2ab369077f3beb9384ffc54aba335dd6b8f45c159908dff95c8b981108fb54bb78c84e70422982a125fb5cac411ce2aadc1fa0124dfe28 WHIRLPOOL 13bd86e37c111b90af839874ce77f8bc0f141ae67542993e87db32b08e7c57141d901db7da688e7d8b21ade72d758e4db3ed2767bf195e239904425a55ff0eb1 -EBUILD linode-longview-9999.ebuild 1554 SHA256 4919c0cba0620f75473b25151a0a37f89810786ab23ceb0daa639a7ce271f3ea SHA512 57e047f553cd8c2e3bcf76630bf87942e7741b7d6f8ca7cdd32afb6d5fa734da10ae3b4f5b953beb28f2d61c76eb001a0eec05e00f748cf9cd152ffd83a33818 WHIRLPOOL 061370cc4e22276d52c6c1bff66b2e0dad77d8273c826fb28f527a63b828095077b5419e7c7da0f5826d5d0862fd6d82d685cc332cae8d5594112bf607f6ee87 diff --git a/net-analyzer/linode-longview/files/longview.openrc b/net-analyzer/linode-longview/files/longview.openrc deleted file mode 100644 index 0b24e6d..0000000 --- a/net-analyzer/linode-longview/files/longview.openrc +++ /dev/null @@ -1,31 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -extra_stopped_commands="debug" - -description="Linode Longview monitoring client" -description_debug="Start Longview in debug mode" - -depend() { - use net -} - -start() { - ebegin "Starting Longview" - start-stop-daemon --start --pidfile /var/run/longview.pid --exec /opt/linode/longview/Linode/Longview.pl - eend $? -} - -debug() { - ebegin "Starting Longview in debug mode" - start-stop-daemon --start --pidfile /var/run/longview.pid --exec /opt/linode/longview/Linode/Longview.pl -- Debug - eend $? -} - -stop() { - ebegin "Stopping Longview" - start-stop-daemon --stop --pidfile /var/run/longview.pid --exec /opt/linode/longview/Linode/Longview.pl - eend $? -} diff --git a/net-analyzer/linode-longview/linode-longview-1.1.4-r1.ebuild b/net-analyzer/linode-longview/linode-longview-1.1.4-r1.ebuild deleted file mode 100644 index 348d2ec..0000000 --- a/net-analyzer/linode-longview/linode-longview-1.1.4-r1.ebuild +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright 1999-2015 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -EAPI=5 - -DESCRIPTION="Linode Longview" -HOMEPAGE="https://www.linode.com/longview/" -LICENSE="Artistic GPL-2" -MY_PN="${PN/linode-/}" -SRC_URI="https://github.com/linode/${MY_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" - -SLOT="0" -KEYWORDS="amd64 x86" -IUSE="mysql" - -DEPEND="" -RDEPEND=" - app-portage/eix - dev-perl/IO-Socket-INET6 - dev-perl/JSON - dev-perl/Log-LogLite - dev-perl/libwww-perl[ssl] - dev-perl/Linux-Distribution - dev-perl/Try-Tiny - dev-perl/DBI - mysql? ( - dev-perl/DBD-mysql - ) -" - -MY_P="${P/linode-/}" -S="${WORKDIR}/${MY_P}" - -src_install(){ - insinto /opt/linode/longview - doins -r Linode - dodir /opt/linode/longview/Linode/Longview/DataGetter/Packages - insinto /opt/linode/longview/Linode/Longview/DataGetter/Packages - doins Extras/Modules/Packages/Gentoo.pm - fperms +x /opt/linode/longview/Linode/Longview.pl - keepdir /etc/linode - dodir /etc/linode/longview.d - insinto /etc/linode/longview.d - doins Extras/conf/*.conf - pushd "${D}" >/dev/null - fperms o-o etc/linode/longview.d/*.conf - popd >/dev/null - newinitd "${FILESDIR}"/longview.openrc longview -} - -pkg_postinst(){ - elog "You should now start Longview and enter the API Key provided by the Linode Manager." - elog "You can do so with the following command:" - elog - elog "/etc/init.d/longview start" - elog - elog "You'll also want to add Longview to the default runlevel:" - elog - elog "rc-update add longview default" - elog - elog "If you have any questions about using Longview, please open a support" - elog "ticket from within the Linode Manager." -} diff --git a/net-analyzer/linode-longview/linode-longview-9999.ebuild b/net-analyzer/linode-longview/linode-longview-9999.ebuild deleted file mode 100644 index dd94fa2..0000000 --- a/net-analyzer/linode-longview/linode-longview-9999.ebuild +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 1999-2015 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -EAPI=5 - -EGIT_REPO_URI="git://github.com/linode/longview.git" - -inherit eutils git-2 - -DESCRIPTION="Linode Longview" -HOMEPAGE="https://www.linode.com/longview/" -LICENSE="Artistic GPL-2" - -SLOT="0" -KEYWORDS="~amd64 ~x86" -IUSE="mysql" - -DEPEND="" -RDEPEND=" - app-portage/eix - dev-perl/IO-Socket-INET6 - dev-perl/JSON - dev-perl/Log-LogLite - dev-perl/libwww-perl[ssl] - dev-perl/Linux-Distribution - dev-perl/Try-Tiny - dev-perl/DBI - mysql? ( - dev-perl/DBD-mysql - ) -" - -src_install(){ - insinto /opt/linode/longview - doins -r Linode - dodir /opt/linode/longview/Linode/Longview/DataGetter/Packages - insinto /opt/linode/longview/Linode/Longview/DataGetter/Packages - doins Extras/Modules/Packages/Gentoo.pm - fperms +x /opt/linode/longview/Linode/Longview.pl - keepdir /etc/linode - dodir /etc/linode/longview.d - insinto /etc/linode/longview.d - doins Extras/conf/*.conf - pushd "${D}" >/dev/null - fperms o-o etc/linode/longview.d/*.conf - popd >/dev/null - newinitd "${FILESDIR}"/longview.openrc longview -} - -pkg_postinst(){ - elog "You should now start Longview and enter the API Key provided by the Linode Manager." - elog "You can do so with the following command:" - elog - elog "/etc/init.d/longview start" - elog - elog "You'll also want to add Longview to the default runlevel:" - elog - elog "rc-update add longview default" - elog - elog "If you have any questions about using Longview, please open a support" - elog "ticket from within the Linode Manager." -} diff --git a/net-analyzer/longview/Manifest b/net-analyzer/longview/Manifest new file mode 100644 index 0000000..55d6c3f --- /dev/null +++ b/net-analyzer/longview/Manifest @@ -0,0 +1,3 @@ +AUX longview 442 SHA256 8f4e48997f21757c669e08fdafb06d00f44fd281e3108e79e75fd39c77a46982 SHA512 fef5ab5d20a9a05cce1e69b8a9687a218e17a19bddc9b22e316d42385ef161d9d8e6252043ffb82a6600383191ce1a5ef88149b2d09daf885b62bdca22d3ad88 WHIRLPOOL c5a5fe13f8cfe30551124df4c619eeca954856c78a547824097d108440366bb79e63c59d5346ec3a96a60798aa0809e8c1277fa8bd48186e325cd8e22b3cbc12 +DIST longview-1.1.5.tar.gz 38293 SHA256 60a34af29e29e2c2640e7ee9dadd7771f78c6fb07f679a2887c1ddf704ca30ea SHA512 0bbe50a949968b6343a7cb51aab65ef3d15d1459ef53b36ea28681b23080ad74089e8554c823de9907fcc64364a736b27bbe2b4fed272ea5a9577bc48a8f473c WHIRLPOOL 0d76abcfb18b05b0f81de23738856e94e6e4e991c2f2aa261e719a10d59adfa82eca029da5903b9e5bcc0021984eaa4fdeefcbf33c522c0c6be976b0064ee454 +EBUILD longview-1.1.5.ebuild 2787 SHA256 b88c656628e72a8afc015bc632e7ffe957943e705f258dd1a24ea9b647f81597 SHA512 56b65d9faf2743c6fd4abe9e80c6bc71b2b23362ec70f33631e26af231fe3e89f5d3c0d6adaa930b9a5548c193d94512e7d11ab3fe236145bad9441bc258f92e WHIRLPOOL 8851236a56672424cc7237e2b22d9feffbf800a339e8a42fc1209b330d29a1eb70621adff166d3ad30fc09131b35481da6dc21088cf00f29de587c16a2d040f7 diff --git a/net-analyzer/longview/files/longview b/net-analyzer/longview/files/longview new file mode 100644 index 0000000..c12b71f --- /dev/null +++ b/net-analyzer/longview/files/longview @@ -0,0 +1,23 @@ +#!/sbin/openrc-run + +command="/opt/linode/longview/Linode/Longview.pl" +pidfile="/run/longview.pid" + +extra_started_commands="reload" +extra_stopped_commands="debug" + +depend() { + need net +} + +debug() { + ebegin "Starting ${RC_SVCNAME} (With Debug Flag)" + start-stop-daemon --start -p $pidfile --exec $command Debug + eend $? +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + start-stop-daemon --signal HUP -p $pidfile + eend $? +} diff --git a/net-analyzer/longview/longview-1.1.5.ebuild b/net-analyzer/longview/longview-1.1.5.ebuild new file mode 100644 index 0000000..a744ad3 --- /dev/null +++ b/net-analyzer/longview/longview-1.1.5.ebuild @@ -0,0 +1,111 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit systemd + +DESCRIPTION="Linode's Longview Agent" +HOMEPAGE="https://github.com/linode/longview" +SRC_URI="https://github.com/linode/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" +IUSE="apache2 mysql nginx" + +RDEPEND=" + app-portage/eix + dev-lang/perl + dev-perl/Crypt-SSLeay + dev-perl/DBI + dev-perl/IO-Socket-INET6 + dev-perl/JSON + dev-perl/Linux-Distribution + dev-perl/Log-LogLite + dev-perl/perl-headers + dev-perl/Try-Tiny + apache2? ( www-servers/apache[apache2_modules_status] ) + mysql? ( dev-perl/DBD-mysql ) +" + +src_prepare() { + sed 's|/var/run|/run|' \ + -i Linode/Longview/Util.pm \ + -i Extras/init/longview.service \ + || die "sed failed" + + eapply_user +} + +src_configure() { + : +} + +src_compile() { + : +} + +src_install() { + default + + insinto /opt/linode/${PN} + doins -r Linode + + fperms 0755 /opt/linode/longview/Linode/Longview.pl + + insinto /opt/linode/${PN}/Linode/Longview/DataGetter/Packages/ + doins Extras/Modules/Packages/Gentoo.pm + + keepdir /var/log/linode/ + + insinto /etc/linode/longview.d/ + keepdir /etc/linode/longview.d/ + use apache2 && doins Extras/conf/Apache.conf + use mysql && doins Extras/conf/MySQL.conf + use nginx && doins Extras/conf/Nginx.conf + + doinitd "${FILESDIR}"/${PN} + systemd_dounit Extras/init/longview.service +} + +pkg_postinst() { + local api_key + local api_key_path=/etc/linode/longview.key + + [[ -f ${api_key_path} ]] && api_key=$(<${api_key_path}) + + if [[ -z $api_key ]] ; then + elog "Before you start Longview, you need to get the API key for this host." + elog "Go to:" + elog " https://manager.linode.com/longview/" + elog "Click on the 'i' button of the client matching this host (or create a" + elog "new one), and save the Longview API Key to:" + elog " ${api_key_path}" + elog + fi + + if [[ -z ${REPLACING_VERSIONS} ]] ; then + if use apache2 ; then + elog "You'll need to configure Apache as detailed in the following link:" + elog "https://www.linode.com/docs/platform/longview/longview-app-for-apache#manual-configuration-all-distributions" + elog + fi + + elog "You'll need to open the firewall a bit so Longview client can talk with" + elog "the monitoring server:" + elog + elog " # iptables -I INPUT -s longview.linode.com -j ACCEPT" + elog " # iptables -I OUTPUT -d longview.linode.com -j ACCEPT" + elog " # ip6tables -I INPUT -s longview.linode.com -j ACCEPT" + elog " # ip6tables -I OUTPUT -d longview.linode.com -j ACCEPT" + elog + elog " # rc-service iptables save" + elog " # rc-service ip6tables save" + elog + + elog "Once you've done the above, you can start it:" + elog " # rc-service longview start" + elog " # rc-update add longview" + fi +} -- cgit v1.2.3-65-gdbad