File: jf

package info (click to toggle)
junkfilter 19980901-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 332 kB
  • ctags: 6
  • sloc: sh: 160; makefile: 36
file content (122 lines) | stat: -rwxr-xr-x 3,732 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh
#
# JF -- unified junkfilter management
#
# junkfilter
# a junk e-mail filter system for procmail
# Copyright 1997-98, Gregory Sutter <gsutter@pobox.com>
#
# Please read the file "junkfilter.readme" and the page
# http://www.pobox.com/~gsutter/junkfilter/ before using
# junkfilter.  junkfilter is copyright 1997-98 Gregory
# Sutter and is licensed under the terms of the GNU
# General Public License, version 2.  See the file
# junkfilter.readme for details.

# ***************************************************
# NOTA BENE: This program is unsupported, and is only
# included for your convenience.  It WILL have to be
# modified for your system!
# ***************************************************

JFDIR=$HOME/prog/junkfilter

if [ x$1 = xadd ]; then
	echo $2 >> $HOME/prog/junkfilter/domains/general

elif [ x$1 = xchk ]; then
	cat $HOME/prog/junkfilter/domains/* | perl -pe 'y/[A-Z]/[a-z]/' | grep $2

elif [ x$1 = xcta ]; then
	cat $HOME/prog/junkfilter/domains/* | perl -pe 'y/[A-Z]/[a-z]/' | grep $2 || echo $2 >> $HOME/prog/junkfilter/domains/general

elif [ x$1 = xbuild ]; then
	if [ x$2 = xdomains ]; then
	  cat $JFDIR/domains/* |\
	  perl -pe 's/[	 ]+//g; y/[A-Z]/[a-z]/; s/
//g' |\
	  egrep -v '^$' |\
	  sort | uniq |\
	  perl -p0e 's/\012(.)/\|$1/g; s/\./\\./g; s/\015//g; s/\|{2,}/\|/g' > $JFDIR/jf-domains
	  echo "Done. $2 built."

	elif [ x$2 = xaddresses ]; then 
	  cat $JFDIR/addresses | sort |\
	  perl -p0e 's/\012(.)/\|$1/g; s/\015//g; s/\|{2,}/\|/g' > $JFDIR/jf-addresses
	  echo "Done. $2 built."

	elif [ x$2 = xip ]; then 
	  cat $JFDIR/ip | sort |\
	  perl -p0e 's/\012(.)/\|$1/g; s/\./\\./g; s/\015//g; s/\|{2,}/\|/g' > $JFDIR/jf-ip
	  echo "Done. $2 built."

	elif [ x$2 = xbodychk ]; then 
	  cat $JFDIR/bodychk | sort |\
	  perl -p0e 's/\012(.)/\|$1/g; s/\015//g; s/\|{2,}/\|/g' > $JFDIR/jf-bodychk
	  echo "Done. $2 built."

	elif [ x$2 = xdialups ]; then 
	  cat $JFDIR/dialups | sort |\
	  perl -p0e 's/\012(.)/\|$1/g; s/\./\\./g; s/\015//g; s/\|{2,}/\|/g' > $JFDIR/jf-dialups
	  echo "Done. $2 built."

	elif [ x$2 = xheaders ]; then 
	  cat $JFDIR/headers | sort |\
	  perl -p0e 's/\012(.)/\|$1/g; s/\015//g; s/\|{2,}/\|/g' > $JFDIR/jf-headers
	  echo "Done. $2 built."

	elif [ x$2 = xall ]; then
	  jf build addresses
	  jf build bodychk
	  jf build dialups
	  jf build domains
	  jf build headers
	  jf build ip
	  echo "Done. $2 built."

	elif [ x = x ]; then
	  echo "I can build 'addresses', 'bodychk', 'dialups', 'domains', 'headers', 'ip', 'all'"
	  exit 1

	fi

elif [ x$1 = xget ]; then
	cd $JFDIR
	cat domains/gulf-blocks >> more/gulf-blocks-old
	lynx -dump -source ftp://ftp.gulf.net/pub/docs/domains.txt > domains/gulf-blocks

elif [ x$1 = xrel ]; then
	if [ ! x$2 = x ]; then
	  JFEVER=$2
	else
	  echo "What version do you want to release? (e.g. 19980831)"
	  exit 1
	fi
	  if [ ! -d $JFDIR/pkg/$JFEVER ]; then
	    mkdir $JFDIR/pkg/$JFEVER
	  else
	    echo "That version already exists!"
	    exit 1
	  fi
	  JFEDIR=$HOME/prog/junkfilter/pkg/$JFEVER
	  TMPDIR=$HOME/prog/junkfilter/tmp
	  rm -r $TMPDIR/*
	  rm $JFEDIR/*
#	  jf get
	  jf build all
	  mkdir $TMPDIR/junkfilter-$JFEVER
	  cp $JFDIR/* $TMPDIR/junkfilter-$JFEVER
	  cp -R $JFDIR/domains $TMPDIR/junkfilter-$JFEVER
	  cd $TMPDIR
	  tar -cf - junkfilter-$JFEVER | gzip -9 > $JFEDIR/junkfilter-$JFEVER.tar.gz
	  mv $TMPDIR/junkfilter-$JFEVER/* $JFEDIR
	  echo "Done.  New junkfilter release in $JFEDIR."

elif [ x$1 = x ]; then
	echo "Command syntax: jf <command> <option>"
	echo "commands: add [domain], chk [domain], cta [domain], build [option],"
	echo "          get (new gulf-blocks domains file), rel (build release)"
	echo "options: addresses, domains, bodychk, dialups, ip, headers"
fi

#eof