hansen@pegasus.UUCP (Tony L. Hansen) (12/09/85)
Since I have but don't use or even want to use csh, I have rewritten the
posted "newgroup" Csh script into a /bin/sh shell script. This shell script
should be a standard part of 2.10.3 netnews along side of the rmgroup.sh.
Tony Hansen
ihnp4!pegasus!hansen
#!/bin/sh
# This is a shar archive.
# The rest of this file is a shell script which will extract:
# newgroup.sh
# Archive created: Mon Dec 9 12:14:14 EST 1985
echo x - newnewsgrp.sh
sed 's/^X//' > newgroup.sh << '~FUNKY STUFF~'
#! /bin/sh
#
# A quick shell script to add new newsgroups without inews -C
# It even tries to make any of the needed upper-level directories ...
# It assumes that the group is to be postable.
#
newsuser=news
newsgrp=news # may be "daemon" at your site
libdir=/usr/lib/news # usually ~${newsuser}
active=${libdir}/active
spooldir=/usr/spool/news
mode=755 # Some people have them mode 777 ...
name=$0 # Just the name of this script.
case $# in
0 )
echo "Usage: $0 group [ group ] ..." 1>&2
exit 1;;
esac
cp $active ${active}.old # Just in case !!!
for group in $*
do
echo Adding group $group ...
# Now to make sure all the directories exist ...
dir=$spooldir
for part in `echo $group | sed 's;\.; ;g'`
do
dir=${dir}/${part}
if [ ! -d $dir ]
then
echo Making directory $dir
/bin/mkdir $dir
chown $newsuser $dir
chgrp $newsgrp $dir
chmod $mode $dir
fi
done
# And add to the active file ...
echo "$group 00000 00000 y" >> $active
done
echo All done ...
exit 0
~FUNKY STUFF~
ls -l newnewsgrp.sh
# The following exit is to ensure that extra garbage
# after the end of the shar file will be ignored.
exit 0