summarylogtreecommitdiffstats
path: root/newrelic-php53.install
blob: 006c80703ae38a68486b2b1c31e0e7558e579f78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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-20090626-zts.so /usr/lib/php/modules/newrelic-zts.so
ln -s /usr/lib/php/modules/newrelic-20090626.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: