From: frank.kaefer@stasys.sta.sub.org (Frank Kaefer)
Newsgroups: de.comp.sources.os9,comp.os.os9
Subject: MNews Prerelease Part09/09
Date: 23 Dec 92 19:41:48 GMT
Followup-To: de.comp.sources.d
Organization: Stasys News Server, Starnberg, Germany
NNTP-Posting-Host: stasys.sta.sub.org

Submitted-by: Ulrich Dessauer <ud@Nightmare.ddt.sub.org>
Archive-name: mnews/part09

: ----- Cut here ----- Cut here ----- Cut here ----- Cut here -----
: Use  sh filename  to extract shell archive
: This shell archive contains following files:
:     'SBATCH/sbatch.h                               820 bytes'
:     'SH/check.sh                                  3841 bytes'
:     'SH/install.sh                                2041 bytes'
:     'SH/respool.sh                                 690 bytes'
: 
if test -f 'SBATCH/sbatch.h' ; then
  echo 'File SBATCH/sbatch.h already exists, overwriting it'
  del 'SBATCH/sbatch.h'
fi
echo Extracting \"'SBATCH/sbatch.h'\"
sed "s/^X//" >'SBATCH/sbatch.h' <<'__END__OF__THIS__FILE__'
X/*
X * $Log:	sbatch.h_v $
X * Revision 1.1  90/08/31  15:41:07  ud
X * Initial revision
X * 
X */
X# include	"news.h"
X
X# define	EXT_TAB		"Convtable"
X
X# define	BATCH_TMP	"tmp"
X
X# define	DEF_MAXSIZ	50000
X# define	DEF_MAXARTSIZ	(-1)
X
X# define	DEF_BITSIZE	16
X# define	DEF_GRADE	'T'
X
X# ifndef	EXTERN
X# define	EXTERN		extern
X# endif		EXTERN
X
XEXTERN int	error;
X
XEXTERN char	buffer[512];
X
XEXTERN char	*command;
XEXTERN char	*transport;
XEXTERN char	*encode;
XEXTERN char	*compress;
XEXTERN char	*freeze;
XEXTERN char	*batchdir;
XEXTERN char	*newsdir;
XEXTERN char	*newslib;
XEXTERN int	maxsiz;		/* maximum size of spoolfiles		*/
XEXTERN int	maxartsiz;	/* maximum size of one article		*/
XEXTERN int	bitsize;	/* # of bits for compress		*/
XEXTERN char	grade;		/* the grading, if supported		*/
XEXTERN int	convmode;	/* converting mode for news		*/
__END__OF__THIS__FILE__
if test -f 'SH/check.sh' ; then
  echo 'File SH/check.sh already exists, overwriting it'
  del 'SH/check.sh'
fi
echo Extracting \"'SH/check.sh'\"
sed "s/^X//" >'SH/check.sh' <<'__END__OF__THIS__FILE__'
X:	'this shell script can be used to check your current news'
X:	'installation, but be warned: it is sloowwwwwwww.....'
X:	'$Id: check.sh_v 1.1 90/08/31 13:57:59 ud Exp $'
X:	'Copyright (C) 1990 Ulrich Dessauer, Germering, Germany'
X:
X:	'Insert here your local configuration'
X:
XBATCHDIR=/h0/SPOOL/BATCH
XNEWSDIR=/h0/SPOOL/NEWS
XSPOOLDIR=/h0/SPOOL/RNEWS
XNEWSLIB=/h0/USR/LIB/NEWS
XHISTORY=${NEWSLIB}/HISTORY
XNEWS=news
X:
X:	'Get GID.UID from password file'
XOWNER=`grep ${NEWS}, /dd/SYS/password | gawk -F, '{ print  $3 }'`
Xif [ X$OWNER = X ]
Xthen
X  OWNER=2.39
Xfi
Xecho 'Pass one, check existance of files.'
Xfor file in $BATCHDIR $NEWSDIR $SPOOLDIR $NEWSLIB $HISTORY
Xdo
X  echo Check $file
X  if test ! -d $file
X  then
X    echo -r $file 'is not available, Create it ? [y] '
X    read ans
X    case X$ans in
X      X | X[Yy]*)
X        makdir $file
X        chown -u=$NEWS $file
X	;;
X      X[Qq]*)
X        echo 'Script aborted.'
X	exit 1
X    esac
X  else
X    own=`dir -ne $file | grep -v Bytecount | grep -ve=-------- | gawk '{ print $1 }'`
X    if [ X$own != X$OWNER ]
X    then
X      echo -r 'Owner of' $file 'is not news, change it? [y] '
X      read ans
X      case X$ans in
X	X | X[Yy]*)
X          chown -u=$NEWS $file
X          ;;
X        X[Qq]*)
X          echo 'Script aborted.'
X	  exit 1
X      esac
X    else
X      echo 'Everything looks okay for' $file
X    fi
X  fi
Xdone
Xfor xfile in Active Distributions Sys send_uuname
Xdo
X  file=${NEWSLIB}/${xfile}
X  echo Check $file
X  if test ! -f $file
X  then
X    echo -r $file 'is not available, Create it ? [y] '
X    read ans
X    case X$ans in
X      X | X[Yy]*)
X        touch $file
X        chown -u=$NEWS $file
X        ;;
X      X[Qq]*)
X        echo 'Script aborted.'
X        exit 1
X    esac
X  else
X    own=`dir -e $file | grep -v Bytecount | grep -ve=-------- | gawk '{ print $1 }'`
X    if [ X$own != X$OWNER ]
X    then
X      echo -r 'Owner of' $file 'is not news, change it? [y] '
X      read ans
X      case X$ans in
X	X | X[Yy]*)
X          chown -u=$NEWS $file
X          ;;
X        X[Qq]*)
X          echo 'Script aborted.'
X          exit 1
X      esac
X    else
X      echo 'Everything looks okay for' $file
X    fi
X  fi
Xdone
Xecho 'Pass two, slightly syntax check of files in' $NEWSLIB
Xcd $NEWSLIB
Xecho 'Check Sys file'
Xcnt=`wc -l Sys | gawk '{ print $1 }'`
Xi=1
Xwhile test $i -le $cnt
Xdo
X  sed -n ${i}p Sys | read line
X  case X$line in
X    X#*)
X      echo 'Skip comment line'
X      ;;
X    *)
X      count=`echo $line | gawk -F: '{ print NF }'`
X      system=`echo $line | gawk -F: '{ print $1 }' | gawk -F/ '{ print $1 }'`
X      case $count in
X        3)
X	  echo $system 'will be spooled into' $SPOOLDIR
X          ;;
X        4)
X	  cmd=`echo $line | gawk -F: '{ print $4 }'`
X	  echo $system 'will use the command' $cmd
X	  ;;
X        *)
X	  echo 'This line may contain some errors (has' $count 'entries)'
X          echo $line
X	  ;;
X      esac
X      ;;
X  esac
X  i=`expr $i + 1`
Xdone
Xecho 'Check Active file'
Xcnt=`wc -l Active | gawk '{ print $1 }'`
Xi=1
Xwhile test $i -le $cnt
Xdo
X  sed -n ${i}p Active | read line
X  case X$line in
X    X#*)
X      echo 'Skip comment line'
X      ;;
X    *)
X      count=`echo $line | gawk -F: '{ print NF }'`
X      case $count in
X        2)
X	  echo $line | gawk -F: '{ print $2 }' | read start end mod moderator
X	  status=OKAY
X          if test $start -gt $end
X	  then
X	    echo 'Start (' $start ') is greater than end (' $end ') in line'
X	    echo $line
X	    status=ERR
X	  fi
X	  if [ X$mod = Xy ]
X	  then
X	    if [ X$moderator = X ]
X	    then
X	      echo 'No moderator in moderated group, you should add one; in line'
X	      echo $line
X	      status=ERR
X	    fi
X	  fi
X	  if [ $status = OKAY ]
X	  then
X	    echo $line 'looks okay'
X	  fi
X          ;;
X        *)
X	  echo 'This line may contain some errors (has' $count 'entries)'
X          echo $line
X	  ;;
X      esac
X      ;;
X  esac
X  i=`expr $i + 1`
Xdone
X
__END__OF__THIS__FILE__
if test -f 'SH/install.sh' ; then
  echo 'File SH/install.sh already exists, overwriting it'
  del 'SH/install.sh'
fi
echo Extracting \"'SH/install.sh'\"
sed "s/^X//" >'SH/install.sh' <<'__END__OF__THIS__FILE__'
X:
X:	'$Id: install.sh_v 1.1 90/11/03 02:18:17 ud Exp $'
X:	'Copyright (C) 1989, 1990 by Ulrich Dessauer, Germering, Germany.'
X:
Xcd ..
XBATCHDIR=`grep MNEWS_BATCHDIR config.h | gawk '{ print $4 }' | sed 's/"//g'`
XNEWSDIR=`grep MNEWS_NEWSDIR config.h | gawk '{ print $4 }' | sed 's/"//g'`
XSPOOLDIR=`grep MNEWS_RNEWS_SPOOLDIR config.h | gawk '{ print $4 }' | sed 's/"//g'`
XNEWSLIB=`grep MNEWS_NEWSLIB config.h | gawk '{ print $4 }' | sed 's/"//g'`
XHISTORY=${NEWSLIB}/HISTORY
XOWNER=`grep news, /dd/SYS/password | gawk -F, '{ print  $3 }'`
Xif [ X$OWNER = X ]
Xthen
X  OWNER=2.39
Xfi
Xstatus=OKAY
Xif [ X$BATCHDIR = X ]
Xthen
X  echo 'Could not extract Batchdir properly'
X  status=FAIL
Xfi
Xif [ X$NEWSDIR = X ]
Xthen
X  echo 'Could not extract Newsdir properly'
X  status=FAIL
Xfi
Xif [ X$SPOOLDIR = X ]
Xthen
X  echo 'Could not extract Rnews-Spooldir properly'
X  status=FAIL
Xfi
Xif [ X$NEWSLIB = X ]
Xthen
X  echo 'Could not extract Newslib properly'
X  status=FAIL
Xfi
Xif [ ! X$status = XOKAY ]
Xthen
X  echo 'Abort due to intact config.h'
X  exit 1
Xfi
Xecho -r 'Please type in the gid.uid of your News account [' $OWNER '] '
Xread answer
Xif [ X$answer = X ]
Xthen
X  owner=$OWNER
Xelse
X  owner=$answer
Xfi
Xfor dir in $BATCHDIR $NEWSDIR $SPOOLDIR $NEWSLIB $HISTORY
Xdo
X  if test ! -d $dir
X  then
X    echo -r 'Create missing directory' $dir '[y] ?'
X    read answer
X    if [ X$answer = X -o X$answer = Xy ]
X    then
X      makdir $dir
X      chown $owner $dir
X    fi
X  else
X    echo $dir 'exists.'
X  fi
Xdone
X:
X:	Install missing files, etc
X:
Xif test ! -d LIB
Xthen
X  echo 'No LIB directory in your distribution\?'
X  exit 1
Xfi
Xcd LIB
Xfor file in *
Xdo
X  destfile=${NEWSLIB}/$file
X  if test ! -f $destfile
X  then
X    echo Copy $file to $destfile
X    copy $file $destfile
X    chown $owner $destfile
X  fi
Xdone
Xactive=${NEWSLIB}/Active
Xif test ! -f $active
Xthen
X  touch $active
X  chown $owner $active
Xfi
Xfor entries in control junk local
Xdo
X  if [ ! X`bm -l $entries $active` = X$active ]
X  then
X    echo 'Create missing newsgroup' $entries
X    inews -vac=newgroup:$entries </nil
X  fi
Xdone
__END__OF__THIS__FILE__
if test -f 'SH/respool.sh' ; then
  echo 'File SH/respool.sh already exists, overwriting it'
  del 'SH/respool.sh'
fi
echo Extracting \"'SH/respool.sh'\"
sed "s/^X//" >'SH/respool.sh' <<'__END__OF__THIS__FILE__'
X:	'This script can be used to feed articles stored in (typical)'
X:	'/h0/SPOOL/RNEWS from a failed rnews operation'
X:	'$Id$'
X:	'Copyright (C) 1990 Ulrich Dessauer, Germering, Germany'
X:
X:	'Insert here your local configuration'
X:
XRNEWSDIR=/h0/SPOOL/RNEWS
X:
Xcd $RNEWSDIR
Xif [ $? -ne 0 ]
Xthen
X  echo "Cannot chdir to $RNEWSDIR, aborted"
X  exit 1
Xfi
Xfor i in *
Xdo
X  if [ "$i" = "*" ]
X  then
X    echo "No files in $RNEWSDIR"
X    exit 0
X  fi
X  case X$i in
X  [0-9]*)
X    inews < $i
X    if [ $? -eq 0 ]
X    then
X      del $i
X    else
X      echo "Article $i could not be fed successfully to inews"
X    fi
X    ;;
X  *)
X    echo "$i seems not to be a proper file to be feed to inews"
X    ;;
X  esac
Xdone
__END__OF__THIS__FILE__
exit 0
: end of shell archive

-- 
Frank Kaefer # fkk@stasys.sta.sub.org # Starnberg, Germany
Xref: sparky de.comp.sources.os9:7 comp.os.os9:1549