2 # $Id: release.sh,v 1.9 2004/10/18 14:31:15 henoheno Exp $
3 # $CVSKNIT_Id: release.sh,v 1.11 2004/05/28 14:26:24 henoheno Exp $
4 # Release automation script for PukiWiki
5 # ==========================================================
6 Copyright='(C) 2002-2004 minix-up project, All Rights Reserved'
7 Homepage='http://cvsknit.sourceforge.net/'
8 License='BSD Licnese, NO WARRANTY'
11 # Name and Usage --------------------------------------------
12 _name="` basename $0 `"
15 trace 'usage()' || return # (DEBUG)
16 warn "Usage: $_name VERSION_TAG (1.4.3_rc1 like)"
20 # Common functions ------------------------------------------
21 warn(){ echo "$*" 1>&2 ; }
22 err() { warn "Error: $*" ; exit 1 ; }
25 test $# -gt 0 && { echo -n "\"$1\"" ; shift ; }
26 while [ $# -gt 0 ] ; do echo -n " \"$1\"" ; shift ; done ; echo
30 test "$__debug" || return 0 # (DEBUG)
31 _msg="$1" ; test $# -gt 0 && shift ; warn " $_msg : ` quote "$@" `"
34 # Default variables -----------------------------------------
38 CVSROOT=":pserver:anonymous@cvs.sourceforge.jp:/cvsroot/$mod"
40 # Function verifying arguments ------------------------------
43 trace 'getopt()' "$@" # (DEBUG)
47 -[hH]|--help ) echo _help _exit ;;
48 --debug ) echo _debug ;;
50 -d ) echo _CVSROOT 2 ; _arg="$2" ;;
51 -* ) warn "Error: Unknown option \"$1\"" ; return 1 ;;
58 # Working start ---------------------------------------------
60 # Show arguments in one line (DEBUG)
61 case '--debug' in "$1"|"$3") false ;; * ) true ;; esac || {
62 test 'x--debug' = "x$1" && shift ; __debug=on ; trace 'Args ' "$@"
66 while [ $# -gt 0 ] ; do
67 chs="` getopt "$@" `" || err "Syntax error with '$1'"
68 trace '$chs ' "$chs" # (DEBUG)
76 _CVSROOT) CVSROOT="$2" ;;
78 _* ) shift ; eval "_$ch"=on ;;
85 if [ $# -eq 0 ] ; then usage ; exit ; fi
87 # Archiver check --------------------------------------------
97 # Argument check --------------------------------------------
100 pkg_dir="${mod}-${rel}"
102 [1-9].[0-9] | [1-9].[0-9] ) tag="r$rel" ;;
103 [1-9].[0-9]_rc[1-9] | [1-9].[0-9]_rc[1-9] ) tag="r$rel" ;;
104 [1-9].[0-9].[0-9] | [1-9].[0-9].[0-9][0-9] ) tag="r$rel" ;;
105 [1-9].[0-9].[0-9]_[a-z]* | [1-9].[0-9].[0-9][0-9]_[a-z]* ) tag="r$rel" ;;
108 tag="` echo "$tag" | tr '.' '_' `"
110 # Export the module -----------------------------------------
112 test ! -d "$pkg_dir" || err "There's already a directory: $pkg_dir"
114 echo cvs -z3 -d "$CVSROOT" -q export -r "$tag" -d "$pkg_dir" "$mod"
115 cvs -z3 -d "$CVSROOT" -q export -r "$tag" -d "$pkg_dir" "$mod"
117 test -d "$pkg_dir" || err "There is'nt a directory: $pkg_dir"
119 # Remove '.cvsignore' if exists -----------------------------
120 echo find "$pkg_dir" -type f -name '.cvsignore' -delete
121 find "$pkg_dir" -type f -name '.cvsignore' -delete
123 # chmod -----------------------------------------------------
127 find . -type d | while read line; do
130 find . -type f | while read line; do
134 # Add write permission for PukiWiki
135 chmod 777 attach backup cache counter diff trackback wiki*
136 chmod 666 wiki*/*.txt cache/*.dat
139 # Compress --------------------------------------------------
145 then tar cf - "$target" | gzip -9 > "$target".tgz
146 else zip -r9 "$target.zip" "$target"
152 then gzip -9 *.en.txt
154 for list in *.en.txt ; do
155 zip -9 "$list".zip "$list"
164 echo tar cf - "$pkg_dir" \| gzip -9 \> "$pkg_dir.tar.gz"
165 tar cf - "$pkg_dir" | gzip -9 > "$pkg_dir.tar.gz"
168 echo zip -r9 "$pkg_dir.zip" "$pkg_dir"
169 zip -r9 "$pkg_dir.zip" "$pkg_dir"