1 1.1 haad #! /bin/sh 2 1.1 haad # 3 1.2 haad # $NetBSD: lvm2netbsd,v 1.2 2009/12/02 00:59:19 haad Exp $ 4 1.1 haad # 5 1.1 haad # Copyright (c) 2003 The NetBSD Foundation, Inc. 6 1.1 haad # All rights reserved. 7 1.1 haad # 8 1.1 haad # Redistribution and use in source and binary forms, with or without 9 1.1 haad # modification, are permitted provided that the following conditions 10 1.1 haad # are met: 11 1.1 haad # 1. Redistributions of source code must retain the above copyright 12 1.1 haad # notice, this list of conditions and the following disclaimer. 13 1.1 haad # 2. Redistributions in binary form must reproduce the above copyright 14 1.1 haad # notice, this list of conditions and the following disclaimer in the 15 1.1 haad # documentation and/or other materials provided with the distribution. 16 1.1 haad # 17 1.1 haad # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18 1.1 haad # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 1.1 haad # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 1.1 haad # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 1.1 haad # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 1.1 haad # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 1.1 haad # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 1.1 haad # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 1.1 haad # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 1.1 haad # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 1.1 haad # POSSIBILITY OF SUCH DAMAGE. 28 1.1 haad # 29 1.1 haad # lvm2netbsd: convert a file source tree into a 30 1.1 haad # format suitable for import. Works on current dir. 31 1.1 haad # You can run this only once if you want it to work. 32 1.1 haad # 33 1.1 haad # configure.h file in lvm2tools/lib/ was generated with this command 34 1.1 haad # 35 1.1 haad # ./configure --with-cluster=none --with-snapshots=internal --with-clvmd=none 36 1.1 haad # --with-lvm1=none --with-cluster=none --disable-readline --enable-o_direct 37 1.2 haad # --disable-udev_sync --enable-devmapper 38 1.1 haad # 39 1.1 haad # based on texinfo2netbsd 40 1.1 haad # 41 1.1 haad 42 1.1 haad # edit this 43 1.2 haad lvm2_vers=$(cat VERSION | cut -d ' ' -f 1) 44 1.1 haad 45 1.2 haad import_date=$(date '+%m-%d-%y'); 46 1.1 haad # 47 1.1 haad # (usually) NO NEED TO EDIT BELOW THIS LINE 48 1.1 haad # 49 1.1 haad 50 1.1 haad ### Wipe out stuff we don't want 51 1.1 haad rm -f .cvsignore 52 1.1 haad 53 1.1 haad echo "Installing header files." 54 1.1 haad ( 55 1.1 haad cd include/ 56 1.1 haad cp `cat .symlinks | xargs` .; 57 1.1 haad 58 1.1 haad cat > version.h <<EOF 59 1.1 haad #ifndef _LVM_VERSION_H 60 1.1 haad #define LVM_VERSION "$lvm2_vers-cvs ($import_date)" 61 1.1 haad #endif 62 1.1 haad EOF 63 1.1 haad cd ../ 64 1.1 haad ) 65 1.1 haad echo done 66 1.1 haad 67 1.1 haad echo "Adding NetBSD RCS ID tags to lvm2 sources" 68 1.1 haad 69 1.1 haad ### Add NetBSD RCS Id 70 1.1 haad find . -type f -name '*.[chly]' -print | while read c; do 71 1.1 haad sed -e '1{/$NetBSD/!{i\ 72 1.1 haad /* \$NetBSD\$ */\ 73 1.1 haad 74 1.1 haad };} 75 1.1 haad /#ifndef[ ]lint/{N;/FILE_RCSID/s/\n/\ 76 1.1 haad #if 0\ 77 1.1 haad / 78 1.1 haad a\ 79 1.1 haad #else\ 80 1.1 haad __RCSID("\$NetBSD\$");\ 81 1.1 haad #endif 82 1.1 haad }' $c > /tmp/file3$$ 83 1.1 haad mv /tmp/file3$$ $c && echo did source mods for $c 84 1.1 haad done 85 1.1 haad 86 1.1 haad echo "Adding NetBSD RCS ID tags to manual pages" 87 1.1 haad #### Add RCS tags to man pages 88 1.1 haad find . -type f -name '*.[0-9].in' -print | while read m; do 89 1.1 haad base=`basename $m .in` 90 1.1 haad sed -e '1{/$NetBSD/!i\ 91 1.1 haad .\\" \$NetBSD\$\ 92 1.1 haad .\\" 93 1.1 haad 94 1.1 haad }' -e 's/__CSECTION__/1/g' \ 95 1.1 haad -e 's/__FSECTION__/5/g' \ 96 1.1 haad -e 's/__VERSION__/'"${file_vers}/g" \ 97 1.1 haad -e 's,__MAGIC__,/usr/share/misc/magic,g' \ 98 1.1 haad -e "s/#VERSION#/$lvm2_vers-cvs ($import_date)/" \ 99 1.1 haad $m > `dirname $m`/$base && echo did manpage mods for $base 100 1.1 haad done 101 1.1 haad 102 1.1 haad echo done 103 1.1 haad 104 1.1 haad ### Clean up any CVS directories that might be around. 105 1.1 haad echo "cleaning up CVS residue." 106 1.1 haad ( 107 1.1 haad find . -type d -name "CVS" -print | xargs rm -r 108 1.1 haad find . -type f -name ".gitignore" -print | xargs rm -r 109 1.2 haad rm -rf config.log 110 1.2 haad rm -rf config.status 111 1.1 haad ) 112 1.1 haad echo done 113 1.1 haad 114 1.1 haad 115 1.1 haad ver=`echo ${lvm2_vers} | sed -e 's/\./-/g'` 116 1.1 haad echo You can import now. Use the following command: 117 1.1 haad echo cvs import src/external/gpl2/lvm2/dist REDHAT LVM${ver} 118 1.1 haad 119 1.1 haad exit 0 120