diff options
-rw-r--r-- | .SRCINFO | 19 | ||||
-rw-r--r-- | PKGBUILD | 53 | ||||
-rw-r--r-- | newrelic-daemon.service | 11 | ||||
-rwxr-xr-x | newrelic-php5.install | 99 |
4 files changed, 182 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..8562a17acaea --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = newrelic-php5 + pkgdesc = NewRelic PHP + pkgver = 4.22.0.99 + pkgrel = 1 + url = http://newrelic.com/ + install = newrelic-php5.install + arch = i686 + arch = x86_64 + license = non-free + depends = glibc + depends = php + backup = etc/php/conf.d/newrelic.ini + source = https://download.newrelic.com/php_agent/release/newrelic-php5-4.22.0.99-linux.tar.gz + source = newrelic-daemon.service + md5sums = d120ad145c2b262b7abf4d3b16dfa864 + md5sums = 4fc78347663adcb32ed28eddb546619c + +pkgname = newrelic-php5 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..3eb0eff04fe4 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,53 @@ +# Maintainer: Felix Yan <felixonmars@archlinux.org> +# Contributor: Vinh Nguyen <kurei [at] axcoto.com> + +pkgname=newrelic-php5 +pkgver=4.22.0.99 +_libver=20131226 +pkgrel=1 +pkgdesc="NewRelic PHP" +arch=('i686' 'x86_64') +url="http://newrelic.com/" +license=('non-free') +depends=('glibc' 'php') +backup=('etc/php/conf.d/newrelic.ini') +install=$pkgname.install +source=("https://download.newrelic.com/php_agent/release/$pkgname"-"$pkgver"-"linux.tar.gz" + "newrelic-daemon.service") +md5sums=('d120ad145c2b262b7abf4d3b16dfa864' + '4fc78347663adcb32ed28eddb546619c') + +build() { + cd "$srcdir/$pkgname-$pkgver-linux" +} + +package() { + cd "$srcdir/$pkgname-$pkgver-linux" + + mkdir -p $pkgdir/usr/bin/ \ + $pkgdir/usr/lib/php/modules/ \ + $pkgdir/usr/share/doc/newrelic-php5/ \ + $pkgdir/usr/lib/systemd/system/ \ + $pkgdir/etc/php/conf.d/; + + if [ $CARCH == i686 ]; then + # Binary Daemon + install -v -Dm755 ./daemon/newrelic-daemon.x86 $pkgdir/usr/bin/newrelic-daemon + # PHP extension + install -v -Dm755 ./agent/x86/newrelic-$_libver-zts.so $pkgdir/usr/lib/php/modules/newrelic-$_libver-zts.so + install -v -Dm755 ./agent/x86/newrelic-$_libver.so $pkgdir/usr/lib/php/modules/newrelic-$_libver.so + else + # Binary Daemon + install -v -Dm755 ./daemon/newrelic-daemon.x64 $pkgdir/usr/bin/newrelic-daemon + # PHP extension + install -v -Dm755 ./agent/x64/newrelic-$_libver-zts.so $pkgdir/usr/lib/php/modules/newrelic-$_libver-zts.so + install -v -Dm755 ./agent/x64/newrelic-$_libver.so $pkgdir/usr/lib/php/modules/newrelic-$_libver.so + fi + + install -v -Dm644 ./README ./LICENSE $pkgdir/usr/share/doc/newrelic-php5/ + + install -v -Dm644 ./scripts/newrelic.ini.template $pkgdir/etc/php/conf.d/newrelic.ini + install -v -Dm644 ./scripts/newrelic.ini.template $pkgdir/etc/php/conf.d/newrelic.ini.template + + install -v -Dm644 ../newrelic-daemon.service $pkgdir/usr/lib/systemd/system/ +} diff --git a/newrelic-daemon.service b/newrelic-daemon.service new file mode 100644 index 000000000000..ff6f3209cc1b --- /dev/null +++ b/newrelic-daemon.service @@ -0,0 +1,11 @@ +[Unit] +Description=NewRelic Proxy Daemon PHP5 +After=network.target + +[Service] +Type=forking +PIDFile=/run/newrelic-php5.pid +ExecStart=/usr/bin/newrelic-daemon -c /etc/newrelic/newrelic.cfg -p /run/newrelic-php5.pid + +[Install] +WantedBy=multi-user.target diff --git a/newrelic-php5.install b/newrelic-php5.install new file mode 100755 index 000000000000..70b63fa3f4fc --- /dev/null +++ b/newrelic-php5.install @@ -0,0 +1,99 @@ +# This is a default template for a post-install scriptlet. +# Uncomment only required functions and remove any functions +# you don't need (and this header). + +## arg 1: the new package version +#pre_install() { + # do something here +#} + +## arg 1: the new package version +post_install() { + +#!/bin/sh +# Create the newrelic user and group +useradd --system -M --home / --shell /sbin/nologin newrelic || true + +# Symlink for PHP extension +ln -s /usr/lib/php/modules/newrelic-20131226-zts.so /usr/lib/php/modules/newrelic-zts.so +ln -s /usr/lib/php/modules/newrelic-20131226.so /usr/lib/php/modules/newrelic.so + +# Kludge the permissions +mkdir /var/log/newrelic +chmod 1777 /var/log/newrelic + +inifile=/etc/php/conf.d/newrelic.ini + +# +# When first installing the package, the license key will not be set. +# Instead of throwing an error, we want to whine to the user and then exit cleanly. +# + +if sed -e '/^[ ]*#/d' "${inifile}" 2> /dev/null | grep -q 'REPLACE_WITH_REAL_KEY' 2> /dev/null; then + if [ -z "${NR_SILENT}" -a -z "${SILENT}" ]; then + cat <<EOF + +********************************************************************* +********************************************************************* +*** +*** Can not start the New Relic PHP Agent until you insert a +*** valid license key in the following file: +*** +*** ${inifile} +*** +*** You can do this by edit file /etc/php/conf.d/newrelic.ini, +*** fint the line newrelic.license="REPLACE_WITH_REAL_KEY" +*** and replace with your real key. More information here: +*** +*** https://docs.newrelic.com/docs/php/new-relic-for-php#installation +*** +*** No data will be reported until the server monitor can start. +*** You can get your New Relic key from the 'Configuration' section +*** of the 'Support' menu of your New Relic account (accessible at +*** https://rpm.newrelic.com). +*** +*** +********************************************************************* +********************************************************************* + +Once you set up your LICENSE KEY. Restart your web server, php process +manager. The agent and daemon will be run automatically. + +EOF + fi + return 0 +fi + + +} + +## arg 1: the new package version +## arg 2: the old package version +pre_upgrade() { + # do something here + return 0 +} + +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + # do something here + return 0 +} + +## arg 1: the old package version +pre_remove() { + # do something here + return 0 +} + +## arg 1: the old package version +post_remove() { + # do something here + userdel newrelic || true + unlink /usr/lib/php/modules/newrelic.so + unlink /usr/lib/php/modules/newrelic-zts.so + rm -rf /var/log/newrelic +} + +# vim:set ts=2 sw=2 et: |