blob: 4278a3a7ad4176042d30624ecbfe44c6c028a680 (
plain)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
#! @SHELL@
#
#
# Copyright 1998 - 2021 Double Precision, Inc. See COPYING for
# distribution information.
#
# Generic wrapper for makedat.
#
# Usage: makedat.sh -src=src -file=file -tmp=tmpfile -hup=hupfile [ -cidr ]
#
# Create [file] from [src]. [src] can be either a plain text file, or a
# directory. [tmpfile] is used. if [hupfile] is specified and it exists,
# this file contains a PID, which is SIGHUPed.
#
# -cidr - [src] contains a list of IP netblocks. Expand entries in [src]
# that use CIDR or start-end notation using the Net::CIDR Perl
# module. Download the Net::CIDR module from
# http://www.cpan.org/authors/id/M/MR/MRSAM/
prefix="@prefix@";
exec_prefix="@exec_prefix@";
srcfile=""
dstfile=""
tmpfile=""
hupfile=""
usage() {
echo "Usage: $0 -src=src -file=file -tmp=tmpfile -hup=hupfile [-cidr]" >&2
exit 1
}
cidr=""
while test $# -gt 0
do
case $1 in
-cidr)
cidr=1
shift
;;
-src=*)
srcfile=`echo "$1" | sed 's/-src=//'`;
shift
;;
-tmp=*)
tmpfile=`echo "$1" | sed 's/-tmp=//'`;
shift
;;
-file=*)
dstfile=`echo "$1" | sed 's/-file=//'`;
shift
;;
-hup=*)
hupfile=`echo "$1" | sed 's/-hup=//'`;
shift
;;
*)
usage
;;
esac
done
if test "$dstfile" = ""
then
usage
fi
if test "$srcfile" = ""
then
usage
fi
if test "$tmpfile" = ""
then
usage
fi
get_access() {
if test -d "$srcfile"
then
if test "$srcfile" != "CVS"
then
find -L "$srcfile" -maxdepth 1 -type f -not -name "*~" -not -regex ".*\.dpkg-[a-z]*" -print |
while read F
do
@CAT@ "$F"
echo
done
fi
else
@CAT@ "$srcfile" || return
echo
fi
echo "."
}
docidr() {
if test "$cidr" = 1
then
@PERL@ -e '
eval "use Net::CIDR;";
while (<>)
{
unless ( $Net::CIDR::VERSION &&
/^([a-fA-F0-9:\.]+[\-\/][a-fA-F0-9:\.]+)\s+(.*)$/)
{
print;
next;
}
my ($net, $line)=($1, $2);
foreach ( Net::CIDR::cidr2octets(
Net::CIDR::range2cidr($net)))
{
print ":" if $net =~ /:/;
print "$_\t$line\n";
}
}
'
else
@CAT@
fi
}
get_access | docidr | @makedatprogpath@ - "$tmpfile" "$dstfile" || exit 1
if test "$hupfile" != ""
then
if test -f $hupfile
then
kill -HUP `cat "$hupfile"`
fi
fi
|