This is getnewsconf.sh in view mode; [Download] [Up]
#! /bin/sh
#+++
# RCS getnewsconf.sh,v 1.5 1995/07/12 16:57:23 tom Exp
# title: getnewsconf.sh
# abstract: Get (current or default) news configuration parameters.
# author: T.R.Hageman, Groningen, The Netherlands
# created: December 1994
# modified: (see RCS Log at end)
# copyleft:
#
# Copyright (C) 1994,1995 Tom R. Hageman.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# description:
#
# This script is part of NewsConfig.app
#
#---
NEWSCONFIGAPP=$1
# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
. ${NEWSCONFIG-/usr/local/lib/news/bin/config}
export NEWSCTL NEWSBIN NEWSARTS NEWSPATH NEWSUMASK NEWSMASTER NEWSCONFIG
PATH=$NEWSCONFIGAPP:$NEWSCTL/maint:$NEWSBIN/bin:$NEWSBIN:$NEWSPATH
export PATH
cd $NEWSCTL
if [ -r organization ]
then
ORGANIZATION=`head -1 organization`
elif [ -r organisation ]
then
ORGANIZATION=`head -1 organisation`
else
ORGANIZATION='ACME, Inc.'
fi
if [ -r mailname ]
then
HOSTNAME=`head -1 mailname`
else
HOSTNAME=`hostname`.`domainname`
fi
UUCPNAME=`newshostname`
# Extract name of newsfeed system (assume it is the first non-ME one in sys).
if [ -r sys ]
then
NEWSFEED=`canonsys.sh sys | sed '/^ME:/d; /^#/d; /^$/d; q'`
fi
[ -n "$NEWSFEED" ] || {
NEWSFEED=`uuname | head -1`":all,!junk,!general/all,!local:f:"
}
# Split newsfeed info into its components
NEWSFEED_SUBSCRIPTIONS=`expr "$NEWSFEED" : '^[^:]*:\([^:/]*\)'`
NEWSFEED_DISTRIBUTION=`expr "$NEWSFEED" : '^[^:]*:[^:/]*/\([^:]*\)'`
NEWSFEED_FLAGS=`expr "$NEWSFEED" : '^[^:]*:[^:]*:\(.*\)'`
# Reduce newsfeed to sitename and /exclusions (aliases).
NEWSFEED=`expr "$NEWSFEED" : '^\([^:]*\).*'`
if [ -f rnews.immed ]
then
IMMEDNEWS=yes
fi
if [ -f expirermdir ]
then
EXPIRERMDIR=yes
fi
if [ -r addsignature ]
then
ADDSIGNATURE=`head -1 addsignature`
else
ADDSIGNATURE='no'
fi
# support function
zcat_maybe() { # root file name
while :
do
case "$#" in
0) break
esac
cat "$1" 2>/dev/null ||
zcat "$1".Z 2>/dev/null ||
gzcat "$1".gz 2>/dev/null ||
echo "zcat_maybe: cannot read file $1 (plain, .Z or .gz)" >&2
shift
done
}
active=/dev/null
[ -r active ] && active=active
# Extract available groups from prototype active file in app wrapper (if any)
AVAILABLEGROUPS=`zcat_maybe $NEWSCONFIGAPP/active $active | \
sed 's/^[ ]*\([^ .]*\).*/\1/' | sort -u`
ACTIVEGROUPS=`sed 's/^[ ]*\([^ .]*\).*/\1/' $active 2>/dev/null | sort -u`
# Provide reasonable default groups if no (or minimal) active file present.
if [ -z "$ACTIVEGROUPS" -o "$ACTIVEGROUPS" = "control junk general news" ]
then
ACTIVEGROUPS='alt comp control general gnu misc news rec sci soc talk'
fi
# See if sys allows creation of new news hierarchies.
canonsys.sh sys 2>/dev/null | grep '^ME:all' && ALLGROUPS=yes
# Check that NeGeN extensions are indeed available.
[ -f $NEWSBIN/inject/signature ] && ADDSIGNATURE_PRESENT=yes
grep expirermdir $NEWSBIN/expire/doexpire >/dev/null && EXPIRERMDIR_PRESENT=yes
grep 'rnews\.immed' $NEWSBIN/input/rnews >/dev/null && IMMEDNEWS_PRESENT=yes
[ -n "$ADDSIGNATURE_PRESENT" ] || ADDSIGNATURE=4
# Dump the values.
echo ORGANIZATION $ORGANIZATION
echo HOSTNAME $HOSTNAME
echo UUCPNAME $UUCPNAME
echo NEWSFEED $NEWSFEED
echo NEWSFEED_SUBSCRIPTIONS $NEWSFEED_SUBSCRIPTIONS
echo NEWSFEED_DISTRIBUTION $NEWSFEED_DISTRIBUTION
echo NEWSFEED_FLAGS $NEWSFEED_FLAGS
[ -n "$IMMEDNEWS" ] && echo IMMEDNEWS
[ -n "$EXPIRERMDIR" ] && echo EXPIRERMDIR
echo ADDSIGNATURE $ADDSIGNATURE
[ -n "$EXPIRERMDIR_PRESENT" ] && echo EXPIRERMDIR_PRESENT
[ -n "$ADDSIGNATURE_PRESENT" ] && echo ADDSIGNATURE_PRESENT
[ -n "$IMMEDNEWS_PRESENT" ] && echo IMMEDNEWS_PRESENT
echo ACTIVEGROUPS $ACTIVEGROUPS
echo AVAILABLEGROUPS $AVAILABLEGROUPS
[ -n "$ALLGROUPS" ] && echo ALLGROUPS
exit 0
#======================================================================
# getnewsconf.sh,v
# Revision 1.5 1995/07/12 16:57:23 tom
# (ALLGROUPS,IMMEDNEWS_PRESENT): new.
# [added standard header comment]
#
# Revision 1.4 1995/01/19 17:24:51 tom
# (NEWSFEED_SUBSCRIPTIONS,NEWSFEED_DISTRIBUTION,NEWSFEED_FLAGS): added.
#
# Revision 1.3 1995/01/08 23:25:03 tom
# (NEWSFEED): add !local to default distribution;
# (zcat_maybe): new support function; (AVAILABLEGROUPS): use it;
# (ACTIVEGROUPS): also provide default if minimal avtive is present;
# (ADDSIGNATURE_PRESENT): update feature check.
#
# Revision 1.2 1994/12/27 20:32:16 tom
# (NEWSFEED): use canonsys.sh to extract newsfeed from sys, yield complete
# default entry; (EXPIRERMDIR_PRESENT,ADDSIGNATURE_PRESENT): added.
#
# Revision 1.1 1994/12/20 13:52:42 tom
# Initial revision
#
#======================================================================
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.