Home | History | Annotate | Line # | Download | only in dist
      1 #! /bin/sh
      2 #
      3 #	$NetBSD: lvm2netbsd,v 1.2 2009/12/02 00:59:19 haad Exp $
      4 #
      5 # Copyright (c) 2003 The NetBSD Foundation, Inc.
      6 # All rights reserved.
      7 #
      8 # Redistribution and use in source and binary forms, with or without
      9 # modification, are permitted provided that the following conditions
     10 # are met:
     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.
     16 #
     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.
     28 #
     29 # lvm2netbsd:  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.
     32 #
     33 # configure.h file in lvm2tools/lib/ was generated with this command
     34 #
     35 # ./configure --with-cluster=none --with-snapshots=internal --with-clvmd=none 
     36 #   --with-lvm1=none --with-cluster=none --disable-readline --enable-o_direct 
     37 #   --disable-udev_sync --enable-devmapper
     38 #
     39 # based on texinfo2netbsd
     40 #
     41 
     42 # edit this
     43 lvm2_vers=$(cat VERSION | cut -d ' ' -f 1)
     44 
     45 import_date=$(date '+%m-%d-%y');
     46 #
     47 # (usually) NO NEED TO EDIT BELOW THIS LINE
     48 #
     49 
     50 ### Wipe out stuff we don't want
     51 rm -f .cvsignore
     52 
     53 echo "Installing header files."
     54 (
     55     cd include/
     56     cp `cat .symlinks | xargs` .;
     57 
     58     cat > version.h <<EOF
     59 #ifndef _LVM_VERSION_H
     60 #define LVM_VERSION "$lvm2_vers-cvs ($import_date)"
     61 #endif
     62 EOF
     63     cd ../
     64 )
     65 echo done
     66 
     67 echo "Adding NetBSD RCS ID tags to lvm2 sources"
     68 
     69 ### Add NetBSD RCS Id
     70 find . -type f -name '*.[chly]' -print | while read c; do
     71 	sed -e '1{/$NetBSD/!{i\
     72 /*	\$NetBSD\$	*/\
     73 
     74 };}
     75 /#ifndef[ 	]lint/{N;/FILE_RCSID/s/\n/\
     76 #if 0\
     77 /
     78 a\
     79 #else\
     80 __RCSID("\$NetBSD\$");\
     81 #endif
     82 }' $c > /tmp/file3$$
     83 mv /tmp/file3$$ $c && echo did source mods for $c
     84 done
     85 
     86 echo "Adding NetBSD RCS ID tags to manual pages"
     87 #### Add RCS tags to man pages
     88 find . -type f -name '*.[0-9].in' -print | while read m; do
     89         base=`basename $m .in`
     90 	sed -e '1{/$NetBSD/!i\
     91 .\\"	\$NetBSD\$\
     92 .\\"
     93 
     94 }'	    -e 's/__CSECTION__/1/g' \
     95 	    -e 's/__FSECTION__/5/g' \
     96 	    -e 's/__VERSION__/'"${file_vers}/g" \
     97 	    -e 's,__MAGIC__,/usr/share/misc/magic,g' \
     98             -e "s/#VERSION#/$lvm2_vers-cvs ($import_date)/" \
     99 	    $m > `dirname $m`/$base && echo did manpage mods for $base
    100 done
    101 
    102 echo done
    103 
    104 ### Clean up any CVS directories that might be around.
    105 echo "cleaning up CVS residue."
    106 (
    107         find . -type d -name "CVS" -print | xargs rm -r
    108 	find . -type f -name ".gitignore" -print | xargs rm -r
    109 	rm -rf config.log
    110 	rm -rf config.status
    111 )
    112 echo done
    113 
    114 
    115 ver=`echo ${lvm2_vers} | sed -e 's/\./-/g'`
    116 echo You can import now.  Use the following command:
    117 echo cvs import src/external/gpl2/lvm2/dist REDHAT LVM${ver}
    118 
    119 exit 0
    120