Fix markup. Fix backslashes to surive roff.
[netbsd-mini2440.git] / dist / ntp / ntp2netbsd
blobea31f13648ae1b78dd1f4330fad43f7aff761693
1 #! /bin/sh
3 # $NetBSD$
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/dist/ntp/ntp2netbsd ntp-4.x.y `pwd`
38 # $ cd src/dist/ntp
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 # $ cp config.h /usr/src/usr.sbin/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/usr.sbin/ntp/scripts
46 # merge possible changes to mkver
47 # our version uses the import date in the file
48 # /usr/src/usr.sbin/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/usr.sbin/ntp
53 # $ cvs commit -m "Updated autoconf generated files for ntp 4.x.y."
55 # - check makefiles to see if any extra sources have been added,
56 # esp. libntp and ntpd.
57 # - check for and remove img tags in html docs.
58 # - update distrib/sets if necessary.
59 # - update src/usr.sbin/ntp/importdate to match the date of this import
61 if [ $# -ne 2 ]; then echo "ntp2netbsd src dest"; exit 1; fi
63 r=$1
64 d=$2/src/dist/ntp
66 case "$d" in
67 /*)
70 d=`/bin/pwd`/$d
72 esac
74 case "$r" in
75 /*)
78 r=`/bin/pwd`/$r
80 esac
82 echo preparing directory $d
83 rm -rf $d
84 mkdir -p $d
86 ### Copy the files and directories
87 echo copying $r to $d
88 cd $r
89 pax -rw * $d
91 echo removing unneeded directories and files
93 ### Remove unneeded directories
94 cd $d
95 rm -r ports html/pic
97 ### Remove .cvsignore
98 find $d -name '.cvsignore*' -exec rm {} \;
100 ### Remove the $'s around RCS tags
101 find $d -type f -print | xargs egrep -l '\$(Id|Created|Header)' | while read f; do
102 sed -e 's/\$\(Id.*\) \$/\1/' \
103 -e 's/\$\(Created.*\) \$/\1/' \
104 -e 's/\$\(Header.*\) \$/\1/' \
105 < $f > /tmp/ntp1f$$ && mv /tmp/ntp1f$$ $f && \
106 echo removed \$RCS tag from $f
107 done
109 ### Add our NetBSD RCS Id
110 find $d -name '*.[chly]' -print | while read c; do
111 sed 1q < $c | grep -q '\$NetBSD' || (
112 echo "/* \$NetBSD\$ */" >/tmp/ntp3n$$
113 echo "" >>/tmp/ntp3n$$
114 cat $c >> /tmp/ntp3n$$
115 mv /tmp/ntp3n$$ $c && echo added NetBSD RCS tag to $c
117 done
119 echo done
121 ### Clean up any CVS directories that might be around.
122 echo "cleaning up CVS residue."
124 cd $d
125 find . -type d -name "CVS" -print | xargs rm -r
127 echo done
129 ### Fixing file and directory permissions.
130 echo "Fixing file/directory permissions."
132 cd $d
133 find . -type f -print | xargs chmod u+rw,go+r
134 find . -type d -print | xargs chmod u+rwx,go+rx
136 echo done
138 exit 0