1#!/bin/sh 2# 3# Copyright (c) 2000 4# Sergey A. Babkin. All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 15# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 16# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 17# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18# 19# Sergey A. Babkin (sab123@hotmail.com, babkin@users.sourceforge.net) 20# 21# 22# Script to create a release or shapshot archive. 23# Also checks for very basic inconsistences. 24# Expects that it would be run from the current directory of chinese-maps, 25# that the ttf2pt1 directory with corresponding version is ../ttf2pt1 26# and that the parent directory is the place to create archives. 27# Expects that the CVS environment variables are set properly. 28 29VER=`grep TTF2PT1_VERSION ../ttf2pt1/version.h | cut -d\" -f2` 30 31case "$1" in 32snapshot) 33 echo "$VER" | egrep '^[0-9][0-9]*\.[0-9].*-CURRENT$' || { 34 echo "mkrel: version.h must contain *-CURRENT to create a snapshot" >&2 35 exit 1 36 } 37 snapdate=`date "+ %y %m %d " | sed 's/ \([0-9]\) / 0& /g;s/ //g'` 38 NEWVER=`echo "$VER" | sed "s/-CURRENT/-SNAP-$snapdate/"` 39 TAG="-D tomorrow" 40 ;; 41release) 42 echo "$VER" | egrep '^[0-9][0-9]*\.[0-9][.0-9]*$' || { 43 echo "mkrel: version.h must not be -CURRENT to create a release" >&2 44 exit 1 45 } 46 NEWVER="$VER" 47 TAG=`echo "-r ttf2pt1-$VER" | sed \ 48 's/\(-[0-9][0-9]*\.[0-9]\)$/&.0/;s/\./-/g'` 49 ;; 50*) 51 echo "use: mkrel [snapshot|release]" >&2 52 exit 1 53 ;; 54esac 55 56cd .. || { 57 echo "mkrel: can't cd to .." >&2 58 exit 1 59} 60 61rm -f ttf2pt1-chinese-$NEWVER.tgz ttf2pt1-chinese-$NEWVER.zip 62rm -rf ttf2pt1-chinese-$NEWVER 63 64echo "cvs -z9 export $TAG -d ttf2pt1-chinese-$NEWVER chinese-maps" 65cvs -z9 export $TAG -d ttf2pt1-chinese-$NEWVER chinese-maps || { 66 echo "mkrel: unable to export from CVS" >&2 67 echo "mkrel: check that the CVS tree is properly tagged" >&2 68 exit 1 69} 70 71 72tar czvf ttf2pt1-chinese-$NEWVER.tgz ttf2pt1-chinese-$NEWVER || { 73 echo "mkrel: can't create .tgz archive" >&2 74 exit 1 75} 76 77zip -u -r ttf2pt1-chinese-$NEWVER.zip ttf2pt1-chinese-$NEWVER || { 78 echo "mkrel: can't create .zip archive" >&2 79 exit 1 80} 81