Sync usage with man page.
[netbsd-mini2440.git] / external / ibm-public / postfix / postfix2netbsd
blob94124139b8ceb6eabdc84870559bb6f1fa1733d5
1 #! /bin/sh
3 # $NetBSD: postfix2netbsd,v 1.14 2009/06/22 22:32:44 christos Exp $
5 # Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
6 # All rights reserved.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
17 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
29 # postfix2netbsd: adds NetBSD tag, removes unnecessary files and
30 # resolve symlinks for importing postfix tree into netbsd.
31 # works on current directory.
33 # postfix2netbsd: convert a postfix source tree into a
34 # format suitable for commit. Works on current dir.
36 # Seed from Wiz's grep2netbsd.
38 PROG="$(basename "$0")"
39 if [ -z "$1" -o -n "$2" ]
40 then
41 echo "Usage: $PROG <dir>" 1>&2
42 exit 1
44 cd "$1"
45 # delete some superfluous files
46 echo deleting some superfluous files
47 find . \( -type f -o -type l \) -a \
48 \( -name .indent.pro -o -name .printfck -o -name .keep \) \
49 -exec rm {} \;
50 rm -rf bin include lib libexec man/cat? auxiliary
51 echo done
53 ### ditch symlinks
54 find . -type l | while read t; do
55 cp $t /tmp/postfix7$$
56 rm -f $t
57 mv /tmp/postfix7$$ $t
58 echo "resolved symlink $t"
59 done
61 ### Remove the $'s around RCS tags
62 find . -type f -print | xargs egrep -l '\$(Id|Created|Header|Revision|Source)' | while read f; do
63 sed -e 's/\$\(Id.*\) ?\$/\1/' \
64 -e 's/\$\(Created.*\) \$/\1/' \
65 -e 's/\$\(Header.*\) \$/\1/' \
66 -e 's/\$\(Revision.*\) ?\$/\1/' \
67 -e 's/\$\(Source.*\) ?\$/\1/' \
68 $f > /tmp/postfix2$$ && mv /tmp/postfix2$$ $f && \
69 echo "removed RCS tag from $f"
70 done
72 ### Add our NetBSD RCS Id
73 find . -type f -name '*.[chly]' -print | while read c; do
74 sed 1q < $c | grep -q '\$NetBSD' || (
75 echo "/* \$NetBSD\$ */" >/tmp/postfix3$$
76 echo "" >>/tmp/postfix3$$
77 cat $c >> /tmp/postfix3$$
78 mv /tmp/postfix3$$ $c && echo "added NetBSD RCS tag to $c"
80 done
82 find man -type f -name '*.[0-9]' -print | while read m; do
83 sed 1q < $m | grep -q '\$NetBSD' || (
84 echo ".\\\" \$NetBSD\$" >/tmp/postfix4$$
85 echo ".\\\"" >>/tmp/postfix4$$
86 cat $m >> /tmp/postfix4$$
87 mv /tmp/postfix4$$ $m && echo "added NetBSD RCS tag to $m"
89 done
91 find conf -type f \( -name '*.cf' -o -name 'post*' -o -name 'Makefile*' \) -print | while read t; do
92 grep -q '\$NetBSD' $t && continue
93 sed 1q < $t | grep -q '^\#!'
94 if [ $? -eq 0 ] ; then
95 sed 1q < $t >/tmp/postfix5$$
96 echo "# \$NetBSD\$" >>/tmp/postfix5$$
97 echo "#" >>/tmp/postfix5$$
98 sed "1d" < $t >>/tmp/postfix5$$
99 else
100 echo "# \$NetBSD\$" >/tmp/postfix5$$
101 echo "#" >>/tmp/postfix5$$
102 cat $t >> /tmp/postfix5$$
104 mv /tmp/postfix5$$ $t && echo "added NetBSD RCS tag to $t"
105 done
106 echo done
108 echo You can import now.
110 echo Path: src/external/ibm-public/postfix/dist
111 echo Vendor: VENEMA
112 echo Versiontag: PFIX-X-Y-Z
114 exit 0