Changeset 5662 for trunk/scripts
- Timestamp:
- 10/22/07 05:56:42 (14 months ago)
- Files:
-
- 1 modified
-
trunk/scripts/create-licq-tarball.sh (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/create-licq-tarball.sh
r5659 r5662 2 2 # 3 3 # Script to create a source tarball from Licq's svn repository. 4 #5 # Author: Erik Johansson <erik@ejohansson.se>6 4 # Latest version: http://svn.licq.org/svn/trunk/scripts/ 7 # 8 # Usage: ./create-licq-tarball.sh [tardir]9 # [tardir] - optional directory to place tarball in;10 # defaults to current directory5 # 6 # Copyright (c) 2007 Erik Johansson <erijo@licq.org> 7 # Distributed under the terms of the GNU GPL version 2. 8 # 11 9 12 # Where to save the tarball(s) (default: first argument or current dir) 13 TARDIR="${1:-.}" 10 ### DEFAULT SETTINGS ### 11 12 # Where to save the tarball(s) 13 TARDIR="." 14 14 15 15 # What to name the tarball (REV is replaced with the svn revision) … … 19 19 20 20 # Archives to create (1 = create; 0 = don't create) 21 CREATE_GZ= 121 CREATE_GZ=0 22 22 CREATE_BZ2=0 23 23 24 24 # Sign archives using default GPG key (1 = sign; 0 = don't sign) 25 25 SIGN=0 26 27 # What to name the directory in the tarball (REV is replaced with the svn revision)28 DIRNAME="${TARNAME}"29 26 30 27 # What revision to export … … 40 37 ### END SETTINGS ### 41 38 42 #------------------------------------------------------------------# 39 # Prints the usage 40 function usage() 41 { 42 echo "Usage: $0 [-r rev] [-o dir] [-n name] [-g] [-b] [-s]" 43 echo " -h, --help This message" 44 echo " -r rev Create tarball from revision rev (default: ${LICQREV})" 45 echo " -o dir Save tarball in directory dir (default: ${TARDIR})" 46 echo " -n name Name the tarball name (default: ${TARNAME})" 47 echo " REV is replaced with the svn revision" 48 echo " -g, --gzip Create a tar.gz archive" 49 echo " -b, --bzip2 Create a tar.bz archive" 50 echo " -s, --sign Sign archive(s) with default GPG key" 51 } 52 53 if [ $# -eq 0 ]; then 54 echo "$0: Missing required argument (-g and/or -b)" 55 echo "Try \`$0 --help' for more information" 56 exit 2 57 fi 58 59 # Parse command line options 60 args=$(getopt -n "$0" -o h,r:,o:,n:,g,b,s -l help -- $*) 61 if [ $? -ne 0 ]; then 62 echo "" 63 usage 64 exit 1 65 fi 66 67 set -- $args 68 while [ $# -gt 0 ]; do 69 case $1 in 70 -h|--help) usage; exit 0 ;; 71 -r) LICQREV=$(eval echo $2); shift ;; 72 -o) TARDIR=$(eval echo $2); shift ;; 73 -n) TARNAME=$(eval echo $2); shift ;; 74 -g|--gzip) CREATE_GZ=1 ;; 75 -b|--bzip2) CREATE_BZ2=1 ;; 76 -s|--sign) SIGN=1 ;; 77 --) ;; 78 *) echo "$0: unknown option '$1'"; exit 1 ;; 79 esac 80 shift 81 done 82 83 if [ $CREATE_GZ -eq 0 -a $CREATE_BZ2 -eq 0 ]; then 84 echo "$0: You must choose to create a gzip and/or bzip2 archive" 85 echo "" 86 usage 87 exit 1 88 fi 89 90 # Workdir 91 TMPDIR=$(mktemp -d) || failed "mktemp -d" 92 93 # Remove workdir 94 function cleanup() 95 { 96 echo "Removing ${TMPDIR}" 97 rm -rf "${TMPDIR}" 98 } 99 43 100 # Echos "$1 failed" or "failed" and then exits. 44 #------------------------------------------------------------------#45 101 function failed() 46 102 { … … 50 106 echo "$1 failed" 51 107 fi 108 cleanup 52 109 exit 1 53 110 } … … 55 112 SVNREV=$(svn info -r"${LICQREV}" "${REPO}" | grep "^Revision:" | awk '{print $2}') || failed 56 113 57 TMPDIR=$(mktemp -d) || failed "mktemp -d" 58 DIRNAME="${DIRNAME//REV/$SVNREV}" 114 DIRNAME="${TARNAME//REV/$SVNREV}" 59 115 TARNAME="${TARNAME//REV/$SVNREV}" 60 116 LICQDIR="${TMPDIR}/${DIRNAME}" … … 77 133 function makecvs() 78 134 { 79 echo "Running make -f $1/Makefile.cvs"135 echo -n "Running make -f $1/Makefile.cvs... " 80 136 make -C "${LICQDIR}/$1" -f "${LICQDIR}/$1/Makefile.cvs" > /dev/null 2>&1 || failed 81 137 rm -rf "${LICQDIR}/$1/autom4te.cache" 82 138 rm -f "${LICQDIR}/$1/Makefile.cvs" 83 } 84 85 function cleanup() 86 { 87 echo "Removing ${TMPDIR}" 88 rm -rf "${TMPDIR}" 139 echo "done" 89 140 } 90 141
