summarylogtreecommitdiffstats
path: root/newrelic-php5.install
blob: 6298ff8973ec4fecae6008da79a26a3dab043a94 (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
post_install() {
    # Setup "newrelic" user/group
    useradd --system -M --home / --shell /sbin/nologin newrelic || true

    # Setup permissions
    mkdir -p /var/log/newrelic
    chmod 755 /var/log/newrelic

    # 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
            echo \
"
:: The service cannot be enabled/started until a valid licence is inserted in the following file:

   /etc/php/conf.d/newrelic.ini

:: Edit the above referenced file and in newrelic.license=\"REPLACE_WITH_REAL_KEY\"
   replace the value with your licence key. More information here:

   https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php/#installation

:: No data will be reported until the daemon can be started.
   Get your license key in \"Settings\" of the \"Support\" menu in your NewRelic account.
   (accessible at https://rpm.newrelic.com)

:: Once the license key is configured, enable/start the NewRelic daemon, PHP and the web server.
"
        fi
        return 0
    fi
}

post_remove() {
    userdel newrelic || true
    rm -rf /var/log/newrelic
}