blob: 2cb733b8f8a80f18b80ae4e2ce2391127b84a988 (
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
# start of deinstall
#
# $NetBSD: deinstall,v 1.29 2004/10/11 22:04:19 reed Exp $
eval set -- ${PKG_USERS}
for userset; do
user=`
IFS=":"
set -- ${userset}
${ECHO} "$1"
`
ALL_USERS="${ALL_USERS} \"${user}\""
done
eval set -- ${PKG_GROUPS}
for groupset; do
group=`
IFS=":"
set -- ${groupset}
${ECHO} "$1"
`
ALL_GROUPS="${ALL_GROUPS} \"${group}\""
done
eval set -- ${CONF_FILES} ${SUPPORT_FILES}
while [ $# -gt 0 ]; do
samplefile="$1"; file="$2"
shift; shift
ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\""
VIEW_FILES="${VIEW_FILES} \"${file}\""
done
if [ "${_PKG_RCD_SCRIPTS}" = "YES" ]; then
eval set -- ${RCD_SCRIPTS}
for script; do
samplefile="${PKG_PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR}/${script}"
file="${RCD_SCRIPTS_DIR}/${script}"
shift
ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\""
done
fi
eval set -- ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS}
while [ $# -gt 0 ]; do
samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5"
shift; shift; shift; shift; shift
ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\""
VIEW_FILES="${VIEW_FILES} \"${file}\""
done
eval set -- ${PKG_SYSCONFDIR} ${RCD_SCRIPTS_DIR} ${MAKE_DIRS}
for dir; do
ALL_MAKE_DIRS="${ALL_MAKE_DIRS} \"${dir}\""
done
eval set -- ${MAKE_DIRS_PERMS}
while [ $# -gt 0 ]; do
dir="$1"; owner="$2"; group="$3"; mode="$4"
shift; shift; shift; shift
ALL_MAKE_DIRS="${ALL_MAKE_DIRS} \"${dir}\""
done
eval set -- ${ALL_MAKE_DIRS} ${OWN_DIRS}
for dir; do
ALL_DIRS="${ALL_DIRS} \"${dir}\""
done
eval set -- ${OWN_DIRS_PERMS}
while [ $# -gt 0 ]; do
dir="$1"; owner="$2"; group="$3"; mode="$4"
shift; shift; shift; shift
ALL_DIRS="${ALL_DIRS} \"${dir}\""
done
ALL_DIRS=`
( eval set -- ${ALL_DIRS}
for dir; do
${ECHO} "\"${dir}\""
done
) | ${SORT} -r
`
case ${STAGE} in
VIEW-DEINSTALL)
if [ "${_PKG_CONFIG}" = "YES" -a -n "${VIEW_FILES}" ]; then
if [ -n "${PKG_SYSCONFDEPOTBASE}" ]; then
${SETENV} PLIST_IGNORE_FILES="${CONF_IGNORE_FILES}" \
${LINKFARM} -D -t ${PKG_SYSCONFVIEWBASE} -d ${PKG_SYSCONFDEPOTBASE} ${PKGNAME}
${RMDIR} -p ${PKG_SYSCONFVIEWBASE} 2>/dev/null || ${TRUE}
else
eval set -- ${VIEW_FILES}
for file; do
link=`${ECHO} ${file} | ${SED} "s,^${PREFIX}/,${PKG_PREFIX}/,"`
dir=`${DIRNAME} ${link}`
if [ -h "${link}" ]; then
${RM} -f ${link}
${RMDIR} -p ${dir} 2>/dev/null || ${TRUE}
fi
done
fi
fi
if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
${ECHO} "===> Updating /etc/shells"
${CP} /etc/shells /etc/shells.pkgsrc."$$"
(${GREP} -v "^${PKG_SHELL}" /etc/shells.pkgsrc."$$" || ${TRUE}) > /etc/shells
${RM} /etc/shells.pkgsrc."$$"
fi
;;
DEINSTALL)
# Remove configuration files if they don't differ from the default
# config file.
#
if [ "${_PKG_CONFIG}" = "YES" ]; then
eval set -- ${ALL_FILES}
while [ $# -gt 0 ]; do
samplefile="$1"; file="$2"
shift; shift
if [ ! "${file}" -ef "${samplefile}" -a \
-f "${file}" -a -f "${samplefile}" ]; then
if ${CMP} -s "${file}" "${samplefile}"; then
${RM} -f "${file}"
fi
fi
done
fi
;;
POST-DEINSTALL)
modified_files=''
eval set -- ${ALL_FILES}
while [ $# -gt 0 ]; do
samplefile="$1"; file="$2"
shift; shift
if [ -f "${file}" ]; then
modified_files="${modified_files} \"${file}\""
fi
done
if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a \
"${_PKG_CONFIG}" = "YES" -a -n "${CONF_DEPENDS}" ]; then
if [ -h ${PKG_SYSCONFDIR} ]; then
${RM} -f ${PKG_SYSCONFDIR}
fi
${RMDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}` 2>/dev/null || ${TRUE}
fi
existing_dirs=''
eval set -- ${ALL_DIRS}
for dir; do
if [ "${_PKG_CONFIG}" = "YES" ]; then
if [ -f "${dir}/.pkgsrc" ]; then
dirowner=`${HEAD} -1 "${dir}/.pkgsrc"`
if [ "${dirowner}" = "${PKGBASE}" ]; then
${RM} -f "${dir}/.pkgsrc"
${RMDIR} -p "${dir}" 2>/dev/null || ${TRUE}
fi
fi
is_make_dir=` \
eval set -- ${ALL_MAKE_DIRS}; \
is_make_dir=0; \
for make_dir; do \
case "${make_dir}" in \
${dir}) is_make_dir=1; break ;; \
esac; \
done; \
${ECHO} ${is_make_dir} \
`
if [ ${is_make_dir} -eq 0 -a -d "${dir}" ]; then
existing_dirs="${existing_dirs} \"${dir}\""
fi
else
case "${dir}" in
${PKG_PREFIX}/*)
${RMDIR} -p "${dir}" 2>/dev/null || ${TRUE}
;;
esac
case "${dir}" in
#
# Don't bother the admin about the following dirs
# if they still exist.
#
${PKG_SYSCONFBASE}|${RCD_SCRIPTS_DIR})
;;
*)
if [ -d "${dir}" ]; then
existing_dirs="${existing_dirs} \"${dir}\""
fi
;;
esac
fi
done
if [ -n "${ALL_USERS}" -o -n "${ALL_GROUPS}" -o \
-n "${modified_files}" -o -n "${existing_dirs}" ]; then
${CAT} << EOF
===========================================================================
If you won't be using ${PKGNAME} any longer, you may want to remove
EOF
if [ -n "${ALL_USERS}" ]; then
${ECHO} ""
allusersmsg=" * the following users"
sep=": "
eval set -- ${ALL_USERS}
for user; do
allusersmsg="${allusersmsg}${sep}${user}"
sep=", "
done
${ECHO} "${allusersmsg}"
fi
if [ -n "${ALL_GROUPS}" ]; then
${ECHO} ""
allgroupsmsg=" * the following groups"
sep=": "
eval set -- ${ALL_GROUPS}
for group; do
allgroupsmsg="${allgroupsmsg}${sep}${group}"
sep=", "
done
${ECHO} "${allgroupsmsg}"
fi
if [ -n "${modified_files}" ]; then
${CAT} << EOF
* the following files:
EOF
eval set -- ${modified_files}
for file; do
${ECHO} " ${file}"
done
fi
if [ -n "${existing_dirs}" ]; then
${CAT} << EOF
* the following directories:
EOF
eval set -- ${existing_dirs}
for dir; do
${ECHO} " ${dir}"
done
fi
if [ -n "${RCD_SCRIPTS}" ]; then
${CAT} << EOF
You may also want to remove any settings in rc.conf that you may have
made in order to use ${PKGNAME}.
EOF
fi
${CAT} << EOF
===========================================================================
EOF
fi
;;
esac
# end of deinstall
|