blob: 3d3ee66e0922dcdfce02f4ef4e11cccab4015768 (
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
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
sts=0
tmp=/var/tmp
trap "rm -f $tmp.*; exit \$sts" 0 1 2 3 15
if [ ! -f /etc/pcp.env ]
then
# PCP not installed ... seems odd
#
echo "Error: /etc/pcp.env not installed!"
sts=1
exit
fi
. /etc/pcp.env
# no need to touch $PCP_VAR_DIR/pmns/.NeedRebuild as this file
# is included in the tarball
#
for conf in \
$PCP_PMCDCONF_PATH $PCP_PMCDOPTIONS_PATH $PCP_PMCDRCLOCAL_PATH \
$PCP_PMIECONTROL_PATH $PCP_PMLOGGERCONTROL_PATH \
$PCP_PMPROXYOPTIONS_PATH $PCP_PMWEBDOPTIONS_PATH
do
if [ -f "$conf.pre" -a -f "$conf" ]
then
if diff "$conf" "$conf.pre" >/dev/null 2>&1
then
rm -f "$conf.pre"
else
mv "$conf" "$conf.dist"
mv "$conf.pre" "$conf"
echo "Warning: $conf: original restored, new version in $conf.dist"
fi
fi
done
_clean_tmpdirs $PCP_TMP_DIR /var/tmp mmv pmdabash pmie pmlogger
# set up pcp and pcpqa users
#
if [ -f /etc/passwd ]
then
# things like useradd may be hiding in odd places ...
#
PATH=$PATH:/usr/sbin
# common command-line options
# -c comment
# -g primary_group_name
# -d home_directory
# -m create home directory
# -s shell
# command-line variations
# do not create home directory
# -M for Linux, nothing for netbsd
# system account (no aging, sys gid/uid range, no home dir creation)
# -r for Linux, not supported for netbsd
#
if [ $PCP_PLATFORM = netbsd ]
then
no_home_dir=''
sys_acc=''
nologin=/sbin/nologin
bash=/usr/pkg/bin/bash
elif [ $PCP_PLATFORM = solaris ]
then
no_home_dir=''
sys_acc=''
nologin=`which false`
bash=`which bash`
else
no_home_dir='-M'
sys_acc='-r'
nologin=/usr/sbin/nologin
bash=/bin/bash
fi
if grep '^pcp:' /etc/group >/dev/null
then
:
else
if which groupadd >/dev/null 2>&1
then
groupadd $sys_acc pcp
else
if [ $PCP_PLATFORM = freebsd ]
then
: adduser does this for us ...
else
echo "postinstall: Error: don't know how to add group \"pcp\""
sts=1
exit
fi
fi
fi
if grep '^pcp:' /etc/passwd >/dev/null
then
:
else
if which useradd >/dev/null 2>&1
then
useradd -c "Performance Co-Pilot" -g pcp -d /var/lib/pcp $no_home_dir $sys_acc -s $nologin pcp
elif which adduser >/dev/null 2>&1
then
echo "pcp::::::Performance Co-Pilot:/var/lib/pcp::" \
| adduser -f - -w no
else
echo "postinstall: Error: don't know how to add user \"pcp\""
sts=1
exit
fi
fi
if grep '^pcpqa:' /etc/group >/dev/null
then
:
else
if which groupadd >/dev/null 2>&1
then
groupadd $sys_acc pcpqa
else
if [ $PCP_PLATFORM = freebsd ]
then
: adduser does this for us ...
else
echo "postinstall: Error: don't know how to add group \"pcpqa\""
sts=1
exit
fi
fi
fi
if grep '^pcpqa:' /etc/passwd >/dev/null
then
:
else
if which useradd >/dev/null 2>&1
then
useradd -c "PCP Quality Assurance" -g pcpqa -d /var/lib/pcp/testsuite $no_home_dir $sys_acc -s $bash pcpqa
elif which adduser >/dev/null 2>&1
then
# no bash for default FreeBSD
bash=`which sh`
echo "pcpqa::::::PCP Quality Assurance:/var/lib/pcp/testsuite:$bash:" \
| adduser -f - -w no
else
echo "postinstall: Error: don't know how to add user \"pcpqa\""
sts=1
exit
fi
fi
fi
# permissions ...
#
# pcp:pcp and mode 775 directories
#
for dir in $PCP_LOG_DIR \
$PCP_LOG_DIR/pmcd $PCP_LOG_DIR/pmie $PCP_LOG_DIR/pmwebd \
$PCP_LOG_DIR/pmproxy $PCP_LOG_DIR/pmlogger $PCP_LOG_DIR/pmmgr \
$PCP_RUN_DIR \
$PCP_VAR_DIR/tmp $PCP_VAR_DIR/tmp/pmie $PCP_VAR_DIR/tmp/pmlogger \
$PCP_VAR_DIR/config/pmda \
$PCP_SYSCONF_DIR/pmie $PCP_SYSCONF_DIR/pmlogger
do
[ -d $dir ] || mkdir $dir
chmod 775 $dir
chown pcp:pcp $dir
done
# pcp:pcp and mode 664 files
#
for file in $PCP_SYSCONF_DIR/pmie/control $PCP_SYSCONF_DIR/pmlogger/control
do
[ -f $file ] || continue
chmod 664 $file
chown pcp:pcp $file
done
# pcpqa:pcpqa and mode 755 dir and all below there
#
[ -d $PCP_VAR_DIR/testsuite ] || mkdir $PCP_VAR_DIR/testsuite
chmod 775 $PCP_VAR_DIR/testsuite
chown -R pcpqa:pcpqa $PCP_VAR_DIR/testsuite
# Note: do not start pcp, pmwebd, pmproxy nor pmmgr by default
#
if which svcs >/dev/null 2>&1
then
# in Solaris land, we need an XML file to control all of this
#
if [ ! -f ../sun/pcp.xml ]
then
echo "Warning: Solaris SMF XML missing: ../sun/pcp.xml"
else
svccfg import ../sun/pcp.xml
fi
else
for svc in pcp pmcd pmlogger pmproxy pmwebd pmmgr
do
if which rc-update >/dev/null 2>&1
then
if rc-update show | grep " $svc " >/dev/null 2>&1
then
# service is already installed ...
#
rc-update delete $svc
fi
rc-update add $svc
fi
# disable or enable and start as required by default policy
case $svc
in
pmcd|pmlogger|pmie)
if which rc-update >/dev/null 2>&1
then
: TODO?
fi
$PCP_RC_DIR/$svc start
;;
*)
if which rc-update >/dev/null 2>&1
then
: TODO?
fi
;;
esac
done
fi
exit
|