Sync usage with man page.
[netbsd-mini2440.git] / crypto / dist / ipsec-tools / netbsd-import.sh
blobd9a3817030474f5bbe9be195d438d494855123d4
1 #! /bin/sh
3 # $NetBSD: netbsd-import.sh,v 1.2 2005/08/20 00:57:06 manu Exp $
5 # Copyright (c) 2000-2005 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 # netbsd-import: prepare ipsec-tools distribution for import
30 # in the NetBSD tree, under src/crypto/dist/ipsec-tools
31 # Based on bind2netbsd.
33 # Instructions for importing a newer ipsec-tools release:
35 # $ tag=ipsec-tools-0_6-20050224
36 # $ cd /tmp
37 # $ cvs -danoncvs@cvs.sf.net:/cvsroot/ipsec-tools co -r $tag ipsec-tools
38 # $ cd ipsec-tools
39 # $ /usr/src/crypto/dist/ipsec-tools/netbsd-import.sh $tag `pwd` /usr/src
40 # $ cvs -d`whoami`@cvs.netbsd.org:/cvsroot import -m \
41 # "Import ipsec-tools $tag" src/crypto/dist/ipsec-tools \
42 # IPSEC_TOOLS $tag
43 # $ cd /usr/src/lib/libipsec
44 # $ cvs -d`whoami`@cvs.netbsd.org:/cvsroot commit -m \
45 # "update ipsec-tools version" package_version.h
48 test $# -ne 3 && \
49 echo "usage: netbsd-import.sh tag ipsec-tools-src netbsdsrc" && \
50 exit
52 SCRIPTNAME=$0
53 RELEASE=`echo $1|sed 's/^ipsec-tools-//; s/_/\./'`
54 DISTSRC=$2
55 NETBSDSRC=$3
57 ### Remove CVS directories and .cvsignore files
58 find ${DISTSRC} -type d -name CVS -print | while read d ; do \
59 rm -R $d && echo "removed $d" ; \
60 done
61 find ${DISTSRC} -type f -name .cvsignore -print | while read f ; do \
62 rm $f && echo "removed $f" ; \
63 done
65 ### Remove the $'s around RCS tags
66 find ${DISTSRC} -type f -print | \
67 xargs egrep -l '\$(Id|Created|Header)' | while read f; do
68 sed -e 's/\$\(Id.*\) \$/\1/' \
69 -e 's/\$\(Created.*\) \$/\1/' \
70 -e 's/\$\(Header.*\) \$/\1/' \
71 < $f > /tmp/ipsec1f$$ && mv /tmp/ipsec1f$$ $f && \
72 echo "removed \$RCS tag from $f"
73 done
75 ### Add our NetBSD RCS Id
76 find ${DISTSRC} -type f -name '*.[chly]' -print | while read c; do
77 sed 1q < $c | grep -q '\$NetBSD' || (
78 echo "/* \$NetBSD\$ */" >/tmp/ipsec3n$$
79 echo "" >>/tmp/ipsec3n$$
80 cat $c >> /tmp/ipsec3n$$
81 mv /tmp/ipsec3n$$ $c && echo "added NetBSD RCS tag to $c"
83 done
85 find ${DISTSRC} -type f -name '*.[0-9]' -print | while read m; do
86 sed 1q < $m | grep -q '\$NetBSD' || (
87 echo ".\\\" \$NetBSD\$" >/tmp/ipsec2m$$
88 echo ".\\\"" >>/tmp/ipsec2m$$
89 cat $m >> /tmp/ipsec2m$$
90 mv /tmp/ipsec2m$$ $m && echo "added NetBSD RCS tag to $m"
92 done
94 sed " \
95 s/^\(#define TOP_PACKAGE_VERSION \).*/\1 \"${RELEASE}\"/; \
96 s/^\(#define TOP_PACKAGE_STRING \).*/\1 \"ipsec-tools ${RELEASE}\"/;\
97 " ${NETBSDSRC}/lib/libipsec/package_version.h > /tmp/ipsec5
98 mv /tmp/ipsec5 ${NETBSDSRC}/lib/libipsec/package_version.h && \
99 echo "Updated version in lib/libipsec/package_version.h"
101 cp ${SCRIPTNAME} ${DISTSRC} && echo "copied ${SCRIPTNAME} to ${DISTSRC}"
103 echo "done, don't forget to cvs commit src/lib/libipsec/package_version.h"