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