Home | History | Annotate | Line # | Download | only in bzip2
      1  1.1  wiz #! /bin/sh
      2  1.1  wiz #
      3  1.1  wiz #	$NetBSD: bzip2netbsd,v 1.1 2012/05/07 08:55:46 wiz Exp $
      4  1.1  wiz #
      5  1.1  wiz # Copyright (c) 1998, 1999, 2001, 2012 The NetBSD Foundation, Inc.
      6  1.1  wiz # All rights reserved.
      7  1.1  wiz #
      8  1.1  wiz # Redistribution and use in source and binary forms, with or without
      9  1.1  wiz # modification, are permitted provided that the following conditions
     10  1.1  wiz # are met:
     11  1.1  wiz # 1. Redistributions of source code must retain the above copyright
     12  1.1  wiz #    notice, this list of conditions and the following disclaimer.
     13  1.1  wiz # 2. Redistributions in binary form must reproduce the above copyright
     14  1.1  wiz #    notice, this list of conditions and the following disclaimer in the
     15  1.1  wiz #    documentation and/or other materials provided with the distribution.
     16  1.1  wiz #
     17  1.1  wiz # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     18  1.1  wiz # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     19  1.1  wiz # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20  1.1  wiz # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     21  1.1  wiz # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22  1.1  wiz # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23  1.1  wiz # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  1.1  wiz # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25  1.1  wiz # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26  1.1  wiz # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     27  1.1  wiz # POSSIBILITY OF SUCH DAMAGE.
     28  1.1  wiz #
     29  1.1  wiz # bzip2netbsd:  convert a bzip2 source tree into a
     30  1.1  wiz # netbsd bzip2 source tree, under src/external/bsd/dist,
     31  1.1  wiz # based on the other *2netbsd scripts in the NetBSD source tree
     32  1.1  wiz #
     33  1.1  wiz # Rough instructions for importing new bzip2 release:
     34  1.1  wiz #
     35  1.1  wiz #	$ cd /some/where/temporary
     36  1.1  wiz #	$ tar xpfz /new/bzip2/release/tar/file
     37  1.1  wiz #	$ sh /usr/src/external/bsd/bzip2/bzip2netbsd bzip2-1.x.y `pwd`
     38  1.1  wiz #	$ cd src/external/bsd/bzip2/dist
     39  1.1  wiz #	$ cvs import -m "Import bzip2 1.x.y" src/external/bsd/bzip2/dist JSEWARD bzip2-1-x-y
     40  1.1  wiz #	$ cd ../../../../..
     41  1.1  wiz #	$ rm -r src bzip2-1.x.y
     42  1.1  wiz #
     43  1.1  wiz #	- check makefiles to see if any extra sources have been added.
     44  1.1  wiz #	- update distrib/sets if necessary.
     45  1.1  wiz 
     46  1.1  wiz if [ $# -ne 2 ]; then echo "bzip2netbsd src dest"; exit 1; fi
     47  1.1  wiz 
     48  1.1  wiz r=$1
     49  1.1  wiz d=$2/src/external/bsd/bzip2/dist
     50  1.1  wiz 
     51  1.1  wiz case "$d" in
     52  1.1  wiz 	/*)
     53  1.1  wiz 		;;
     54  1.1  wiz 	*)
     55  1.1  wiz 		d=`/bin/pwd`/$d
     56  1.1  wiz 		;;
     57  1.1  wiz esac
     58  1.1  wiz 
     59  1.1  wiz case "$r" in
     60  1.1  wiz 	/*)
     61  1.1  wiz 		;;
     62  1.1  wiz 	*)
     63  1.1  wiz 		r=`/bin/pwd`/$r
     64  1.1  wiz 		;;
     65  1.1  wiz esac
     66  1.1  wiz 
     67  1.1  wiz echo preparing directory $d
     68  1.1  wiz rm -rf $d
     69  1.1  wiz mkdir -p $d
     70  1.1  wiz 
     71  1.1  wiz ### Copy the files and directories
     72  1.1  wiz echo copying $r to $d
     73  1.1  wiz cd $r
     74  1.1  wiz pax -rw * $d
     75  1.1  wiz 
     76  1.1  wiz # cd to import directory
     77  1.1  wiz cd $d
     78  1.1  wiz 
     79  1.1  wiz ### delete formatted manual pages
     80  1.1  wiz echo removing unneeded directories and files
     81  1.1  wiz rm -f bzip2.1.preformatted bzip2.txt
     82  1.1  wiz 
     83  1.1  wiz ### bzip2 distribution doesn't have RCS/CVS tags (!).
     84  1.1  wiz 
     85  1.1  wiz ### Add our NetBSD RCS Id
     86  1.1  wiz find $d -type f -name '*.[chly]' -print | while read c; do
     87  1.1  wiz 	sed 1q < $c | grep -q '\$NetBSD' || (
     88  1.1  wiz echo "/*	\$NetBSD\$	*/" >/tmp/bzip3n$$
     89  1.1  wiz echo "" >>/tmp/bzip3n$$
     90  1.1  wiz cat $c  >> /tmp/bzip3n$$
     91  1.1  wiz mv /tmp/bzip3n$$ $c && echo added NetBSD RCS tag to $c
     92  1.1  wiz 	)
     93  1.1  wiz done
     94  1.1  wiz 
     95  1.1  wiz find $d -type f -name '*.[0-9]' -print | while read m; do
     96  1.1  wiz 	sed 1q < $m | grep -q '\$NetBSD' || (
     97  1.1  wiz echo ".\\\"	\$NetBSD\$" >/tmp/bzip2m$$
     98  1.1  wiz echo ".\\\"" >>/tmp/bzip2m$$
     99  1.1  wiz cat $m >> /tmp/bzip2m$$
    100  1.1  wiz mv /tmp/bzip2m$$ $m && echo added NetBSD RCS tag to $m
    101  1.1  wiz 	)
    102  1.1  wiz done
    103  1.1  wiz 
    104  1.1  wiz echo done
    105  1.1  wiz 
    106  1.1  wiz ### Clean up any CVS directories that might be around.
    107  1.1  wiz echo "cleaning up CVS residue."
    108  1.1  wiz (
    109  1.1  wiz 	cd $d
    110  1.1  wiz 	find . -type d -name "CVS" -print | xargs rm -r
    111  1.1  wiz )
    112  1.1  wiz echo done
    113  1.1  wiz 
    114  1.1  wiz ### Fixing file and directory permissions.
    115  1.1  wiz echo "Fixing file/directory permissions."
    116  1.1  wiz (
    117  1.1  wiz 	cd $d
    118  1.1  wiz 	find . -type f -print | xargs chmod u+rw,go+r
    119  1.1  wiz 	find . -type d -print | xargs chmod u+rwx,go+rx
    120  1.1  wiz )
    121  1.1  wiz echo done
    122  1.1  wiz 
    123  1.1  wiz exit 0
    124