xref: /netbsd-src/external/bsd/am-utils/amd2netbsd (revision 4da6d876cd9670a0f55b4857d574006fa142db45)
1*4da6d876Schristos#! /bin/sh
2*4da6d876Schristos#
3*4da6d876Schristos#	$NetBSD: amd2netbsd,v 1.1 2015/01/17 17:46:30 christos Exp $
4*4da6d876Schristos#
5*4da6d876Schristos# Copyright (c) 2000 The NetBSD Foundation, Inc.
6*4da6d876Schristos# All rights reserved.
7*4da6d876Schristos#
8*4da6d876Schristos# Redistribution and use in source and binary forms, with or without
9*4da6d876Schristos# modification, are permitted provided that the following conditions
10*4da6d876Schristos# are met:
11*4da6d876Schristos# 1. Redistributions of source code must retain the above copyright
12*4da6d876Schristos#    notice, this list of conditions and the following disclaimer.
13*4da6d876Schristos# 2. Redistributions in binary form must reproduce the above copyright
14*4da6d876Schristos#    notice, this list of conditions and the following disclaimer in the
15*4da6d876Schristos#    documentation and/or other materials provided with the distribution.
16*4da6d876Schristos#
17*4da6d876Schristos# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18*4da6d876Schristos# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19*4da6d876Schristos# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20*4da6d876Schristos# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21*4da6d876Schristos# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22*4da6d876Schristos# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23*4da6d876Schristos# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24*4da6d876Schristos# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25*4da6d876Schristos# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26*4da6d876Schristos# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27*4da6d876Schristos# POSSIBILITY OF SUCH DAMAGE.
28*4da6d876Schristos#
29*4da6d876Schristos# amd2netbsd:  convert an amd source tree into a
30*4da6d876Schristos# netbsd amd source tree, under src/dist,
31*4da6d876Schristos# based on bind2netbsd by Bernd Ernesti and changes by Simon Burge
32*4da6d876Schristos#
33*4da6d876Schristos# Rough instructions for importing new amd release:
34*4da6d876Schristos#
35*4da6d876Schristos#	$ cd /some/where/temporary
36*4da6d876Schristos#	$ tar xpfz /new/amd/release/tar/file
37*4da6d876Schristos#	$ sh /usr/src/external/bsd/am-utils/dist/amd2netbsd am-utils-6.x.y `pwd`
38*4da6d876Schristos#	$ cd src/external/bsd/dist/am-utils
39*4da6d876Schristos#	$ cvs -d cvs.netbsd.org:/cvsroot import -m "Import am-utils 6.x.y" src/external/bsd/am-utils/dist ezk am-utils-6-x-y
40*4da6d876Schristos#	$ cd ../../../am-utils-6.x.y
41*4da6d876Schristos#	$ run ./configure
42*4da6d876Schristos# merge newly generated config.h with /usr/src/usr.sbin/amd/include/config.h
43*4da6d876Schristos# very carefully, since autoconfig seems to be broken (at least in 6.0.4)
44*4da6d876Schristos#	$ cd ..
45*4da6d876Schristos#	$ rm -r src am-utils-6.x.y
46*4da6d876Schristos#	$ cd /usr/src/usr.sbin/amd
47*4da6d876Schristos#	$ cvs commit -m "Updated autoconf generated files for am-utils 6.x.y."
48*4da6d876Schristos#
49*4da6d876Schristos#	- check makefiles to see if any extra sources have been added.
50*4da6d876Schristos#	- update distrib/sets if necessary.
51*4da6d876Schristos
52*4da6d876Schristosif [ $# -ne 2 ]; then echo "amd2netbsd src dest"; exit 1; fi
53*4da6d876Schristos
54*4da6d876Schristosr=$1
55*4da6d876Schristosd=$2/src/external/bsd/am-utils/dist
56*4da6d876Schristos
57*4da6d876Schristoscase "$d" in
58*4da6d876Schristos	/*)
59*4da6d876Schristos		;;
60*4da6d876Schristos	*)
61*4da6d876Schristos		d=`/bin/pwd`/$d
62*4da6d876Schristos		;;
63*4da6d876Schristosesac
64*4da6d876Schristos
65*4da6d876Schristoscase "$r" in
66*4da6d876Schristos	/*)
67*4da6d876Schristos		;;
68*4da6d876Schristos	*)
69*4da6d876Schristos		r=`/bin/pwd`/$r
70*4da6d876Schristos		;;
71*4da6d876Schristosesac
72*4da6d876Schristos
73*4da6d876Schristosecho preparing directory $d
74*4da6d876Schristosrm -rf $d
75*4da6d876Schristosmkdir -p $d
76*4da6d876Schristos
77*4da6d876Schristos### Copy the files and directories
78*4da6d876Schristosecho copying $r to $d
79*4da6d876Schristoscd $r
80*4da6d876Schristospax -rw * $d
81*4da6d876Schristos
82*4da6d876Schristosecho removing unneeded directories and files
83*4da6d876Schristos
84*4da6d876Schristos### Remove unneeded files
85*4da6d876Schristoscd $d
86*4da6d876Schristosrm -f doc/am-utils.dvi doc/am-utils.info* doc/am-utils.ps
87*4da6d876Schristos
88*4da6d876Schristos### Remove the $'s around RCS tags
89*4da6d876Schristoscleantags $d
90*4da6d876Schristos
91*4da6d876Schristos### Add our NetBSD RCS Id
92*4da6d876Schristosfind $d -type f -name '*.[chly]' -print | while read c; do
93*4da6d876Schristos	sed 1q < $c | grep -q '\$NetBSD' || (
94*4da6d876Schristosecho "/*	\$NetBSD\$	*/" >/tmp/amd3n$$
95*4da6d876Schristosecho "" >>/tmp/amd3n$$
96*4da6d876Schristoscat $c  >> /tmp/amd3n$$
97*4da6d876Schristosmv /tmp/amd3n$$ $c && echo added NetBSD RCS tag to $c
98*4da6d876Schristos	)
99*4da6d876Schristosdone
100*4da6d876Schristos
101*4da6d876Schristosfind $d -type f -name '*.[0-9]' -print | while read m; do
102*4da6d876Schristos	sed 1q < $m | grep -q '\$NetBSD' || (
103*4da6d876Schristosecho ".\\\"	\$NetBSD\$" >/tmp/amd2m$$
104*4da6d876Schristosecho ".\\\"" >>/tmp/amd2m$$
105*4da6d876Schristoscat $m >> /tmp/amd2m$$
106*4da6d876Schristosmv /tmp/amd2m$$ $m && echo added NetBSD RCS tag to $m
107*4da6d876Schristos	)
108*4da6d876Schristosdone
109*4da6d876Schristos
110*4da6d876Schristosfind $d -type f -name '*.texi' -print | while read t; do
111*4da6d876Schristos        sed "2 s/^/@c \$NetBSD\$\\
112*4da6d876Schristos/" < $t > /tmp/amd4t$$
113*4da6d876Schristos	mv /tmp/amd4t$$ $t && echo added NetBSD RCS tag to $t
114*4da6d876Schristosdone
115*4da6d876Schristos
116*4da6d876Schristosecho done
117*4da6d876Schristos
118*4da6d876Schristos### Clean up any CVS directories that might be around.
119*4da6d876Schristosecho "cleaning up CVS residue."
120*4da6d876Schristos(
121*4da6d876Schristos	cd $d
122*4da6d876Schristos	find . -type d -name "CVS" -print | xargs rm -r
123*4da6d876Schristos)
124*4da6d876Schristosecho done
125*4da6d876Schristos
126*4da6d876Schristos### Fixing file and directory permissions.
127*4da6d876Schristosecho "Fixing file/directory permissions."
128*4da6d876Schristos(
129*4da6d876Schristos	cd $d
130*4da6d876Schristos	find . -type f -print | xargs chmod u+rw,go+r
131*4da6d876Schristos	find . -type d -print | xargs chmod u+rwx,go+rx
132*4da6d876Schristos)
133*4da6d876Schristosecho done
134*4da6d876Schristos
135*4da6d876Schristosexit 0
136