📄 suck_040225.shar
字号:
X -e "s/^immediatecancel:.*/immediatecancel: true/" \X -e "s/^complaints:.*/complaints: newsadmin@$DOMAIN/" \X -e "s/^fromhost:.*/fromhost: $DOMAIN/" \X -e "s/^moderatormailer:.*/moderatormailer: newsadmin@$DOMAIN/" \X inn.conf.$Org > inn.confX fiXX if [ ! -f newsfeeds.$Org ]X thenX mv newsfeeds newsfeeds.$OrgX sed \X -e "s/^# distribution of \"local\" or/# distribution of \"local\", \"junk\" or/" \X -e "s~^ME:!\*/!local~&,!junk~" \X newsfeeds.$Org >newsfeedsX fiXX if [ ! -f readers.$Org ]X thenX mv readers.conf readers.conf.$OrgX cp readers.conf.$Org readers.conf X cat >> readers.conf <<- _EOBXX #X ## added by news $HOME/suck/setup_inn.shX ## Allows machines in local domain and subdomainX ## to access the inndX ## Includes "access: RPA" so that local moderatedX ## groups can be "Authorized: "X #X auth "local" {X hosts: "*.$DOMAIN,$DOMAIN"X default: "<local>@$DOMAIN"X }XX access "local" {X users: "<local>@$DOMAIN"X newsgroups: "*"X access: RPAX }X _EOBX fiXX if [ ! -f storage.$Org ]X thenX mv storage.conf storage.conf.$OrgX cp storage.conf.$Org storage.confX cat >> storage.conf << _EOB X# added by news $HOME/suck/setup_inn.sh # From man storage.conf:# Notice that the last storage method entry will catch# everything. This is a good habit to get into; make sure# that you have at least one catch-all entry just in case# something you didn't expect falls through the cracks.X method tradspool {X newsgroups: *X class: 0}X _EOBfi # ! -f storage.$Org fi # "$DOMAIN" == "" X##################################################################if [ ! -f $PATHDB/active ]thenX print_fn "Setting up $PATHDB/active"X cat >$PATHDB/active <<- _EOBX control 0000000000 0000000001 nX control.cancel 0000000000 0000000001 nX control.checkgroups 0000000000 0000000001 nX control.newgroup 0000000000 0000000001 nX control.rmgroup 0000000000 0000000001 nX junk 0000000000 0000000001 nX _EOBfichmod 664 $PATHDB/activeX##################################################################print_fn "Checking on, and if needed setting up history"########INN_HIST=${INN_HIST:=$PATHDB/history}hasHistory_fn(){X if [ -f $INN_HIST ]X thenX wcnt=`cat $INN_HIST | wc -l `X if [ $wcnt -eq 0 ]X thenX return 0X else X return 1X fiX fiXX return 0}Xif hasHistory_fn \X && test -f ${INN_HIST}.dir \X && test -f ${INN_HIST}.hash \X && test -f ${INN_HIST}.indexthenX if [ "$Verbose" == "-v" ]X thenX ls -l $INN_HIST*X fielseX print_fn "Attempting to create a history database"X $PATHBIN/makehistoryX if [ $? -ne 0 ]X thenX echo "WARNING:$SN:main:30:makehistory failed -- bailing out" 1>&2X exit 1X fiXX $PATHBIN/makedbz -iX if [ $? -ne 0 ]X thenX echo "WARNING:$SN:main:30:makedbz -i failed -- bailing out" 1>&2X exit 1X fiXX cp -p $PATHDB/history.n.dir $PATHDB/history.dirX cp -p $PATHDB/history.n.hash $PATHDB/history.hashX cp -p $PATHDB/history.n.index $PATHDB/history.indexX $PATHBIN/makedbzX if [ $? -ne 0 ]X thenX echo "WARNING:$SN:main:30:makedbz failed -- bailing out" 1>&2X exit 1X fiXX rm -f $PATHDB/history.n.*X fiXif [ ! -f $INN_HIST ]thenX echo "ERROR:$SN:main:30:$INN_HIST does not exist" 1>&2X exit 1fi##################################################################echo "Please fix by hand problems shown by $PATHBIN/inncheck"echo "inncheck start problem list ###############################"$PATHBIN/inncheckecho "inncheck end ##############################################"cat <<- _EOBX Please ask root to start the inn daemon on Redhat Machines:X /etc/init.d/innd restartX and to make sure that it auto starts when the machine is rebooted rootX should run:X ntsysv X and "*" the innd option._EOBSHAR_EOF (set 20 04 02 07 23 50 16 'suck/setup_inn.sh'; eval "$shar_touch") && chmod 0554 'suck/setup_inn.sh' || $echo 'restore of' 'suck/setup_inn.sh' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'suck/setup_inn.sh:' 'MD5 check failed'f4c61ede16030d9a1e23fb6628ea7ac0 suck/setup_inn.shSHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'suck/setup_inn.sh'`" test 11124 -eq "$shar_count" || $echo 'suck/setup_inn.sh:' 'original size' '11124,' 'current size' "$shar_count!" fifi# ============= suck/setup_suck.sh ==============if test -f 'suck/setup_suck.sh' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'suck/setup_suck.sh' '(file already exists)'else $echo 'x -' extracting 'suck/setup_suck.sh' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'suck/setup_suck.sh' &&#!/bin/bash################################################################################ @(#)setup_suck.sh Version: 1.3 Date: 03/11/07 21:30:11 Author: PBS# To contact the Author: lmrlnATbigfoot.com replace AT with @# Copyright (C) 2003 Philip Baird Shearer## 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.## This text 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.# URL: http://www.gnu.org/copyleft/gpl.html#SEC3################################################################################ Description:# One off customisation of suck and inn so that suck can be run successfully.## History# 12 Nov Working Version################################################################################ These variables can be altered for example if the name inn user is not # news then alter it here#########################NewsUser=newsVerbose="-v"EnvTmp=""SuckEnvRc=.suckenvrcOrg=nosuck_orgHostCmd="/usr/bin/host -W 120"###############################################################################print_fn(){X if [ "$Verbose" == "-v" ]X thenX echo $*X fi}###############################################################################usage_fn() {X echo "usage: $SN {-h[elp]|-H[elp_more]|-u[undo]}"}###############################################################################introduction_fn(){cat <<- _EOBXX This script "$SN" sets up a Redhat installation of suck forX your edification and gratification. It assumes that you have alreadyX installed inn and suck using rpm. If you have not set up innd toX your personal setting then please run "setup_inn.sh" before runningX "setup_suck.sh". You should be logged in as $NewsUser. To do this useX the substitute user program "su" to become root. Then "su" to news. ThisX gets around the fact that news does not usually have a password. If youX do not have permission to become root then ask the root user to allowX you access to news by setting a password for news.X su - # to substitute as rootX su - $NewsUser # to substitute as newsXX You can override two of the variables which are created by this scriptX by setting them at the command line BEFORE running this script:X var=sting;export var # where var is the environment variable and stringX # is the valueXX The variable which will allow this script to run without having to answerX any in line questions is NNTPSERVER which is your ISP server name eg.X "news.theperfectisp.com"XX The other variable which can be set before this script is run is:X PATHBIN this is used set the path to the version ofX "innconfval". innconfval sets most of the variables used by the innX system. This script uses some of those variables to set up a resourceX file for suck.XX This script contains a number of hard coded variables at the top of theX script which can be changed manually before it is run.X NewsUser=news # the normal owner of inndX Verbose="-v" # set this to "" for less verbose outputX SuckEnvRc=.suckenvrc # the name of the resource file createdX # by this scriptX Org=nosuck_org # backup/recovery (-undo) extension X HostCmd="host -W 120" # delay command to activate dialup connectionXX The resource file created by this script can be found as a linked fileX in two places in the \$HOME dir of the innd owner (usually news) andX \$HOME/suck. The usual name for this file is .suckenvrc.XX Files which are altered and are backed up under $Org they are:X \$HOME/suck/\$SuckEnvRc (default name .suckenvrc)X \$HOME/suck/\$SuckEnvRc as it is linked to \$HOME/suck/\$SuckEnvRcX \$HOME/suck/active-ignoreX \$PATHETC/newsfeedsX \$PATHDB/activeXX If the history file does not exist then one is created. It isX NOT put back in to the original state if the -undo option is run.X To crate the history db the following commands are run:X makehistoryX makedbz -iX cp -p \$PATHDB/history.n.dir \$PATHDB/history.dirX cp -p \$PATHDB/history.n.hash \$PATHDB/history.hashX cp -p \$PATHDB/history.n.index \$PATHDB/history.indexX makedbzXX -h[elp] usageX -H[elp] This pageX -u[ndo] will move the original contents of the files backX into place._EOB}################################################################################pidofproc_fn() {X # A Redhat 7.3 function to find the pid of a program.X base=${1##*/}XX # Test syntax.X if [ $# = 0 ] ; thenX echo $"Usage: pidofproc {program}"X return 1X fiXX # First try "/var/run/*.pid" filesX if [ -f /var/run/${base}.pid ] ; thenX local line p pid=X read line < /var/run/${base}.pidX for p in $line ; doX [ -z "${p//[0-9]/}" -a -d /proc/$p ] && pid="$pid $p"X doneX if [ -n "${pid-:}" ] ; thenX echo $pidX return 0X fiX fiXX # Next try "pidof"X /sbin/pidof -o $$ -o $PPID -o %PPID -x $1 || \X /sbin/pidof -o $$ -o $PPID -o %PPID -x ${base}}################################################################################who_am_i_fn(){X WHOAMI=`which whoami 2>/dev/null`X if [ $? -ne 0 ]X thenX WHOAMI=`which id 2>/dev/null`X if [ $? -ne 0 ]X thenX echo "ERROR:$SN:who_am_i_fn:10: could not find programs whoami or id -- bailing out" 1>&2X return 1 X fiX WHOAMI="$WHOAMI -u -n"X fiXX $WHOAMIX if [ $? -ne 0 ]X thenX echo "ERROR:$SN:who_am_i_fn:20: $WHOAMI failed do not know which user you are" 1>&2X return 1X fiX return 0}################################################################################set_env_fn(){X EnvTmp=$1X shiftXX if [ "$EnvTmp" != "" ]X thenX return 0X fiXX /bin/echo -n "$*"XX while [ -z "$EnvTmp" ]X doX read EnvTmpX doneXX set $EnvTmpX return 0}################################################################################set_inn_conf_path_fn(){X INN_CONF=${INN_CONF:=/etc/news/inn.conf}X while [ ! -f "$INN_CONF" ]X doX set_env_fn "" "Please enter the PARENT DIR of inn.conf: "X INN_CONF=$EnvTmp/inn.confX done}################################################################################get_innconf_fn(){X grep $1 $INN_CONF | awk '{print $2;}'}################################################################################get_innconf_vars_fn(){X PATHBIN=${PATHBIN:=`get_innconf_fn pathbin`}X if [ -x $PATHBIN/innconfval ]X thenX #X ## if the tool exists use itX #X rm -f /tmp/$SN.1.$$XX $PATHBIN/innconfval -s >/tmp/$SN.$$X if [ -z "$PATHARTICLES" ]X thenX grep PATHARTICLES /tmp/$SN.$$ >>/tmp/$SN.1.$$X fiX if [ -z "$PATHOUTGOING" ]X thenX grep PATHOUTGOING /tmp/$SN.$$ >>/tmp/$SN.1.$$ X fiX if [ -z "$PATHDB" ]X thenX grep PATHDB /tmp/$SN.$$ >>/tmp/$SN.1.$$ X fiX if [ -z "$PATHTMP" ]X thenX grep PATHTMP /tmp/$SN.$$ >>/tmp/$SN.1.$$ X fiX if [ -z "$PATHETC" ]X thenX grep PATHETC /tmp/$SN.$$ >> /tmp/$SN.1.$$X fiXX if [ -f /tmp/$SN.1.$$ ]X thenX # include with source cmd (note dot at start of line)X. /tmp/$SN.1.$$ X rm -f /tmp/$SN.1.$$ X fiX rm -f /tmp/$SN.$$XX elseX PATHARTICLES=${PATHARTICLES:=`get_innconf_fn patharticles`}X PATHOUTGOING=${PATHOUTGOING:=`get_innconf_fn pathoutgoing`}X PATHDB=${PATHDB:=`get_innconf_fn pathdb`}X PATHTMP=${PATHTMP:=`get_innconf_fn pathtmp`}X PATHETC=${PATHETC:=`get_innconf_fn pathetc`}X fi}################################################################################all_innconf_set_fn() {set \X "$PATHBIN" \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -