blob: f4a80e25069d0e14eea5836841cbd37036c0547d (
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
|
# 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
# Kludge the permissions
mkdir -p /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
rm -rf /var/log/newrelic
}
# vim:set ts=2 sw=2 et:
|