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 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
|
# (Large) prefix inserted above by Make
# BSD systems keep chown in /etc
PATH="$PATH:/etc"
case "$1" in
mkdir)
if [ -n "$2" -a ! -d "$2"/. ]
then
mkdir $2
if [ ! -d "$2" ] ; then
echo "Cannot create directory $2"
exit 1
fi
chmod $3 $2
if ./usercheck 0 ; then
chgrp $GROUP $2
chown $OWNER $2
fi
echo Created directory $2
fi
exit 0
;;
copy)
cp $4 $3
chmod $2 $3/$4
if ./usercheck 0 ; then
chgrp $GROUP $3/$4
chown $OWNER $3/$4
fi
echo "$4 -> $3/$4"
exit 0
;;
chmod)
chmod $2 $3
if ./usercheck 0 ; then
chgrp $GROUP $3
chown $OWNER $3
fi
exit 0
;;
esac
set -u
(
if $NNTP
then
:
else
if [ ! -d "$SPOOL"/. ]
then
echo Error: News spool directory $SPOOL not found.
fi
if [ ! -d "$NLIB"/. ]
then
echo Error: News lib directory $NLIB not found.
fi
fi
#set $RECMAIL
#if [ ! -f "$1" ]
#then
# echo ERROR: Mailer program $RECMAIL not found.
#fi
) > ErrorCheck
if [ -s ErrorCheck ]
then
cat ErrorCheck
echo "Hit return to continue"
read X
fi
rm -f ErrorCheck
LOOP=true
while $LOOP
do
if [ $# -ge 1 ]
then
OPT="$1"
shift
if [ $# -eq 0 ]
then
LOOP=false
fi
PAUSE=false
else
PAUSE=true
cat <<'EOF'
INSTALLATION
1) Master programs (machine dependent)
2) User programs (machine dependent, shareable)
3) auxiliary programs (configuration dependent, shareable)
4) Documentation (shareable)
5) Help files (shareable)
6) Online manual (shareable with 5)
INIT) Initialize database
s) Server installation: 1 + 2 + 3 + 4 + 5 + 6
n) Network installation: 2 + 3 + 4 + 5 + 6
h) Shared installation: 2 + 3
m) Master installation: 1
c) Client installation: 2
u) Update after patch
q) Quit
EOF
if ./usercheck 0 ; then
:
else
echo "Warning: not running as super user"
echo ""
fi
${AWK} 'BEGIN{printf "Select option: "}' < /dev/null
read OPT
echo
fi
case $OPT in
s*|a*)
OPT="master bin aux help online man"
;;
u*)
OPT=""
if [ -f "$MASTER/nnmaster" ]
then
OPT="$OPT master"
fi
if $DBSHORTNAME
then
if [ -n "$DBDATA" -a -d "$DBDATA" -a ! -d "$DBDATA/0" ]
then
OPT="$OPT splitdb"
fi
fi
if [ -f "$BIN/nn" ]
then
OPT="$OPT bin"
fi
if [ -f "$LIB/aux" ]
then
OPT="$OPT aux"
fi
if [ -d "$HELP" ]
then
OPT="$OPT help"
fi
if [ -f "$DMAN_DIR/nnmaster.$DMAN_SECT" ]
then
OPT="$OPT man"
fi
if [ -f "$HELP/Manual" ]
then
OPT="$OPT online"
fi
;;
1|m)
OPT=master
;;
n)
OPT="bin aux help online man"
;;
2|c)
OPT=bin
;;
h)
OPT="bin aux"
;;
3)
OPT="aux"
;;
4)
OPT="man"
;;
5)
OPT="help"
;;
6)
OPT="online"
;;
INIT)
if $NOV
then
echo "The NOV version of NN does not *have* it's own database!"
else
OPT=init
fi
;;
q*|"")
if [ -f $MASTER/nnmaster -a ! -f $MASTER/MPID -a ! $NOV ]
then
echo "Remember to restart $MASTER/nnmaster"
fi
exit 0
;;
*)
echo "Unrecognized option: $OPT"
exit 1
;;
esac
for OP in $OPT
do
case "$OP" in
master)
./inst mkdir $MASTER 755 || exit 1
if [ -f $MASTER/nnmaster ]
then
if [ -f $MASTER/MPID ]
then
echo "Stopping running master..."
if $MASTER/nnmaster -k ; then
echo "Stopped."
else
exit 1
fi
fi
mv $MASTER/nnmaster $MASTER/nnmaster.old
fi
echo Installing master in $MASTER
for prog in $MASTER_PROG
do
./inst copy 755 $MASTER $prog
done
if [ -f $MASTER/nnmaster ]
then
chmod 6750 $MASTER/nnmaster
fi
;;
bin)
echo
if [ ! -d "$DESTDIR/$BIN"/. ]
then
echo Directory $DESTDIR/$BIN does not found!
exit 1
fi
echo Installing user programs in $DESTDIR/$BIN
if [ -f $DESTDIR/$BIN/nn ]
then
(
cd $DESTDIR/$BIN
mv nn nn.old
rm -f $BIN_PROG $DESTDIR/$BIN_LINK
)
fi
for prog in $BIN_PROG
do
./inst copy 755 $DESTDIR/$BIN $prog
done
for link in $BIN_LINK
do
ln -s nn $DESTDIR/$BIN/$link
echo $link symlinked to nn
done
if [ -f $DESTDIR/$BIN/nnacct ] ; then
chmod 4755 $DESTDIR/$BIN/nnacct
echo nnacct is setuid ${OWNER}.
fi
;;
aux)
echo
./inst mkdir $DESTDIR/$LIB 755 || exit 1
echo Installing auxiliary programs in $DESTDIR/$LIB
for prog in $LIB_PROG
do
./inst copy 755 $DESTDIR/$LIB $prog
done
./mkprefix conf > $DESTDIR/${LIB}/conf
grep "^#" config.h |
sed -e '/_MAN_/d' -e 's/[ ]*\/\*.*$//' >> $DESTDIR/${LIB}/conf
./inst chmod 644 $DESTDIR/${LIB}/conf
;;
help)
./inst mkdir $DESTDIR/$HELP 755 || exit 1
echo
echo Installing help files in $DESTDIR/$HELP
cd help
for h in *
do
cd ..
./cvt-help < help/$h > $DESTDIR/$HELP/$h
./inst chmod 644 $DESTDIR/$HELP/$h
echo $h
cd help
done
cd ..
;;
man)
echo
echo Installing manuals
PL="`echo $VERSION | sed -e 's/ .*$//'`"
{
echo $UMAN_DIR $UMAN_SECT .1
echo $SMAN_DIR $SMAN_SECT .1m
echo $DMAN_DIR $DMAN_SECT .8
} |
while read DIR SECT SRC
do
if [ -d "$DESTDIR/$DIR"/. ]
then
for i in man/*$SRC
do
MAN=`basename ${i} $SRC`
NEW=$DESTDIR/$DIR/${MAN}.$SECT
sed -e '/^\.TH /s/6.7/'${PL}'/' $i > $NEW
./inst chmod 644 $NEW
echo $MAN in $NEW
done
else
echo $DESTDIR/$DIR not found or not writeable
fi
done
;;
online)
./inst mkdir $DESTDIR/$HELP 755 || exit 1
MAN=$HELP/Manual
echo
echo "Formatting online manual $DESTDIR/$MAN"
echo ".... (continues in background) ...."
rm -f $DESTDIR/$MAN
(
sed -e 's/\\f[BPI]//g' \
-e 's/\\-/-/g' -e 's/\\&//g' -e 's/\\e/\\/g' \
-e '/^\.\\"ta/p' -e '/^\.\\"/d' \
-e '/^\.nf/d' -e '/^\.fi/d' \
-e '/^\.if/d' -e '/^\.ta/d' -e '/^\.nr/d' \
-e '/^\.in/d' -e 's/^\.[BI] //' \
`ls -1 man/*.? man/*.??` |
${AWK} -f format.awk - > $DESTDIR/$MAN
./inst chmod 644 $DESTDIR/$MAN
) &
;;
splitdb)
(
echo
echo "Rearranging $DBDATA directory for better performance."
echo "Notice: If interrupted, the database must be rebuilt!"
echo "Be patient. This may take a while...."
echo
$MASTER/nnmaster -l "DATABASE UPGRADE IN PROGRESS"
OLDDB="${DBDATA}-old"
mv ${DBDATA} ${OLDDB} || exit 1
./inst mkdir "$DBDATA" 755 || exit 1
Ngrp="`cat ${DB}/GROUPS | wc -l`"
Ngrp="`expr $Ngrp + 1`"
Ndir="`expr $Ngrp / 100`"
i=0
while [ $i -le $Ndir ]
do
./inst mkdir "${DBDATA}/${i}" 755 || exit 1
i="`expr $i + 1`"
done
cd ${OLDDB}
i=$Ndir
while [ $i -ge 1 ]
do
if [ "`echo ${i}[0-9][0-9].[dx]`" != "${i}[0-9][0-9].[dx]" ]
then
echo "Moving groups ${i}00-${i}99 to ${DBDATA}/${i}"
mv ${i}[0-9][0-9].[dx] ${DBDATA}/${i}
fi
i="`expr $i - 1`"
done
if [ "`echo *.[dx]`" != '*.[dx]' ]
then
echo "Moving groups 0-99 to ${DBDATA}/${i}"
mv *.[dx] ${DBDATA}/0
fi
cd /tmp
rm -r ${OLDDB}
$MASTER/nnmaster -l
echo "Database reorganization completed."
echo
)
;;
init)
echo
./inst mkdir "$DB" 755 || exit 1
if [ -n "$DBDATA" ] ; then
if [ -d "$DBDATA" -a "$DBDATA" = "${DB}/DATA" ]
then
echo "Removing old data files"
( cd /tmp && rm -r "$DBDATA" )
fi
./inst mkdir "$DBDATA" 755 || exit 1
if $DBSHORTNAME
then
./inst mkdir "$DBDATA/0" 755 || exit 1
fi
fi
if $NNTP ; then
if [ x"$NNTPCACHE" != "x" ] ; then
./inst mkdir "$NNTPCACHE" 777 || exit 1
fi
ILIMIT=50
DFLT=50
cat <<'EOF'
When nnmaster is started the first time after initializing nn's
database, it will attempt to fetch all the articles from the nntp
server. It does this by successively requesting each article in the
range min..last obtained from the NNTP server. Often the 'min' number
is unreliable or even zero (Cnews doesn't maintain it). This means
that the nnmaster will request a lot of non-existing articles from the
server, causing a lot of network traffic.
To limit this activity, nn will normally only attempt to fetch the
fifty newest articles in each group. This shouldn't really be a
problem since that will give you enough news to start with, and the
older articles will probably be expired in a few days anyway.
You can change this limit if you like. Or you can disable this
limitation completely if you trust the min field by giving a 0 limit.
EOF
else
ILIMIT=""
DFLT="none"
cat <<'EOF'
If the 'min' field in your active file is not reliable, nnmaster can
waste a lot of time trying to locate non-existing articles in the news
groups when it is collecting the available articles the first time it
is started after the database is initialized. This is especially true
with Cnews where the min field is not normally maintained.
To limit the efforts during the initial collection, you can set a
limit on the number of articles in each group which nnmaster should
try to locate in each group. This may get you running faster, and it
shouldn't matter much anyway since the articles that may be ignored
will be the oldest articles in the group, and they will probably be
expired soon anyway. A value in the range 100-500 should be more than
enough. If you don't specify a limit, all articles will be collected,
but it may take quite some time if the min fields are unreliable.
EOF
fi
${AWK} 'END{printf "Initial article limit ('"$DFLT"') "}' < /dev/null
read L
if [ -n "$L" ] ; then
ILIMIT="$L"
fi
echo Running nnmaster -I $ILIMIT to initialize database....
echo
$MASTER/nnmaster -I $ILIMIT
echo
echo "Now start $MASTER/nnmaster [ -D ] [ -r ]"
;;
esac
done
if [ -f $DESTDIR/$LOG ]
then
chmod 666 $DESTDIR/$LOG
fi
if $PAUSE
then
${AWK} 'BEGIN{printf("\nHit return to continue....")}' < /dev/null
read X
fi
done
|