From f7cca6ea32444a7764d54989bf360530d07d6092 Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Thu, 5 Sep 2002 07:37:06 +0000 Subject: untouched --- news_wizard/scripts/check_news_server.sh | 48 +++++++++++++ news_wizard/scripts/check_valid_hours.sh | 49 +++++++++++++ news_wizard/scripts/config.default | 116 +++++++++++++++++++++++++++++++ news_wizard/scripts/do_it_news.sh | 86 +++++++++++++++++++++++ news_wizard/scripts/news.cron | 10 +++ 5 files changed, 309 insertions(+) create mode 100755 news_wizard/scripts/check_news_server.sh create mode 100755 news_wizard/scripts/check_valid_hours.sh create mode 100644 news_wizard/scripts/config.default create mode 100755 news_wizard/scripts/do_it_news.sh create mode 100644 news_wizard/scripts/news.cron (limited to 'news_wizard/scripts') diff --git a/news_wizard/scripts/check_news_server.sh b/news_wizard/scripts/check_news_server.sh new file mode 100755 index 00000000..f1eee021 --- /dev/null +++ b/news_wizard/scripts/check_news_server.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Wizard +# +# Copyright (C) 2000 Mandrakesoft. +# +# This program 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. +# See file LICENSE for further informations on licensing terms. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi +# icons: Helene Durosini +# http://www.mandrakesoft.com + +# script for wizard leafnode configuration +# +# checking if the provided server is correct : +# strip the @ and illegal characters + + +if [ -z "${wiz_news_server}" ] ;then + echo_debug "wiz_news_server is empty, should not." + exit 1 +fi + + +test=`echo ${wiz_news_server##*@} |sed -e 's/[^0-9a-zA-Z-\.]//g'` + +if [ -z "${test}" ] ;then + echo_debug "wiz_news_server is empty, should not." + exit 1 +fi + + +# all seems to be ok +exit 10 + diff --git a/news_wizard/scripts/check_valid_hours.sh b/news_wizard/scripts/check_valid_hours.sh new file mode 100755 index 00000000..ea30c0bd --- /dev/null +++ b/news_wizard/scripts/check_valid_hours.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Wizard +# +# Copyright (C) 2000 Mandrakesoft. +# +# This program 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. +# See file LICENSE for further informations on licensing terms. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi +# icons: Helene Durosini +# http://www.mandrakesoft.com + +# script for wizard leafnode configuration +# +# checking if the provided hours are correct : +# from 1 to 24 + + +if [ -z "${wiz_news_freq}" ] ;then + echo_debug "wiz_news_freq is empty, should not." + exit 1 +fi + +typeset -i test + +test=`echo ${wiz_news_freq} |sed -e 's/[^0-9]//g'` + +if [ -z "${test}" ] ;then + echo_debug "wiz_news_freq is empty, should not." + exit 1 +fi + + +# all seems to be ok +exit 10 + diff --git a/news_wizard/scripts/config.default b/news_wizard/scripts/config.default new file mode 100644 index 00000000..c1c98a3d --- /dev/null +++ b/news_wizard/scripts/config.default @@ -0,0 +1,116 @@ +## This is the NNTP server leafnode fetches its news from. +## You need read and post access to it. Mandatory. +server = __server__ + +## Unread discussion threads will be deleted after this many days if +## you don't define special expire times. Mandatory. +expire = 14 + +## +## All the following parameters are optional +## + +## I have free access to my news server. If you don't have, comment out +## the following two lines and change them accordingly. +# username = gulbrandsen +# password = secret + +## Standard news servers run on port 119. If your newsserver doesn't, comment +## out the following line and change it accordingly. +# port = 8000 + +## This is another news server which stores some groups that are not +## available on the first one. You can define username, password and port +## for each server separately. +# server = sex.and.warez.com +# username = xenu +# password = secret + +## This is a news server which does not understand the +## "LIST NEWSGROUP news.group" command. For this reason, we don't try to +## download newsgroups descriptions when getting new newsgroups. This is +## achieved by putting "nodesc = 1" somewhere behind the server +## line. +# server = broken.upstream.server +# nodesc = 1 + +## Here we have another news server which has a very slow connection. For +## that reason, we wait a full minute before we give up trying to connect. +## The default is 10 seconds. +# server = really.slow.snail +# timeout = 60 + +## Non-standard expire times (glob(7) wildcard constructs possible) +# groupexpire comp.os.linux.* = 5 # groups too big to hold articles 20 days +# groupexpire any.local.newsgroup = 100 # very interesting, hold articles longer + +## Never fetch more than this many articles from one group in one run. +## Be careful with this; setting it much below 1000 is probably a bad +## idea. +maxfetch = 2000 + +## Fetch only a few articles when we subscribe a new newsgroup. The +## default is to fetch all articles. +initialfetch = 1000 + +## If you want to use leafnode like an offline newsreader (e.g. Forte +## Agent) you can download headers and bodies separately if you set +## delaybody to 1. In this case, fetch will only download the headers +## and only when you select an article, it will download the body. +## This can save a huge amount of bandwith if only few articles are really +## read from groups with lots of postings. +## This feature works not very well with Netscape, though (which is not +## a fault of Leafnode). +# delaybody = 0 + +## To avoid spam, you can select the maximum number of crosspostings +## that are allowed in incoming postings. Setting this below 5 is +## probably a bad idea. The default is unlimited crossposting. +maxcrosspost = 8 + +## If you suffer from repeatedly receiving old postings (this happens +## sometimes when an upstream server goes into hiccup mode) you can +## refuse to receive them with the parameter "maxage" which tells the +## maximum allowed age of an article in days. The default maxage is 10 +## days. +maxage = 7 + +## maxlines will make fetch reject postings that are longer than a certain +## amount of lines. +maxlines = 500 + +## minlines will make fetch reject postings that are shorter than a certain +## amount of lines. +minlines = 2 + +## maxbytes will make fetch reject postings that are larger +maxbytes = 50000 + +## timeout_short determines how many days fetch gets a newsgroup which +## has been accidentally opened. The default is two days. +timeout_short = 2 + +## timeout_long determines how many days fetch will wait before not getting +## an unread newsgroup any more. The default is seven days. +timeout_long = 7 + +## timeout_active determines how many days fetch will wait before re-reading +## the whole active file. The default is 90 days. +# timeout_active = 365 + +## If you want to have your newsreader score/kill on Xref: lines, you might +## want to uncomment this. +# create_all_links = 1 + +## If you want to filter out certain regular expressions in the header, +## create a "filterfile" (how this is done is explained in the README) +## and set +# filterfile = /path/to/your/filterfile + +## If your newsreader does not supply a Message-ID for your postings +## Leafnode will supply one, using the hostname of the machine it is +## running on. If this hostname is not suitable, this parameter can be +## used to override it. Do not use a fantasy name, it may interfere with +## the propagation of your messages. Most modern newsreaders do provide +## a Message-ID. +# hostname = host.domain.country diff --git a/news_wizard/scripts/do_it_news.sh b/news_wizard/scripts/do_it_news.sh new file mode 100755 index 00000000..a67d0d99 --- /dev/null +++ b/news_wizard/scripts/do_it_news.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# +# Wizard +# +# Copyright (C) 2000 Mandrakesoft. +# +# This program 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. +# See file LICENSE for further informations on licensing terms. +# +# This program 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 program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi +# icons: Helene Durosini +# http://www.mandrakesoft.com + +# script for wizard leafnode configuration +# +# put the default leafnode configuration +# assuming all dependencies are ok + + +# wiz_news_server and wiz_news_freq are provided by the running wizard + +# security +typeset -i freq +freq=`echo ${wiz_news_freq} |sed -e 's/[^0-9]//g'` + +if [ $freq -le 0 ]; then + freq=1 +fi +if [ $freq -ge 24 ]; then + freq=24 +fi + + +server=`echo ${wiz_news_server##*@} |sed -e 's/[^0-9a-zA-Z-\.]//g'` + +# store the wiz_news_server and wiz_news_freq value +file=/etc/sysconfig/mdk_serv +chg_val ${file} wiz_news_freq ${freq} s +chg_val ${file} wiz_news_server ${server} s + + +# leafnode configuration file +config="/etc/leafnode/config" +if [ ! -f ${config} ]; then + echo_debug "no leafnode configuration file found ! exiting." + exit 1 +fi + +bck_file ${config} + +cat ${CWD}/scripts/config.default \ +| sed -e 's/__server__/'"${server}"'/' > ${config} + +echo_debug "config file done, putting crontab for news" + +if [ -f /var/spool/cron/news ]; then + cp -f /var/spool/cron/news /etc/leafnode/crontab +fi + +bck_file /etc/leafnode/crontab + +cat ${CWD}/scripts/news.cron \ +| sed -e 's/__freq__/'"${freq}"'/' > /etc/leafnode/crontab + + +echo_debug "installing news crontab" +crontab -u news /etc/leafnode/crontab + + +# all is ok +exit 10 + + + diff --git a/news_wizard/scripts/news.cron b/news_wizard/scripts/news.cron new file mode 100644 index 00000000..5785bfb2 --- /dev/null +++ b/news_wizard/scripts/news.cron @@ -0,0 +1,10 @@ +### leafnode crontab +SHELL=/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin +MAILTO=root@localhost + + +35 4 * * * /usr/sbin/texpire + +5 */__freq__ * * * /usr/sbin/fetchnews -v 2>&1 + -- cgit v1.2.1