This file is indexed.

postinst is in pcp 4.0.1-1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/sh -e

#
# The goal here is to live-migrate PCP temporary files from places
# they may have been stashed away in previous versions.  This is
# important as they may be in-use by instrumented applications and
# we want to avoid loss of service as a result of the switch.
#

# The new place ... this should match the setting in /etc/pcp.conf
# _after_ the installation
#
PCP_TMP_DIR=/var/lib/pcp/tmp

_version_configs()
{
    # Use the supported conffile move method (no prompts)
    local FILE

    local NPMCD=/etc/pcp/pmcd
    local PMCD1=/etc/pmcd
    local PMCD2=/var/lib/pcp/config/pmcd
    for FILE in pmcd.conf pmcd.options rc.local; do
        dpkg-maintscript-helper mv_conffile $PMCD2/$FILE $NPMCD/$FILE 3.7.0~ pcp -- "$@"
        dpkg-maintscript-helper mv_conffile $PMCD1/$FILE $NPMCD/$FILE 3.6.1~ pcp -- "$@"
    done

    local NPMIE=/etc/pcp/pmie
    local PMIE1=/etc/pmie
    local PMIE2=/var/lib/pcp/config/pmie
    for FILE in control; do
        dpkg-maintscript-helper mv_conffile $PMIE2/$FILE $NPMIE/$FILE 3.7.0~ pcp -- "$@"
        dpkg-maintscript-helper mv_conffile $PMIE1/$FILE $NPMIE/$FILE 3.6.1~ pcp -- "$@"
    done

    local NPMPROXY=/etc/pcp/pmproxy
    local PMPROXY1=/etc/pmproxy
    local PMPROXY2=/var/lib/pcp/config/pmproxy
    for FILE in pmproxy.options; do
        dpkg-maintscript-helper mv_conffile $PMPROXY2/$FILE $NPMPROXY/$FILE 3.7.0~ pcp -- "$@"
        dpkg-maintscript-helper mv_conffile $PMPROXY1/$FILE $NPMPROXY/$FILE 3.6.1~ pcp -- "$@"
    done

    local NPMLOGGER=/etc/pcp/pmlogger
    local PMLOGGER1=/etc/pmlogger
    local PMLOGGER2=/var/lib/pcp/config/pmlogger
    for FILE in control; do
        dpkg-maintscript-helper mv_conffile $PMLOGGER2/control $NPMLOGGER/control 3.7.0~ pcp -- "$@"
        dpkg-maintscript-helper mv_conffile $PMLOGGER1/control $NPMLOGGER/control 3.6.1~ pcp -- "$@"
    done
}

if dpkg-maintscript-helper supports mv_conffile
then
    _version_configs "$@"
fi

touch /var/lib/pcp/pmns/.NeedRebuild
chmod 644 /var/lib/pcp/pmns/.NeedRebuild

getent group pcp >/dev/null || groupadd -r pcp
getent passwd pcp >/dev/null || \
useradd -c "Performance Co-Pilot" -g pcp -d /var/lib/pcp -M -r -s /usr/sbin/nologin pcp

# must match GNUmakefile
chown pcp:pcp /var/lib/pcp/config/pmda
chmod 775 /var/lib/pcp/config/pmda
chown pcp:pcp /var/lib/pcp/tmp
chmod 775 /var/lib/pcp/tmp
chown pcp:pcp /var/log/pcp
chmod 775 /var/log/pcp
chown pcp:pcp /etc/pcp/nssdb
chmod 775 /etc/pcp/nssdb

# must match src/pmcd/GNUmakefile
chown pcp:pcp /var/log/pcp/pmcd
chmod 775 /var/log/pcp/pmcd

# must match src/pmdas/{json,bash,mmv}/GNUmakefile
for PMDA in bash json mmv; do
    chown pcp:pcp /var/lib/pcp/tmp/$PMDA
    chmod 775 /var/lib/pcp/tmp/$PMDA
done

# must match src/pmie/GNUmakefile
chown pcp:pcp /var/lib/pcp/config/pmie
chmod 775 /var/lib/pcp/config/pmie
chown pcp:pcp /var/lib/pcp/tmp/pmie
chmod 775 /var/lib/pcp/tmp/pmie
chown pcp:pcp /var/log/pcp/pmie
chmod 775 /var/log/pcp/pmie

# must match src/pmlogger/GNUmakefile
chown pcp:pcp /var/lib/pcp/config/pmlogger
chmod 775 /var/lib/pcp/config/pmlogger
chown pcp:pcp /var/lib/pcp/tmp/pmlogger
chmod 775 /var/lib/pcp/tmp/pmlogger
chown pcp:pcp /var/log/pcp/pmlogger
chmod 775 /var/log/pcp/pmlogger

# must match src/pmproxy/GNUmakefile
chown pcp:pcp /var/log/pcp/pmproxy
chmod 775 /var/log/pcp/pmproxy

# and fixup the change in deployment plan for these ones in the case
# of an upgrade, rather than an install ... they used to be pcp:pcp
chown root:root /etc/pcp/pmie
chmod 755 /etc/pcp/pmie
chown root:root /etc/pcp/pmie/control
chmod 644 /etc/pcp/pmie/control
chown root:root /etc/pcp/pmlogger
chmod 755 /etc/pcp/pmlogger
chown root:root /etc/pcp/pmlogger/control
chmod 644 /etc/pcp/pmlogger/control

# migrate generated config files from /etc/pcp/* to /var/lib/pcp/config/*
#
if [ -f /etc/pcp/pmie/config.default ]
then
    cp /etc/pcp/pmie/config.default /var/lib/pcp/config/pmie/config.default
    rm -f /etc/pcp/pmie/config.default
    chown pcp:pcp /var/lib/pcp/config/pmie/config.default
    chmod 644 /var/lib/pcp/config/pmie/config.default
fi
if [ -f /etc/pcp/pmlogger/config.default ]
then
    cp /etc/pcp/pmlogger/config.default /var/lib/pcp/config/pmlogger/config.default
    rm -f /etc/pcp/pmlogger/config.default
    chown pcp:pcp /var/lib/pcp/config/pmlogger/config.default
    chmod 644 /var/lib/pcp/config/pmlogger/config.default
fi

do_systemd=true
which deb-systemd-helper >/dev/null 2>&1 || do_systemd=false
# only need to check pmcd.service, if it is here they will all
# be here
[ -f /lib/systemd/system/pmcd.service ] || do_systemd=false

if $do_systemd
then
    deb-systemd-helper enable pmcd.service >/dev/null
    deb-systemd-helper enable pmlogger.service >/dev/null
    deb-systemd-helper enable pmie.service >/dev/null
    deb-systemd-helper enable pmproxy.service >/dev/null
elif which update-rc.d >/dev/null 2>&1
then
    update-rc.d -f pmcd remove >/dev/null
    update-rc.d pmcd defaults >/dev/null
    update-rc.d -f pmlogger remove >/dev/null
    update-rc.d pmlogger defaults >/dev/null
    update-rc.d -f pmie remove >/dev/null
    update-rc.d pmie defaults >/dev/null
    update-rc.d -f pmproxy remove >/dev/null
    update-rc.d pmproxy defaults >/dev/null
fi

# transition pmdadmcache over to pmdadm (device mapper)
#
PCP_PMCDCONF_PATH=/etc/pcp/pmcd/pmcd.conf
PCP_PMDAS_DIR=/var/lib/pcp/pmdas/
if grep -q ^dmcache $PCP_PMCDCONF_PATH 2>/dev/null
then
    mkdir -p -m 755 "$PCP_PMDAS_DIR/dm"
    touch "$PCP_PMDAS_DIR/dm/.NeedInstall"
    touch "$PCP_PMDAS_DIR/dmcache/.NeedRemove"
fi

# set the notready flag for pmdaprometheus (only if already ./Install'd)
#
if grep -q ^prometheus $PCP_PMCDCONF_PATH 2>/dev/null
then
    touch "$PCP_PMDAS_DIR/prometheus/.NeedInstall"
fi

if which invoke-rc.d >/dev/null 2>&1
then
    invoke-rc.d pmcd start
    invoke-rc.d pmlogger start
else
    /etc/init.d/pmcd start
    /etc/init.d/pmlogger start
fi