Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / ntp / ntp2netbsd
blobefe85d37d7788704a471c01e9d9f08ae42c9f277
1 #! /bin/sh
3 # $NetBSD: ntp2netbsd,v 1.9 2008/07/16 20:53:56 kardel 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 # ntp2netbsd: convert a ntp source tree into a
30 # netbsd ntp source tree, under src/dist,
31 # based on bind2netbsd by Bernd Ernesti
33 # Rough instructions for importing new NTP release:
35 # $ cd /some/where/temporary
36 # $ tar xpfz /new/ntp/release/tar/file
37 # $ sh /usr/src/external/bsd/ntp/ntp2netbsd ntp-4.x.y `pwd`
38 # $ cd src/externaä/bsd/ntp/dist
39 # $ cvs import -m "Import ntp 4.x.y" src/dist/ntp UDEL ntp-4-x-y
40 # $ cd ../../../../../ntp-4.x.y
41 # $ run ./configure --enable-all-clocks --enable-parse-clocks
42 # $ echo cp config.h /usr/src/external/bsd/ntp/include
43 # - not really - we have some changed defaults and the vax port has no ieee.h support.
44 # so do a careful diff and patch - Frank Kardel
45 # $ echo cp scripts/mkver /usr/src/external/bsd/ntp/scripts
46 # merge possible changes to mkver
47 # our version uses the import date in the file
48 # /usr/src/external/bsd/ntp/importdate for the date and buildnumber information
49 # to achieve consistent version string over all builds
50 # $ cd ..
51 # $ rm -r src ntp-4.x.y
52 # $ cd /usr/src/external/bsd/ntp
53 # $ cvs update
54 # $ cvs commit -m "Updated autoconf generated files for ntp 4.x.y."
56 # - check makefiles to see if any extra sources have been added,
57 # esp. libntp and ntpd.
58 # - check for and remove img tags in html docs.
59 # - update distrib/sets if necessary.
60 # - update src/external/bsd/ntp/importdate to match the date of this import
62 if [ $# -ne 2 ]; then echo "ntp2netbsd src dest"; exit 1; fi
64 r=$1
65 d=$2/src/external/bsd/ntp/dist
67 case "$d" in
68 /*)
71 d=`/bin/pwd`/$d
73 esac
75 case "$r" in
76 /*)
79 r=`/bin/pwd`/$r
81 esac
83 echo preparing directory $d
84 rm -rf $d
85 mkdir -p $d
87 ### Copy the files and directories
88 echo copying $r to $d
89 cd $r
90 pax -rw * $d
92 echo removing unneeded directories and files
94 ### Remove unneeded directories
95 cd $d
96 rm -r ports html/pic
98 ### Remove .cvsignore
99 find $d -name '.cvsignore*' -exec rm {} \;
101 ### Remove the $'s around RCS tags
102 find $d -type f -print | xargs egrep -l '\$(Id|Created|Header)' | while read f; do
103 sed -e 's/\$\(Id.*\) \$/\1/' \
104 -e 's/\$\(Created.*\) \$/\1/' \
105 -e 's/\$\(Header.*\) \$/\1/' \
106 < $f > /tmp/ntp1f$$ && mv /tmp/ntp1f$$ $f && \
107 echo removed \$RCS tag from $f
108 done
110 ### Add our NetBSD RCS Id
111 find $d -name '*.[chly]' -print | while read c; do
112 sed 1q < $c | grep -q '\$NetBSD' || (
113 echo "/* \$NetBSD\$ */" >/tmp/ntp3n$$
114 echo "" >>/tmp/ntp3n$$
115 cat $c >> /tmp/ntp3n$$
116 mv /tmp/ntp3n$$ $c && echo added NetBSD RCS tag to $c
118 done
120 echo done
122 ### Clean up any CVS directories that might be around.
123 echo "cleaning up CVS residue."
125 cd $d
126 find . -type d -name "CVS" -print | xargs rm -r
128 echo done
130 ### Fixing file and directory permissions.
131 echo "Fixing file/directory permissions."
133 cd $d
134 find . -type f -print | xargs chmod u+rw,go+r
135 find . -type d -print | xargs chmod u+rwx,go+rx
137 echo done
139 exit 0