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