postfix2netbsd revision 1.3 1 #! /bin/sh
2 #
3 # $NetBSD: postfix2netbsd,v 1.3 2011/10/08 19:28:40 christos Exp $
4 #
5 # Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
6 # All rights reserved.
7 #
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.
16 #
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.
28 #
29 # postfix2netbsd: adds NetBSD tag, removes unnecessary files and
30 # resolve symlinks for importing postfix tree into netbsd.
31 # works on current directory.
32
33 # postfix2netbsd: convert a postfix source tree into a
34 # format suitable for commit. Works on current dir.
35 #
36 # Seed from Wiz's grep2netbsd.
37
38 PROG="$(basename "$0")"
39 if [ -z "$1" -o -n "$2" ]
40 then
41 echo "Usage: $PROG <dir>" 1>&2
42 exit 1
43 fi
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
52
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
60
61 ### Remove the $'s around RCS tags
62 cleantags .
63
64 ### Add our NetBSD RCS Id
65 find . -type f -name '*.[chly]' -print | while read c; do
66 sed 1q < $c | grep -q '\$NetBSD' || (
67 echo "/* \$NetBSD\$ */" >/tmp/postfix3$$
68 echo "" >>/tmp/postfix3$$
69 cat $c >> /tmp/postfix3$$
70 mv /tmp/postfix3$$ $c && echo "added NetBSD RCS tag to $c"
71 )
72 done
73
74 find man -type f -name '*.[0-9]' -print | while read m; do
75 sed 1q < $m | grep -q '\$NetBSD' || (
76 echo ".\\\" \$NetBSD\$" >/tmp/postfix4$$
77 echo ".\\\"" >>/tmp/postfix4$$
78 cat $m >> /tmp/postfix4$$
79 mv /tmp/postfix4$$ $m && echo "added NetBSD RCS tag to $m"
80 )
81 done
82
83 find conf -type f \( -name '*.cf' -o -name 'post*' -o -name 'Makefile*' \) -print | while read t; do
84 grep -q '\$NetBSD' $t && continue
85 sed 1q < $t | grep -q '^\#!'
86 if [ $? -eq 0 ] ; then
87 sed 1q < $t >/tmp/postfix5$$
88 echo "# \$NetBSD\$" >>/tmp/postfix5$$
89 echo "#" >>/tmp/postfix5$$
90 sed "1d" < $t >>/tmp/postfix5$$
91 else
92 echo "# \$NetBSD\$" >/tmp/postfix5$$
93 echo "#" >>/tmp/postfix5$$
94 cat $t >> /tmp/postfix5$$
95 fi
96 mv /tmp/postfix5$$ $t && echo "added NetBSD RCS tag to $t"
97 done
98 echo done
99
100 VERSION=$(sed -n -e 's/^#define MAIL_VERSION_NUMBER.*"\(.*\)".*/\1/p' src/global/mail_version.h | tr . -)
101
102 echo You can import now.
103
104 echo Path: src/external/ibm-public/postfix/dist
105 echo Vendor: VENEMA
106 echo Versiontag: PFIX-${VERSION}
107
108 exit 0
109