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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
#!/bin/sh
#
# Optionally install a supfile and start cvsup on it.
#
# Written Jan 8th, 1998. Jordan Hubbard <jkh@FreeBSD.org>
# Last modification date: April 5th, 2000.
# Failsafe - if the environment is spammed somehow, pick a reasonable
# prefix.
if [ -z "${PREFIX}" ]; then
PREFIX=/usr/local
fi
# We get run multiple times, so only run once for the post-install pass.
if [ "x$2" != "xPOST-INSTALL" ]; then
exit 0;
fi
CVSUP_CMD=${PREFIX}/bin/cvsup
CVSUP_ARGS="-g -L 2"
SUPFILE=/etc/cvsupfile
C_HOST=cvsup.FreeBSD.org
C_BASE=/usr
C_PREFIX=/usr
C_RELEASE=cvs
C_RELEASETAG="."
C_SRC_TARGETS=src-all
C_OPTS="delete use-rel-suffix"
######################### misc utility functions #######################
# Usage: yesno message text ...
yesno() {
dialog --yesno "$*" -1 -1
}
# Usage: getval varname message text ...
getval() {
var=$1; shift
if dialog --inputbox "$*" -1 -1 `eval echo \\${$var}` 2> /tmp/input.$$; then
eval ${var}=\"`cat /tmp/input.$$`\"
rm -f /tmp/input.$$
return 0
else
rm -f /tmp/input.$$
return 1
fi
}
# Usage: message message text ...
message() {
dialog --infobox "$*" -1 -1
}
# Usage: infomsg message text ...
infomsg() {
dialog --msgbox "$*" -1 -1
}
# Usage runprog command args ...
runprog() {
dialog --prgbox "$*" 20 72
}
############################## end of general functions #######################
getsrcs() {
if dialog --title "Source selection menu" --checklist \
"
Please specify which components of /usr/src you are interested in,
or simply press return for src-all. If you would like to build
just the kernel, for example, then select src-sys.
" -1 -1 10 \
"src-base" "Misc files directly under /usr/src" No \
"src-bin" "Sources for things in /bin" No \
"src-contrib" "Sources for contributed packages" No \
"src-crypto" "Non-U.S. export portions of ssh/Kerberos" No \
"src-etc" "Sources for things in /etc" No \
"src-games" "Sources for things in /usr/games" No \
"src-gnu" "Sources for GNU utils (requires src-contrib)" No \
"src-include" "Sources for things in /usr/include" No \
"src-kerberosIV" "Sources for KerberosIV (exportable)" No \
"src-kerberos5" "Sources for Kerberos5 (exportable)" No \
"src-lib" "Sources for things in /usr/lib" No \
"src-libexec" "Sources for things in /usr/libexec" No \
"src-release" "Sources for release building tools" No \
"src-sbin" "Sources for things in /sbin" No \
"src-secure" "Non-U.S. export DES software" No \
"src-share" "Sources for things in /usr/share" No \
"src-sys" "Sources for the kernel (/usr/src/sys)" No \
"src-tools" "Sources for miscellaneous tools" No \
"src-usrbin" "Sources for things in /usr/bin" No \
"src-usrsbin" "Sources for things in /usr/sbin" No \
2>/tmp/menu.src.$$; then
C_SRC_TARGETS=`cat /tmp/menu.src.$$`
rm -f /tmp/menu.src.$$
_VAL=0
else
rm -f /tmp/menu.src.$$
C_SRC_TARGETS=src-all
_VAL=1
fi
if [ -z "${C_SRC_TARGETS}" ]; then
C_SRC_TARGETS=src-all
fi
return ${_VAL};
}
getsrctag() {
if dialog --title "Branch selection menu" --menu \
"
Please specify which branch of FreeBSD (as designated by branch tag)
you would like to update your sources to. If you want 3.x then
this would typically be the RELENG_3 tag. If you're running a 4.0
system then RELENG_4 is the tag you want. To follow -current, that
being 5.0 right now, you want the HEAD (or .) tag. If you want to be
able to check out or compare sources from arbitrary branches at will,
select the CVS repository tag (note: you will still need to use CVS
in manually checking out and maintaining a /usr/src tree if you
choose to go this route).
" -1 -1 5 \
"." "The 5.0-current branch (. = HEAD)" \
"RELENG_4" "The 4.0-stable branch" \
"RELENG_3" "The 3.0-stable branch" \
"RELENG_2_2" "The 2.2-stable branch" \
"cvs" "The CVS repository (all branches)" \
"none" "Skip the updating of /usr/src" 2>/tmp/menu.src.$$; then
C_RELEASETAG=`cat /tmp/menu.src.$$`
rm -f /tmp/menu.src.$$
_VAL=0
else
rm -f /tmp/menu.src.$$
_VAL=1
fi
if [ "${C_RELEASETAG}" = "none" ]; then
C_SRC_TARGETS=""
return ${_VAL}
fi
EXPORT=YES
fi
return ${_VAL}
}
gethost() {
if dialog --title "Host selection menu" --menu \
"
These are the currently known CVSup servers at the time that
this package was created (in alphabetical order by domain name).
" -1 -1 11 \
"other" "Specify your own cvsup server." \
"cvsup.FreeBSD.org" "U.S. server." \
"cvsup2.FreeBSD.org" "U.S. server." \
"cvsup3.FreeBSD.org" "U.S. server." \
"cvsup4.FreeBSD.org" "U.S. server." \
"cvsup5.FreeBSD.org" "U.S. server." \
"cvsup6.FreeBSD.org" "U.S. server." \
"cvsup7.FreeBSD.org" "U.S. server." \
"cvsup8.FreeBSD.org" "U.S. server." \
"cvsup9.FreeBSD.org" "U.S. server." \
"cvsup10.FreeBSD.org" "U.S. server." \
"cvsup.ar.FreeBSD.org" "Argentina server." \
"cvsup.au.FreeBSD.org" "Australia server." \
"cvsup.br.FreeBSD.org" "Brazil server." \
"cvsup.cz.FreeBSD.org" "Czech server." \
"cvsup.de.FreeBSD.org" "Germany server." \
"cvsup.dk.FreeBSD.org" "Denmark server." \
"cvsup.ee.FreeBSD.org" "Estonia server." \
"cvsup.fi.FreeBSD.org" "Finland server." \
"cvsup.fr.FreeBSD.org" "France server." \
"cvsup.jp.FreeBSD.org" "Japan server." \
"cvsup2.jp.FreeBSD.org" "Japan server." \
"cvsup.kr.FreeBSD.org" "Korea server." \
"cvsup.nl.FreeBSD.org" "Holland server." \
"cvsup.pl.FreeBSD.org" "Poland server." \
"cvsup.ru.FreeBSD.org" "Russia server." \
"cvsup.se.FreeBSD.org" "Sweden server." \
"cvsup.sk.FreeBSD.org" "Slovak Republic server." \
"cvsup.si.FreeBSD.org" "Slovenia server." \
"cvsup.tw.FreeBSD.org" "Taiwan server." \
"cvsup2.tw.FreeBSD.org" "Taiwan server." \
"cvsup.uk.FreeBSD.org" "UK server." \
"cvsup2.uk.FreeBSD.org" "UK server." \
"cvsup3.uk.FreeBSD.org" "UK server." \
"cvsup.za.FreeBSD.org" "South Africa server." 2>/tmp/menu.src.$$; then
C_HOST=`cat /tmp/menu.src.$$`;
rm -f /tmp/menu.src.$$;
if [ "${C_HOST}" = "other" ]; then
C_HOST=""
if ! getval C_HOST "Enter the name of the cvsup server you wish to use."; then
C_HOST=cvsup.freebsd.org
fi
fi
return 0
else
rm -f /tmp/menu.src.$$
return 1
fi
}
getbase() {
getval C_BASE "Base directory for src, ports and docs subdirs?"
}
getopts() {
getval C_OPTS "These are the options currently set for cvsup.
If you are on a slow link, you may wish to add the \"compress\" option,
otherwise you probably just want to leave these values the way they are."
}
getports() {
if yesno "Would you like to track the FreeBSD ports collection?"; then
PORTS=yes
return 0
else
return 1
fi
}
getdocs() {
if yesno "Would you like to track the FreeBSD doc sources?"; then
DOCS=yes
return 0
else
return 1
fi
}
writefile() {
echo '*default ' "host=${C_HOST}" > ${SUPFILE}
echo '*default ' "base=${C_BASE}" >> ${SUPFILE}
echo '*default ' "prefix=${C_BASE}" >> ${SUPFILE}
echo '*default ' "release=${C_RELEASE}" >> ${SUPFILE}
if [ "${C_RELEASETAG}" != "cvs" ]; then
echo '*default ' "tag=${C_RELEASETAG}" >> ${SUPFILE}
fi
echo '*default ' "${C_OPTS}" >> ${SUPFILE}
# Serious kludge to do this here, but best place for it.
mkdir -p ${C_BASE}
echo >> ${SUPFILE}
if [ "${C_SRC_TARGETS}" ]; then
if [ -z "${EXPORT}" ]; then
echo '*default ' "host=cvsup.internat.freebsd.org" > ${SUPFILE}.intl
echo '*default ' "base=${C_BASE}" >> ${SUPFILE}.intl
echo '*default ' "prefix=${C_BASE}" >> ${SUPFILE}.intl
echo '*default ' "release=${C_RELEASE}" >> ${SUPFILE}.intl
if [ "${C_RELEASETAG}" != "cvs" ]; then
echo '*default ' "tag=${C_RELEASETAG}" >> ${SUPFILE}.intl
fi
echo '*default ' "${C_OPTS}" >> ${SUPFILE}.intl
echo >> ${SUPFILE}.intl
fi
if [ "${C_SRC_TARGETS}" != "src-all" ]; then
for i in ${C_SRC_TARGETS}; do
if [ "$i" = "\"src-crypto\"" -o "$i" = "\"src-secure\"" ]; then
if [ "${EXPORT}" ]; then
eval echo $i >> ${SUPFILE}
else
eval echo $i >> ${SUPFILE}.intl
fi
else
eval echo $i >> ${SUPFILE}
fi
done
else
echo src-all >> ${SUPFILE}
if [ "${EXPORT}" ]; then
echo src-crypto >> ${SUPFILE}
echo src-secure >> ${SUPFILE}
else
echo src-crypto >> ${SUPFILE}.intl
echo src-secure >> ${SUPFILE}.intl
fi
fi
fi
if [ "${C_RELEASETAG}" != "cvs" ]; then
echo '*default tag=.' >> ${SUPFILE}
fi
if [ "${PORTS}" ]; then
echo ports-all >> ${SUPFILE}
fi
if [ "${DOCS}" ]; then
echo doc-all >> ${SUPFILE}
fi
return 0
}
########################################################################
# OK, here's where we start in on trying to actually do useful things. #
########################################################################
# Use an existing supfile?
if [ -r "${SUPFILE}" ]; then
if ! yesno "You already have a cvsup file (${SUPFILE}). \
Would you like to use it?"; then
mv ${SUPFILE} ${SUPFILE}.backup
fi
fi
# They have no supfile or are ignoring it, create one from scratch.
if [ ! -f "${SUPFILE}" ]; then
if ! getsrctag; then
message "Aborting cvsup setup per user request."
exit 1
fi
if [ "${C_RELEASETAG}" != "none" ]; then
getsrcs
fi
getports
getdocs
if ! getbase; then
message "Aborting cvsup setup per user request."
exit 1
fi
if ! gethost; then
message "Aborting cvsup setup per user request."
exit 1
fi
getopts
if ! writefile; then
message "Write failure on ${SUPFILE}, aborting."
exit 1
fi
fi
if [ -r "${SUPFILE}" -a -x "${CVSUP_CMD}" ]; then
if ! yesno "Do you wish to run the CVSup update now?"; then
infomsg "OK, to update your system later simply type:
\"${CVSUP_CMD} ${CVSUP_ARGS} ${SUPFILE}\"
or put the command in your /etc/daily.local file for automatic updates."
if [ -z "${EXPORT}" ]; then
infomsg "Since you are outside the U.S/Canada, you should also
run this same command for ${SUPFILE}.intl"
fi
else
if yesno "Are you behind a firewall?"; then
CVSUP_ARGS="${CVSUP_ARGS} -P -"
fi
if yesno "Do you want to use compression (56K or slower, yes)?"; then
CVSUP_ARGS="${CVSUP_ARGS} -z"
fi
message "Now running ${CVSUP_CMD} ${CVSUP_ARGS} ${SUPFILE}."
runprog "${CVSUP_CMD} ${CVSUP_ARGS} ${SUPFILE}"
if [ -z "${EXPORT}" -a -r ${SUPFILE}.intl ]; then
message "Now running ${CVSUP_CMD} ${CVSUP_ARGS} ${SUPFILE}.intl."
runprog "${CVSUP_CMD} ${CVSUP_ARGS} ${SUPFILE}.intl"
fi
infomsg "All finished! To update your system again, simply type
\"${CVSUP_CMD} ${CVSUP_ARGS} ${SUPFILE}\"
or put the command in your /etc/daily.local file for automatic updates."
if [ -z "${EXPORT}" ]; then
infomsg "Since you are outside the U.S/Canada, you should also
run this same command for ${SUPFILE}.intl"
fi
fi
fi
|