3 # $NetBSD: file2netbsd,v 1.20 2008/08/30 12:18:55 christos Exp $
5 # Copyright (c) 2003 The NetBSD Foundation, Inc.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
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 # file2netbsd: convert a file source tree into a
30 # format suitable for import. Works on current dir.
31 # You can run this only once if you want it to work.
33 # based on texinfo2netbsd
38 echo "Usage $0: <file-version>" 1>&2
44 # (usually) NO NEED TO EDIT BELOW THIS LINE
47 ### Wipe out stuff we don't want
50 ### Remove the $'s around RCS tags
51 find .
-type f
-print |
xargs egrep -l '\$(Id|Date|Header|Log|Revision)'\
53 sed -e 's/\$\(Id.*\) \$/\1/' \
54 -e 's/\$\(Date.*\) \$/\1/' \
55 -e 's/\$\(Header.*\) \$/\1/' \
56 -e 's/\$\(Log.*\) \$/\1/' \
57 -e 's/\$\(Revision.*\) \$/\1/' \
58 $f > /tmp
/file2$$
&& mv /tmp
/file2$$
$f && \
59 echo removed RCS tag from
$f
63 find .
-type f
-name '*.[chly]' -print |
while read c
; do
64 sed -e '1{/$NetBSD/!{i\
68 /#ifndef[ ]lint/{N;/FILE_RCSID/s/\n/\
73 __RCSID("\$NetBSD\$");\
76 mv /tmp
/file3$$
$c && echo did
source mods
for $c
79 #### Move files to proper names
80 mv -f doc
/file.man
doc
/file.1
81 mv -f doc
/libmagic.man
doc
/libmagic
.3
82 mv -f doc
/magic.man
doc
/magic
.5
84 #### Add RCS tags to man pages
85 find .
-type f
-name '*.[0-9]' -print |
while read m
; do
86 sed -e '1{/$NetBSD/!i\
90 }' -e 's/__CSECTION__/1/g' \
91 -e 's/__FSECTION__/5/g' \
92 -e 's/__VERSION__/'"${file_vers}/g" \
93 -e 's,__MAGIC__,/usr/share/misc/magic,g' \
95 mv /tmp
/file4$$
$m && echo did manpage mods
for $m
98 #### de-"capsize" the magdir
99 mv magic
/Magdir magic
/magdir
101 #### Make building easier, don't build magic and doc
107 wq' | ed Makefile.
in > /dev
/null
2>&1
111 echo You can import now. Use the following
command:
112 echo cvs import src
/external
/bsd
/file
/dist CHRISTOS FILE
${file_vers%.*}_
${file_vers#*.}