Revisão | 9c0b2f6d06898df3f53a90c8f59013c96303c7dd (tree) |
---|---|
Hora | 2004-09-12 00:13:50 |
Autor | pukiwikiadmin <pukiwikiadmin> |
Commiter | pukiwikiadmin |
This commit was manufactured by cvs2svn to create tag 'r1_4_1'.
@@ -0,0 +1,120 @@ | ||
1 | +#!/bin/sh | |
2 | +# $Id: release_update.sh,v 1.5 2004-09-11 15:13:47 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' | |
9 | +# | |
10 | + | |
11 | +# Functions ----------------------------------------------- | |
12 | +warn(){ echo "$*" 1>&2 ; } | |
13 | +err() { warn "Error: $*" ; exit 1 ; } | |
14 | + | |
15 | +usage(){ | |
16 | + warn "USAGE: `basename $0` VERSION_FROM VERSION_TO (VERSION = '1.4.3_rc1' like)" | |
17 | + return 1 | |
18 | +} | |
19 | + | |
20 | +check_versiontag(){ | |
21 | + case "$1" in | |
22 | + [1-9].[0-9] | [1-9].[0-9] ) tag="r$1" ;; | |
23 | + [1-9].[0-9]_rc[1-9] | [1-9].[0-9]_rc[1-9] ) tag="r$1" ;; | |
24 | + [1-9].[0-9].[0-9] | [1-9].[0-9].[0-9][0-9] ) tag="r$1" ;; | |
25 | + [1-9].[0-9].[0-9]_rc[1-9] | [1-9].[0-9].[0-9][0-9]_rc[1-9] ) tag="r$1" ;; | |
26 | + '' ) usage ; return 1 ;; | |
27 | + * ) warn "Error: Invalid string: $1" ; usage ; return 1 ;; | |
28 | + esac | |
29 | + echo "$tag" | tr '.' '_' | |
30 | +} | |
31 | + | |
32 | +# ------------------------------------------- | |
33 | +# Argument check | |
34 | + | |
35 | +rel_from="$1" | |
36 | +rel_to="$2" | |
37 | + | |
38 | +tag_from="` check_versiontag "$rel_from" `" || exit | |
39 | +tag_to="` check_versiontag "$rel_to" `" || exit | |
40 | + | |
41 | +if [ "x$rel_from" = "x$rel_to" ] ; then | |
42 | + warn "Error: VERSION_FROM and VERSION_TO is equivalent" | |
43 | + usage ; exit | |
44 | +fi | |
45 | + | |
46 | +# ------------------------------------------- | |
47 | +# Default | |
48 | + | |
49 | +mod=pukiwiki | |
50 | +CVSROOT=":pserver:anonymous@cvs.sourceforge.jp:/cvsroot/$mod" | |
51 | + | |
52 | +pkg_dir="$mod" | |
53 | + | |
54 | +# ------------------------------------------- | |
55 | + | |
56 | +# Checkout the module with VERSION_FROM | |
57 | +test ! -d "$pkg_dir" || err "There's already a directory: $pkg_dir" | |
58 | +echo cvs -z3 -d "$CVSROOT" co -r "$tag_from" -d "$pkg_dir" "$mod" | |
59 | + cvs -z3 -d "$CVSROOT" co -r "$tag_from" -d "$pkg_dir" "$mod" | |
60 | +test -d "$pkg_dir" || err "There isn't a directory: $pkg_dir" | |
61 | + | |
62 | +# Merge VERSION_FROM to VERSION_TO | |
63 | +( cd "$pkg_dir" | |
64 | + echo cvs up -dP -j "$tag_from" -j "$tag_to" | |
65 | + cvs up -dP -j "$tag_from" -j "$tag_to" | |
66 | + | |
67 | + # Cleanup backup files by cvs | |
68 | + find . -type f -name ".#*" | xargs rm -f | |
69 | +) | |
70 | + | |
71 | +# Remove files those are not Added or Modified | |
72 | +( cd "$pkg_dir" | |
73 | + | |
74 | + find . -type f | grep -v /CVS/ | while read line ; do | |
75 | + result="` cvs -nq up "$line" 2>/dev/null | grep '^[AM] ' | cut -b 3- `" | |
76 | + test "x$result" != "x" || rm -f "$line" | |
77 | + echo -n "." | |
78 | + done | |
79 | + echo | |
80 | +) | |
81 | + | |
82 | +# Remove CVS directories | |
83 | + find "$pkg_dir" -type d -name "CVS" | xargs rm -Rf | |
84 | + | |
85 | +# Remove '.cvsignore' if exists | |
86 | +echo find "$pkg_dir" -type f -name '.cvsignore' -delete | |
87 | + find "$pkg_dir" -type f -name '.cvsignore' -delete | |
88 | + | |
89 | +# Remove emptied directories | |
90 | +find "$pkg_dir" -type d -empty | xargs rmdir | |
91 | +find "$pkg_dir" -type d -empty | xargs rmdir | |
92 | + | |
93 | +# chmod | |
94 | +( cd "$pkg_dir" | |
95 | + | |
96 | + # ALL: Read only | |
97 | + find . -type d | while read line; do | |
98 | + chmod 755 "$line" | |
99 | + done | |
100 | + find . -type f | while read line; do | |
101 | + chmod 644 "$line" | |
102 | + done | |
103 | + | |
104 | + # Add write permission for PukiWiki | |
105 | + chmod 777 attach backup cache counter diff trackback wiki* 2>/dev/null | |
106 | + chmod 666 wiki*/*.txt cache/*.dat 2>/dev/null | |
107 | + | |
108 | +) | |
109 | + | |
110 | +# Tar | |
111 | +echo tar cf - "$pkg_dir" \| gzip -9 \> "update_$rel_to.tar.gz" | |
112 | + tar cf - "$pkg_dir" | gzip -9 > "update_$rel_to.tar.gz" | |
113 | + | |
114 | +# Zip | |
115 | +#echo zip -r9 "update_$rel_to.zip" "$pkg_dir" | |
116 | +# zip -r9 "update_$rel_to.zip" "$pkg_dir" | |
117 | + | |
118 | +#echo rm -Rf "$pkg_dir" | |
119 | +# rm -Rf "$pkg_dir" | |
120 | + |