1#! /bin/sh 2# 3# $NetBSD: ntp2netbsd,v 1.2 2011/10/08 19:28:39 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# 62if [ $# -ne 2 ]; then echo "ntp2netbsd src dest"; exit 1; fi 63 64r=$1 65d=$2/src/external/bsd/ntp/dist 66 67case "$d" in 68 /*) 69 ;; 70 *) 71 d=`/bin/pwd`/$d 72 ;; 73esac 74 75case "$r" in 76 /*) 77 ;; 78 *) 79 r=`/bin/pwd`/$r 80 ;; 81esac 82 83echo preparing directory $d 84rm -rf $d 85mkdir -p $d 86 87### Copy the files and directories 88echo copying $r to $d 89cd $r 90pax -rw * $d 91 92echo removing unneeded directories and files 93 94### Remove unneeded directories 95cd $d 96rm -r ports html/pic 97 98### Remove .cvsignore 99find $d -name '.cvsignore*' -exec rm {} \; 100 101### Remove the $'s around RCS tags 102cleantags $d 103 104### Add our NetBSD RCS Id 105find $d -name '*.[chly]' -print | while read c; do 106 sed 1q < $c | grep -q '\$NetBSD' || ( 107echo "/* \$NetBSD\$ */" >/tmp/ntp3n$$ 108echo "" >>/tmp/ntp3n$$ 109cat $c >> /tmp/ntp3n$$ 110mv /tmp/ntp3n$$ $c && echo added NetBSD RCS tag to $c 111 ) 112done 113 114echo done 115 116### Clean up any CVS directories that might be around. 117echo "cleaning up CVS residue." 118( 119 cd $d 120 find . -type d -name "CVS" -print | xargs rm -r 121) 122echo done 123 124### Fixing file and directory permissions. 125echo "Fixing file/directory permissions." 126( 127 cd $d 128 find . -type f -print | xargs chmod u+rw,go+r 129 find . -type d -print | xargs chmod u+rwx,go+rx 130) 131echo done 132 133exit 0 134