Annotation of 43BSDTahoe/new/news/src/checkgroups.sh, revision 1.1

1.1     ! root        1: : check active file for missing or extra newsgroups
        !             2: : '@(#)checkgroups     1.23    9/24/87'
        !             3: 
        !             4: if  test  ! -s LIBDIR/newsgroups
        !             5: then
        !             6:        cp /dev/null LIBDIR/newsgroups
        !             7: fi
        !             8: echo "" >/tmp/$$out
        !             9: # Read first line of stdin.  If of the form "-n group", then only check
        !            10: # for the specified group.  Otherwise, assume doing standard groups
        !            11: sed -e "/^From: /w /tmp/$$out" -e '/^[a-zA-Z-]*: /d' -e '/^$/d' -e '/^[#:]/d' | (
        !            12: read line
        !            13: case "${line}" in
        !            14: -n*)
        !            15:        # Doing specific group.  extract group name and preserve
        !            16:        # all of current newsgroups file except for that group.
        !            17:        # Then append entries for this group.
        !            18:        group=`echo "x${line}" | sed -e 's/x-n /^/' -e 's/$/[.  ]/'`
        !            19:        egrep -v "${group}" LIBDIR/newsgroups > /tmp/$$a
        !            20:        cat /tmp/$$a - > LIBDIR/newsgroups
        !            21:        ;;
        !            22: *)
        !            23:        # Get the distributions from the checkgroups message itself
        !            24:        # This allows sites to append their local groups to the distributed
        !            25:        # checkgroups message and prevents stray checkgroups from other sites
        !            26:        # from showing all the local groups as being bad groups.
        !            27:        #
        !            28:        echo "${line}" > /tmp/$$msg
        !            29:        cat >> /tmp/$$msg
        !            30:        cp /dev/null /tmp/$$b
        !            31:        sed -e "s;[     ].*;;" -e "s;\..*;;" -e "s;^!;;" /tmp/$$msg | sort -u |
        !            32:                while read dist
        !            33:                do
        !            34:                        group=`cat /tmp/$$b`
        !            35:                        group="${group}|^$dist[.        ]"
        !            36:                        echo "${group}" > /tmp/$$b
        !            37:                done
        !            38:        group=`cat /tmp/$$b`
        !            39:        egrep -v "${group}" LIBDIR/newsgroups > /tmp/$$a
        !            40:        cat /tmp/$$a > LIBDIR/newsgroups
        !            41:        sed -e "/^!/d" /tmp/$$msg >> LIBDIR/newsgroups
        !            42:        rm -f /tmp/$$b /tmp/$$msg
        !            43:        ;;
        !            44: esac
        !            45: 
        !            46: egrep "${group}" LIBDIR/active | sed 's/ .*//' | sort >/tmp/$$active
        !            47: egrep "${group}" LIBDIR/newsgroups | sed 's/[  ].*//' | sort >/tmp/$$newsgrps
        !            48: 
        !            49: comm -13 /tmp/$$active /tmp/$$newsgrps >/tmp/$$missing
        !            50: comm -23 /tmp/$$active /tmp/$$newsgrps >/tmp/$$remove
        !            51: 
        !            52: egrep "${group}" LIBDIR/active | sed -n "/m\$/s/ .*//p" |
        !            53:        sort > /tmp/$$amod.all
        !            54: egrep "${group}" LIBDIR/newsgroups |
        !            55: sed -n "/Moderated/s/[         ][      ]*.*//p" | sort > /tmp/$$ng.mod
        !            56: 
        !            57: comm -12 /tmp/$$missing /tmp/$$ng.mod >/tmp/$$add.mod
        !            58: comm -23 /tmp/$$missing /tmp/$$ng.mod >/tmp/$$add.unmod
        !            59: cat /tmp/$$add.mod /tmp/$$add.unmod >>/tmp/$$add
        !            60: 
        !            61: comm -23 /tmp/$$amod.all /tmp/$$remove >/tmp/$$amod
        !            62: comm -13 /tmp/$$ng.mod /tmp/$$amod >/tmp/$$ismod
        !            63: comm -23 /tmp/$$ng.mod /tmp/$$amod >/tmp/$$nm.all
        !            64: comm -23 /tmp/$$nm.all /tmp/$$add >/tmp/$$notmod
        !            65: 
        !            66: echo "" >>/tmp/$$out
        !            67: if test -s /tmp/$$remove
        !            68: then
        !            69:        (
        !            70:        echo "The following newsgroups are non-standard."
        !            71:        sed "s/^/       /" /tmp/$$remove
        !            72:        echo ""
        !            73:        echo "You can remove them by executing the commands:"
        !            74:        echo \  LIBDIR/rmgroup `cat /tmp/$$remove`
        !            75:        echo ""
        !            76:        ) 2>&1 >>/tmp/$$out
        !            77: fi
        !            78: 
        !            79: if test -s /tmp/$$add
        !            80: then
        !            81:        (
        !            82:        echo "The following newsgroups were missing and should be added."
        !            83:        sed "s/^/       /" /tmp/$$add
        !            84:        echo ""
        !            85:        echo "You can do this by executing the command(s):"
        !            86:        for i in `cat /tmp/$$add.unmod`
        !            87:        do
        !            88:                echo 'LIBDIR/inews -C '$i' </dev/null'
        !            89:        done
        !            90:        for i in `cat /tmp/$$add.mod`
        !            91:        do
        !            92:                echo 'LIBDIR/inews -C '$i' moderated </dev/null'
        !            93:        done
        !            94:        echo ""
        !            95:        ) 2>&1 >>/tmp/$$out
        !            96: fi
        !            97: 
        !            98: if test -s /tmp/$$ismod
        !            99: then
        !           100:        (
        !           101:        echo "The following newsgroups are not moderated and are marked moderated."
        !           102:        sed "s/^/       /" /tmp/$$ismod
        !           103:        echo ""
        !           104:        echo "You can correct this by executing the command(s):"
        !           105:        for i in `cat /tmp/$$ismod`
        !           106:        do
        !           107:                echo 'LIBDIR/inews -C '$i' </dev/null'
        !           108:        done
        !           109:        echo ""
        !           110:        ) 2>&1 >>/tmp/$$out
        !           111: fi
        !           112: 
        !           113: if test -s /tmp/$$notmod
        !           114: then
        !           115:        (
        !           116:        echo "The following newsgroups are moderated and not marked so."
        !           117:        sed "s/^/       /" /tmp/$$notmod
        !           118:        echo ""
        !           119:        echo "You can correct this by executing the command(s):"
        !           120:        for i in `cat /tmp/$$notmod`
        !           121:        do
        !           122:                echo 'LIBDIR/inews -C '$i' moderated </dev/null'
        !           123:        done
        !           124:        echo ""
        !           125:        ) 2>&1 >>/tmp/$$out
        !           126: fi
        !           127: 
        !           128: if test -s /tmp/$$out
        !           129: then
        !           130:        (echo   "Subject: Problems with your active file"
        !           131:        echo ""
        !           132:        cat /tmp/$$out
        !           133:        ) | if test $# -gt 0
        !           134:                then
        !           135:                        mail $1
        !           136:                else
        !           137:                        cat
        !           138:                fi      
        !           139: fi
        !           140: )
        !           141: 
        !           142: rm -f /tmp/$$*
        !           143: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.