xref: /netbsd-src/external/bsd/ntp/ntp2netbsd (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1#! /bin/sh
2#
3#	$NetBSD: ntp2netbsd,v 1.4 2013/12/28 03:29:46 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# ntp2netbsd:  convert a ntp source tree into a
30# netbsd ntp source tree, under src/dist,
31# based on bind2netbsd by Bernd Ernesti
32#
33# Rough instructions for importing new NTP release:
34#
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/external/bsd/ntp/dist
39#	$ cvs import -m "Import ntp 4.x.y" src/external/bsd/ntp/dist 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."
55#
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
61#	- build in the original distribution directory, then copy all the
62#	  generated man pages in the respective program directories
63#
64if [ $# -ne 2 ]; then echo "ntp2netbsd src dest"; exit 1; fi
65
66r=$1
67d=$2/src/external/bsd/ntp/dist
68
69case "$d" in
70	/*)
71		;;
72	*)
73		d=`/bin/pwd`/$d
74		;;
75esac
76
77case "$r" in
78	/*)
79		;;
80	*)
81		r=`/bin/pwd`/$r
82		;;
83esac
84
85echo preparing directory $d
86rm -rf $d
87mkdir -p $d
88
89### Copy the files and directories
90echo copying $r to $d
91cd $r
92pax -rw * $d
93
94echo removing unneeded directories and files
95
96### Remove unneeded directories
97cd $d
98rm -r ports html/pic
99
100### Remove .cvsignore
101find $d -name '.cvsignore*' -exec rm {} \;
102
103### Remove the $'s around RCS tags
104cleantags $d
105
106### Add our NetBSD RCS Id
107find $d -name '*.[chly]' -print | while read c; do
108	sed 1q < $c | grep -q '\$NetBSD' || (
109echo "/*	\$NetBSD\$	*/" >/tmp/ntp3n$$
110echo "" >>/tmp/ntp3n$$
111cat $c  >> /tmp/ntp3n$$
112mv /tmp/ntp3n$$ $c && echo added NetBSD RCS tag to $c
113	)
114done
115
116echo done
117
118### Clean up any CVS directories that might be around.
119echo "cleaning up CVS residue."
120(
121	cd $d
122	find . -type d -name "CVS" -print | xargs rm -r
123)
124echo done
125
126### Fixing file and directory permissions.
127echo "Fixing file/directory permissions."
128(
129	cd $d
130	find . -type f -print | xargs chmod u+rw,go+r
131	find . -type d -print | xargs chmod u+rwx,go+rx
132)
133echo done
134
135exit 0
136