1 2# (Large) prefix inserted above by Make 3 4# BSD systems keep chown in /etc 5PATH="$PATH:/etc" 6 7case "$1" in 8mkdir) 9 if [ -n "$2" -a ! -d "$2"/. ] 10 then 11 mkdir $2 12 if [ ! -d "$2" ] ; then 13 echo "Cannot create directory $2" 14 exit 1 15 fi 16 chacl $3 $2 17 if ./usercheck 0 ; then 18 chgrp $GROUP $2 19 chown $OWNER $2 20 fi 21 echo Created directory $2 22 fi 23 exit 0 24 ;; 25copy) 26 mv $4 $3 27 chacl $2 $3/$4 28 if ./usercheck 0 ; then 29 chgrp $GROUP $3/$4 30 chown $OWNER $3/$4 31 fi 32 echo "$4 -> $3/$4" 33 exit 0 34 ;; 35chacl) 36 chacl $2 $3 37 if ./usercheck 0 ; then 38 chgrp $GROUP $3 39 chown $OWNER $3 40 fi 41 exit 0 42 ;; 43esac 44 45set -u 46 47( 48if $NNTP 49then 50 : 51else 52 if [ ! -d "$SPOOL"/. ] 53 then 54 echo Error: News spool directory $SPOOL not found. 55 fi 56 57 if [ ! -d "$NLIB"/. ] 58 then 59 echo Error: News lib directory $NLIB not found. 60 fi 61fi 62 63set $RECMAIL 64if [ ! -f "$1" ] 65then 66 echo ERROR: Mailer program $RECMAIL not found. 67fi 68) > ErrorCheck 69 70if [ -s ErrorCheck ] 71then 72 cat ErrorCheck 73 echo "Hit return to continue" 74 read X 75fi 76rm -f ErrorCheck 77 78LOOP=true 79while $LOOP 80do 81 82if [ $# -ge 1 ] 83then 84 OPT="$1" 85 shift 86 if [ $# -eq 0 ] 87 then 88 LOOP=false 89 fi 90 PAUSE=false 91else 92 PAUSE=true 93 94cat <<'EOF' 95 96 97INSTALLATION 98 991) Master programs (machine dependent) 1002) User programs (machine dependent, shareable) 1013) auxiliary programs (configuration dependent, shareable) 1024) Documentation (shareable) 1035) Help files (shareable) 1046) Online manual (shareable with 5) 105 106INIT) Initialize database 107 108s) Server installation: 1 + 2 + 3 + 4 + 5 + 6 109n) Network installation: 2 + 3 + 4 + 5 + 6 110h) Shared installation: 2 + 3 111m) Master installation: 1 112c) Client installation: 2 113u) Update after patch 114q) Quit 115 116EOF 117if ./usercheck 0 ; then 118 : 119else 120 echo "Warning: not running as super user" 121 echo "" 122fi 123${AWK} 'BEGIN{printf "Select option: "}' < /dev/null 124read OPT 125echo 126 127fi 128 129case $OPT in 130 131s*|a*) 132 OPT="master bin aux help online man" 133 ;; 134u*) 135 OPT="" 136 if [ -f "$MASTER/nnmaster" ] 137 then 138 OPT="$OPT master" 139 fi 140 if $DBSHORTNAME 141 then 142 if [ -n "$DBDATA" -a -d "$DBDATA" -a ! -d "$DBDATA/0" ] 143 then 144 OPT="$OPT splitdb" 145 fi 146 fi 147 if [ -f "$BIN/nn" ] 148 then 149 OPT="$OPT bin" 150 fi 151 if [ -f "$LIB/aux" ] 152 then 153 OPT="$OPT aux" 154 fi 155 if [ -d "$HELP" ] 156 then 157 OPT="$OPT help" 158 fi 159 if [ -f "$DMAN_DIR/nnmaster.$DMAN_SECT" ] 160 then 161 OPT="$OPT man" 162 fi 163 if [ -f "$HELP/Manual" ] 164 then 165 OPT="$OPT online" 166 fi 167 ;; 1681|m) 169 OPT=master 170 ;; 171n) 172 OPT="bin aux help online man" 173 ;; 1742|c) 175 OPT=bin 176 ;; 177h) 178 OPT="bin aux" 179 ;; 1803) 181 OPT="aux" 182 ;; 1834) 184 OPT="man" 185 ;; 1865) 187 OPT="help" 188 ;; 1896) 190 OPT="online" 191 ;; 192INIT) 193 if $NOV 194 then 195 echo "The NOV version of NN does not *have* it's own database!" 196 else 197 OPT=init 198 fi 199 ;; 200q*|"") 201 if [ -f $MASTER/nnmaster -a ! -f $MASTER/MPID -a ! $NOV ] 202 then 203 echo "Remember to restart $MASTER/nnmaster" 204 fi 205 exit 0 206 ;; 207*) 208 echo "Unrecognized option: $OPT" 209 exit 1 210 ;; 211esac 212 213for OP in $OPT 214do 215case "$OP" in 216 217master) 218 ./inst mkdir $MASTER u=prwx,gz=rx || exit 1 219 220 if [ -f $MASTER/nnmaster ] 221 then 222 if [ -f $MASTER/MPID ] 223 then 224 echo "Stopping running master..." 225 if $MASTER/nnmaster -k ; then 226 echo "Stopped." 227 else 228 exit 1 229 fi 230 fi 231 mv $MASTER/nnmaster $MASTER/nnmaster.old 232 fi 233 234 echo Installing master in $MASTER 235 236 for prog in $MASTER_PROG 237 do 238 ./inst copy u=prwx,gz=rx $MASTER $prog 239 done 240 241 if [ -f $MASTER/nnmaster ] 242 then 243 chacl u=prwxs,gz=rx $MASTER/nnmaster 244 fi 245 ;; 246 247bin) 248 echo 249 if [ ! -d "$BIN"/. ] 250 then 251 echo Directory $BIN does not found! 252 exit 1 253 fi 254 255 echo Installing user programs in $BIN 256 257 if [ -f $BIN/nn ] 258 then 259 ( 260 cd $BIN 261 mv nn nn.old 262 rm -f $BIN_PROG $BIN_LINK 263 ) 264 fi 265 266 for prog in $BIN_PROG 267 do 268 ./inst copy u=prwx,gz=rx $BIN $prog 269 done 270 271 for link in $BIN_LINK 272 do 273 ln $BIN/nn $BIN/$link 274 echo $link linked to nn 275 done 276 277 if [ -f $BIN/nnacct ] ; then 278 chacl u=prwxs,gz=rx $BIN/nnacct 279 echo nnacct is setuid ${OWNER}. 280 fi 281 ;; 282 283aux) 284 echo 285 ./inst mkdir $LIB u=prwx,gz=rx || exit 1 286 287 echo Installing auxiliary programs in $LIB 288 289 for prog in $LIB_PROG 290 do 291 ./inst copy u=prwx,gz=rx $LIB $prog 292 done 293 294 ./mkprefix conf > ${LIB}/conf 295 grep "^#" config.h | 296 sed -e '/_MAN_/d' -e 's/[ ]*\/\*.*$//' >> ${LIB}/conf 297 ./inst chacl u=prw,gz=r ${LIB}/conf 298 ;; 299 300help) 301 ./inst mkdir $HELP u=prwx,gz=rx || exit 1 302 303 echo 304 echo Installing help files in $HELP 305 306 cd help 307 for h in * 308 do 309 cd .. 310 ./cvt-help < help/$h > $HELP/$h 311 ./inst chacl u=prw,gz=r $HELP/$h 312 echo $h 313 cd help 314 done 315 cd .. 316 ;; 317 318man) 319 echo 320 echo Installing manuals 321 322 PL="`echo $VERSION | sed -e 's/ .*$//'`" 323 { 324 echo $UMAN_DIR $UMAN_SECT .1 325 echo $SMAN_DIR $SMAN_SECT .1m 326 echo $DMAN_DIR $DMAN_SECT .8 327 } | 328 while read DIR SECT SRC 329 do 330 if [ -d "$DIR"/. ] 331 then 332 for i in man/*$SRC 333 do 334 MAN=`basename ${i} $SRC` 335 NEW=$DIR/${MAN}.$SECT 336 sed -e '/^\.TH /s/6.7/'${PL}'/' $i > $NEW 337 ./inst chacl u=prw,gz=r $NEW 338 echo $MAN in $NEW 339 done 340 else 341 echo $DIR not found or not writeable 342 fi 343 done 344 ;; 345 346online) 347 ./inst mkdir $HELP u=prwx,gz=rx || exit 1 348 349 MAN=$HELP/Manual 350 351 echo 352 echo "Formatting online manual $MAN" 353 echo ".... (continues in background) ...." 354 355 rm -f $MAN 356 357 ( 358 sed -e 's/\\f[BPI]//g' \ 359 -e 's/\\-/-/g' -e 's/\\&//g' -e 's/\\e/\\/g' \ 360 -e '/^\.\\"ta/p' -e '/^\.\\"/d' \ 361 -e '/^\.nf/d' -e '/^\.fi/d' \ 362 -e '/^\.if/d' -e '/^\.ta/d' -e '/^\.nr/d' \ 363 -e '/^\.in/d' -e 's/^\.[BI] //' \ 364 `ls -1 man/*.? man/*.??` | 365 ${AWK} -f format.awk - > $MAN 366 367 ./inst chacl u=prw,gz=r $MAN 368 ) & 369 ;; 370 371splitdb) 372 ( 373 echo 374 echo "Rearranging $DBDATA directory for better performance." 375 echo "Notice: If interrupted, the database must be rebuilt!" 376 echo "Be patient. This may take a while...." 377 echo 378 379 $MASTER/nnmaster -l "DATABASE UPGRADE IN PROGRESS" 380 381 OLDDB="${DBDATA}-old" 382 mv ${DBDATA} ${OLDDB} || exit 1 383 ./inst mkdir "$DBDATA" u=prwx,gz=rx || exit 1 384 385 Ngrp="`cat ${DB}/GROUPS | wc -l`" 386 Ngrp="`expr $Ngrp + 1`" 387 Ndir="`expr $Ngrp / 100`" 388 389 i=0 390 while [ $i -le $Ndir ] 391 do 392 ./inst mkdir "${DBDATA}/${i}" u=prwx,gz=rx || exit 1 393 i="`expr $i + 1`" 394 done 395 396 cd ${OLDDB} 397 i=$Ndir 398 while [ $i -ge 1 ] 399 do 400 if [ "`echo ${i}[0-9][0-9].[dx]`" != "${i}[0-9][0-9].[dx]" ] 401 then 402 echo "Moving groups ${i}00-${i}99 to ${DBDATA}/${i}" 403 mv ${i}[0-9][0-9].[dx] ${DBDATA}/${i} 404 fi 405 i="`expr $i - 1`" 406 done 407 if [ "`echo *.[dx]`" != '*.[dx]' ] 408 then 409 echo "Moving groups 0-99 to ${DBDATA}/${i}" 410 mv *.[dx] ${DBDATA}/0 411 fi 412 413 cd /tmp 414 rm -r ${OLDDB} 415 416 $MASTER/nnmaster -l 417 418 echo "Database reorganization completed." 419 echo 420 ) 421 ;; 422 423init) 424 echo 425 ./inst mkdir "$DB" u=prwx,gz=rx || exit 1 426 if [ -n "$DBDATA" ] ; then 427 if [ -d "$DBDATA" -a "$DBDATA" = "${DB}/DATA" ] 428 then 429 echo "Removing old data files" 430 ( cd /tmp && rm -r "$DBDATA" ) 431 fi 432 ./inst mkdir "$DBDATA" u=prwx,gz=rx || exit 1 433 if $DBSHORTNAME 434 then 435 ./inst mkdir "$DBDATA/0" u=prwx,gz=rx || exit 1 436 fi 437 fi 438 439 if $NNTP ; then 440 if [ x"$NNTPCACHE" != "x" ] ; then 441 ./inst mkdir "$NNTPCACHE" u=prwx,gz=rwx || exit 1 442 fi 443 ILIMIT=50 444 DFLT=50 445 446 cat <<'EOF' 447 448When nnmaster is started the first time after initializing nn's 449database, it will attempt to fetch all the articles from the nntp 450server. It does this by successively requesting each article in the 451range min..last obtained from the NNTP server. Often the 'min' number 452is unreliable or even zero (Cnews doesn't maintain it). This means 453that the nnmaster will request a lot of non-existing articles from the 454server, causing a lot of network traffic. 455 456To limit this activity, nn will normally only attempt to fetch the 457fifty newest articles in each group. This shouldn't really be a 458problem since that will give you enough news to start with, and the 459older articles will probably be expired in a few days anyway. 460 461You can change this limit if you like. Or you can disable this 462limitation completely if you trust the min field by giving a 0 limit. 463 464EOF 465 else 466 ILIMIT="" 467 DFLT="none" 468 469 cat <<'EOF' 470 471If the 'min' field in your active file is not reliable, nnmaster can 472waste a lot of time trying to locate non-existing articles in the news 473groups when it is collecting the available articles the first time it 474is started after the database is initialized. This is especially true 475with Cnews where the min field is not normally maintained. 476 477To limit the efforts during the initial collection, you can set a 478limit on the number of articles in each group which nnmaster should 479try to locate in each group. This may get you running faster, and it 480shouldn't matter much anyway since the articles that may be ignored 481will be the oldest articles in the group, and they will probably be 482expired soon anyway. A value in the range 100-500 should be more than 483enough. If you don't specify a limit, all articles will be collected, 484but it may take quite some time if the min fields are unreliable. 485 486EOF 487 fi 488 489 ${AWK} 'END{printf "Initial article limit ('"$DFLT"') "}' < /dev/null 490 read L 491 if [ -n "$L" ] ; then 492 ILIMIT="$L" 493 fi 494 495 echo Running nnmaster -I $ILIMIT to initialize database.... 496 echo 497 $MASTER/nnmaster -I $ILIMIT 498 echo 499 echo "Now start $MASTER/nnmaster [ -D ] [ -r ]" 500 ;; 501esac 502 503done 504 505if [ -f $LOG ] 506then 507 chacl u=prw,gz=r $LOG 508fi 509 510if $PAUSE 511then 512${AWK} 'BEGIN{printf("\nHit return to continue....")}' < /dev/null 513read X 514fi 515done 516