xref: /netbsd-src/external/bsd/nvi/nvi2netbsd (revision 4391d5e9d4f291db41e3b3ba26a01b5e51364aae)
1*4391d5e9Schristos#! /bin/sh
2*4391d5e9Schristos#
3*4391d5e9Schristos#	$NetBSD: nvi2netbsd,v 1.1 2013/11/22 16:00:45 christos Exp $
4*4391d5e9Schristos#
5*4391d5e9Schristos# Copyright (c) 2000 The NetBSD Foundation, Inc.
6*4391d5e9Schristos# All rights reserved.
7*4391d5e9Schristos#
8*4391d5e9Schristos# Redistribution and use in source and binary forms, with or without
9*4391d5e9Schristos# modification, are permitted provided that the following conditions
10*4391d5e9Schristos# are met:
11*4391d5e9Schristos# 1. Redistributions of source code must retain the above copyright
12*4391d5e9Schristos#    notice, this list of conditions and the following disclaimer.
13*4391d5e9Schristos# 2. Redistributions in binary form must reproduce the above copyright
14*4391d5e9Schristos#    notice, this list of conditions and the following disclaimer in the
15*4391d5e9Schristos#    documentation and/or other materials provided with the distribution.
16*4391d5e9Schristos#
17*4391d5e9Schristos# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18*4391d5e9Schristos# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19*4391d5e9Schristos# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20*4391d5e9Schristos# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21*4391d5e9Schristos# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22*4391d5e9Schristos# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23*4391d5e9Schristos# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24*4391d5e9Schristos# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25*4391d5e9Schristos# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26*4391d5e9Schristos# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27*4391d5e9Schristos# POSSIBILITY OF SUCH DAMAGE.
28*4391d5e9Schristos#
29*4391d5e9Schristos# based on amd2netbsd,
30*4391d5e9Schristos# itself based on bind2netbsd by Bernd Ernesti and changes by Simon Burge
31*4391d5e9Schristos#
32*4391d5e9Schristos# Rough instructions for importing new nvi release:
33*4391d5e9Schristos#
34*4391d5e9Schristos#	$ cd /some/where/temporary
35*4391d5e9Schristos#	$ tar xpfz /new/nvi/release/tar/file
36*4391d5e9Schristos#	$ sh /usr/src/external/bsd/nvi/nvi2netbsd nvi-x.y.z `pwd`
37*4391d5e9Schristos#	$ cd src/external/bsd/nvi/dist
38*4391d5e9Schristos#	$ cvs import -m "Import nvi x.y.z" src/external/bsd/nvi/dist NVI nvi-x-y-z
39*4391d5e9Schristos#	$ cd ../../../nvi/build.unix
40*4391d5e9Schristos#	$ run ../dist/configure --with-db_type=db1 --enable-widechar
41*4391d5e9Schristos#	... to be continued
42*4391d5e9Schristos#
43*4391d5e9Schristos
44*4391d5e9Schristosif [ $# -ne 2 ]; then echo "nvi2netbsd src dest"; exit 1; fi
45*4391d5e9Schristos
46*4391d5e9Schristosr="$1"
47*4391d5e9Schristosd="$2"/src/external/bsd/nvi/dist
48*4391d5e9Schristos
49*4391d5e9Schristoscase "$d" in
50*4391d5e9Schristos	/*)
51*4391d5e9Schristos		;;
52*4391d5e9Schristos	*)
53*4391d5e9Schristos		d="`/bin/pwd`/$d"
54*4391d5e9Schristos		;;
55*4391d5e9Schristosesac
56*4391d5e9Schristos
57*4391d5e9Schristoscase "$r" in
58*4391d5e9Schristos	/*)
59*4391d5e9Schristos		;;
60*4391d5e9Schristos	*)
61*4391d5e9Schristos		r="`/bin/pwd`/$r"
62*4391d5e9Schristos		;;
63*4391d5e9Schristosesac
64*4391d5e9Schristos
65*4391d5e9Schristosecho preparing directory "$d"
66*4391d5e9Schristosrm -rf "$d"
67*4391d5e9Schristosmkdir -p "$d"
68*4391d5e9Schristos
69*4391d5e9Schristos### Copy the files and directories
70*4391d5e9Schristosecho copying "$r" to "$d"
71*4391d5e9Schristoscd "$r"
72*4391d5e9Schristospax -rw * "$d"
73*4391d5e9Schristos
74*4391d5e9Schristosecho removing unneeded directories and files
75*4391d5e9Schristos
76*4391d5e9Schristos### Remove unneeded files
77*4391d5e9Schristoscd "$d"
78*4391d5e9Schristosrm -f catalog/english.base		# we generate it
79*4391d5e9Schristosrm -fr dist/autom4te.cache
80*4391d5e9Schristosrm -f dist/tags
81*4391d5e9Schristosrm -fr docs/html
82*4391d5e9Schristosrm -f docs/*/*.ps docs/*/grohtml* docs/*/*.0 docs/*/*.txt
83*4391d5e9Schristosrm -f common/options_def.h		# must be removed: we generate it
84*4391d5e9Schristosrm -fr include compat db.1.85
85*4391d5e9Schristosrm -fr .git
86*4391d5e9Schristos
87*4391d5e9Schristoscd catalog
88*4391d5e9Schristosfor f in *.base; do
89*4391d5e9Schristos	f2="`echo "$f" | sed -e 's/\.base$//'`"
90*4391d5e9Schristos	rm -f "$f2" "$f2".check
91*4391d5e9Schristosdone
92*4391d5e9Schristos
93*4391d5e9Schristoscleantags "$d"
94*4391d5e9Schristos
95*4391d5e9Schristos### Clean up any CVS directories that might be around.
96*4391d5e9Schristosecho "cleaning up CVS residue."
97*4391d5e9Schristos(
98*4391d5e9Schristos	cd "$d"
99*4391d5e9Schristos	find . -type d -name "CVS" -print | xargs rm -r
100*4391d5e9Schristos)
101*4391d5e9Schristosecho done
102*4391d5e9Schristos
103*4391d5e9Schristos### Fixing file and directory permissions.
104*4391d5e9Schristosecho "Fixing file/directory permissions."
105*4391d5e9Schristos(
106*4391d5e9Schristos	cd "$d"
107*4391d5e9Schristos	find . -type f -print | xargs chmod u+rw,go+r
108*4391d5e9Schristos	find . -type d -print | xargs chmod u+rwx,go+rx
109*4391d5e9Schristos)
110*4391d5e9Schristosecho done
111*4391d5e9Schristos
112*4391d5e9Schristosexit 0
113