修订版 | 68f87aee78ecc24672ccc27c553c04c529356de2 (tree) |
---|---|
时间 | 2006-05-15 23:47:43 |
作者 | pukiwikiadmin <pukiwikiadmin> |
Commiter | pukiwikiadmin |
This commit was manufactured by cvs2svn to create tag 'r1_4_7_rc1'.
@@ -1,147 +0,0 @@ | ||
1 | -#!/usr/local/bin/php | |
2 | -<?php | |
3 | -// PukiWiki - Yet another WikiWikiWeb clone. | |
4 | -// $Id: encls.php,v 1.2 2006-05-14 15:05:19 henoheno Exp $ | |
5 | -// Copyright (C) 2006 PukiWiki Developers Team | |
6 | -// License: GPL v2 or (at your option) any later version | |
7 | -// | |
8 | -// encoded-EUC-JP.txt -> EUC-JP -> UTF-8 -> encoded-UTF-8.txt | |
9 | - | |
10 | -// Error reporting | |
11 | -error_reporting(0); // Nothing | |
12 | -//error_reporting(E_ERROR | E_PARSE); // Avoid E_WARNING, E_NOTICE, etc | |
13 | -//error_reporting(E_ALL); // Debug purpose | |
14 | - | |
15 | -// PHP-cli only | |
16 | -if (php_sapi_name() != 'cli') die('Invalid SAPI'); | |
17 | -if (! isset($argv)) die('PHP too old (Not 4.3.0 of above)'); | |
18 | - | |
19 | -////////////////////////////////// | |
20 | - | |
21 | -$base = basename(array_shift($argv)); | |
22 | -function usage(){ | |
23 | - global $base; | |
24 | - echo 'Usage: ' . "\n"; | |
25 | - echo ' ' . $base . ' [options] file [file ...]' . "\n"; | |
26 | - echo ' ' . $base . ' [options] --all' . "\n"; | |
27 | - echo ' Options:' . "\n"; | |
28 | - echo ' --all -- Check all of this directory' . "\n"; | |
29 | - echo ' --suffix -- Specify suffix (default: .txt)' . "\n"; | |
30 | - echo ' --encoding_from -- Specify encoding (default: EUC-JP)' . "\n"; | |
31 | - echo ' --encoding_to -- Specify encoding (default: UTF-8)' . "\n"; | |
32 | - exit(1); | |
33 | -} | |
34 | - | |
35 | -////////////////////////////////// | |
36 | -// Code from PukiWiki 1.4.7 | |
37 | - | |
38 | -// lib/func.php r1.72 | |
39 | -// Encode page-name | |
40 | -function encode($key) | |
41 | -{ | |
42 | - return ($key == '') ? '' : strtoupper(bin2hex($key)); | |
43 | - // Equal to strtoupper(join('', unpack('H*0', $key))); | |
44 | - // But PHP 4.3.10 says 'Warning: unpack(): Type H: outside of string in ...' | |
45 | -} | |
46 | -// Decode page name | |
47 | -function decode($key) | |
48 | -{ | |
49 | - return hex2bin($key); | |
50 | -} | |
51 | -// Inversion of bin2hex() | |
52 | -function hex2bin($hex_string) | |
53 | -{ | |
54 | - // preg_match : Avoid warning : pack(): Type H: illegal hex digit ... | |
55 | - // (string) : Always treat as string (not int etc). See BugTrack2/31 | |
56 | - return preg_match('/^[0-9a-f]+$/i', $hex_string) ? | |
57 | - pack('H*', (string)$hex_string) : $hex_string; | |
58 | -} | |
59 | -// Remove [[ ]] (brackets) | |
60 | -function strip_bracket($str) | |
61 | -{ | |
62 | - $match = array(); | |
63 | - if (preg_match('/^\[\[(.*)\]\]$/', $str, $match)) { | |
64 | - return $match[1]; | |
65 | - } else { | |
66 | - return $str; | |
67 | - } | |
68 | -} | |
69 | -////////////////////////////////// | |
70 | -// lib/file.php r1.68 (modified) | |
71 | - | |
72 | -// Get a page list of this wiki | |
73 | -function get_existpages($dir = '', $ext = '.txt') | |
74 | -{ | |
75 | - $aryret = array(); | |
76 | - | |
77 | - $pattern = '((?:[0-9A-F]{2})+)'; | |
78 | - if ($ext != '') $ext = preg_quote($ext, '/'); | |
79 | - $pattern = '/^' . $pattern . $ext . '$/'; | |
80 | - | |
81 | - $dp = @opendir($dir) or | |
82 | - die($dir . ' is not found or not readable.'); | |
83 | - $matches = array(); | |
84 | - while ($file = readdir($dp)) | |
85 | - if (preg_match($pattern, $file, $matches)) | |
86 | - $aryret[$file] = decode($matches[1]); | |
87 | - closedir($dp); | |
88 | - | |
89 | - return $aryret; | |
90 | -} | |
91 | -////////////////////////////////// | |
92 | - | |
93 | -if (empty($argv)) usage(); | |
94 | - | |
95 | -// Options | |
96 | -$f_all = FALSE; | |
97 | -$suffix = '.txt'; | |
98 | -$encoding_from = 'EUC-JP'; | |
99 | -$encoding_to = 'UTF-8'; | |
100 | -foreach ($argv as $key => $value) { | |
101 | - if ($value != '' && $value[0] != '-') break; | |
102 | - $optarg = ''; | |
103 | - list($value, $optarg) = explode('=', $value, 2); | |
104 | - switch ($value) { | |
105 | - case '--all' : $f_all = TRUE; break; | |
106 | - case '--suffix' : $suffix = $optarg; break; | |
107 | - case '--encoding_from': $encoding_from = $optarg; break; | |
108 | - case '--encoding_to' : $encoding_to = $optarg; break; | |
109 | - case '--encoding' : $encoding_to = $optarg; break; | |
110 | - } | |
111 | - unset($argv[$key]); | |
112 | -} | |
113 | -define('SOURCE_ENCODING', $encoding_from); | |
114 | -define('TARGET_ENCODING', $encoding_to); | |
115 | - | |
116 | -// Target | |
117 | -if ($f_all && empty($argv)) { | |
118 | - $argv = array_keys(get_existpages('.', $suffix)); | |
119 | -} else { | |
120 | - foreach ($argv as $arg) { | |
121 | - if (! file_exists($arg)) { | |
122 | - echo 'File not found: ' . $arg . "\n"; | |
123 | - usage(); | |
124 | - } | |
125 | - } | |
126 | -} | |
127 | - | |
128 | -// Do | |
129 | -mb_internal_encoding(SOURCE_ENCODING); | |
130 | -mb_detect_order('auto'); | |
131 | -$matches = array(); | |
132 | -foreach ($argv as $arg) { | |
133 | - if (preg_match('/^(.+)(\.[a-zA-Z0-9]+)$/', $arg, $matches)) { | |
134 | - $name = $matches[1]; | |
135 | - $suffix = $matches[2]; | |
136 | - } else { | |
137 | - $name = $arg; | |
138 | - $suffix = ''; | |
139 | - } | |
140 | - //echo $name . $suffix . "\n"; // As-is | |
141 | - //echo decode($name) . $suffix . "\n"; // Decorded | |
142 | - echo encode(mb_convert_encoding(decode($name), | |
143 | - TARGET_ENCODING, SOURCE_ENCODING)) . | |
144 | - $suffix . "\n"; // Decord -> convert -> encode | |
145 | - //echo "\n"; | |
146 | -} | |
147 | -?> |
@@ -1,3 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | - | |
3 | -grep -B1 "^function" ../*.php | sed -e "s/^\.\.\///" | sed "s/[a-z]*\.php\:function[ \t]*//" |
@@ -1,274 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | -# $Id: release.sh,v 1.26 2006-05-14 15:35:37 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 | -# Name and Usage -------------------------------------------- | |
12 | -_name="` basename $0 `" | |
13 | - | |
14 | -usage(){ | |
15 | - trace 'usage()' || return # (DEBUG) | |
16 | - warn "Usage: $_name [options] VERSION_TAG (1.4.3_rc1 like)" | |
17 | - warn " Options:" | |
18 | - warn " --nopkg Suppress creating archive (Extract and chmod only)" | |
19 | - warn " --norm --nopkg, and remove nothing (.cvsignore etc)" | |
20 | - warn " --co --norm, and use 'checkout' command instead of 'export'" | |
21 | - warn " --utf8 Create UTF-8 converted archive (EXPERIMENTAL)" | |
22 | - warn " -z|--zip Create *.zip archive" | |
23 | - warn " --move-dist Move *.ini.php => *.ini-dist.php" | |
24 | - warn " --copy-dist Move, and Copy *.ini.php <= *.ini-dist.php" | |
25 | - return 1 | |
26 | -} | |
27 | - | |
28 | -# Common functions ------------------------------------------ | |
29 | -warn(){ echo "$*" 1>&2 ; } | |
30 | -err() { warn "Error: $*" ; exit 1 ; } | |
31 | - | |
32 | -quote(){ | |
33 | - test $# -gt 0 && { echo -n "\"$1\"" ; shift ; } | |
34 | - while [ $# -gt 0 ] ; do echo -n " \"$1\"" ; shift ; done ; echo | |
35 | -} | |
36 | - | |
37 | -trace(){ | |
38 | - test "$__debug" || return 0 # (DEBUG) | |
39 | - _msg="$1" ; test $# -gt 0 && shift ; warn " $_msg : ` quote "$@" `" | |
40 | -} | |
41 | - | |
42 | -check_versiontag(){ | |
43 | - case "$1" in | |
44 | - [1-9].[0-9] | [1-9].[0-9] ) tag="r$1" ;; | |
45 | - [1-9].[0-9]_rc[1-9] | [1-9].[0-9]_rc[1-9] ) tag="r$1" ;; | |
46 | - [1-9].[0-9].[0-9] | [1-9].[0-9].[0-9][0-9] ) tag="r$1" ;; | |
47 | - [1-9].[0-9].[0-9]_[a-z]* | [1-9].[0-9].[0-9][0-9]_[a-z]* ) tag="r$1" ;; | |
48 | - [1-9].[0-9].[0-9]_[1-9] | [1-9].[0-9].[0-9][0-9]_[1-9] ) tag="r$1" ;; | |
49 | - [1-9].[0-9].[0-9]_[1-9]_[a-z]* | [1-9].[0-9].[0-9][0-9]_[1-9]_[a-z]* ) tag="r$1" ;; | |
50 | - HEAD | r1_3_3_branch ) tag="$rel" ;; | |
51 | - '' ) usage ; return 1 ;; | |
52 | - * ) warn "Error: Invalid string: $1" ; usage ; return 1 ;; | |
53 | - esac | |
54 | - echo "$tag" | tr '.' '_' | |
55 | -} | |
56 | - | |
57 | -chmod_pkg(){ | |
58 | - ( cd "$1" | |
59 | - # ALL: Read only | |
60 | - find . -type d | while read line; do chmod 755 "$line"; done | |
61 | - find . -type f | while read line; do chmod 644 "$line"; done | |
62 | - # Add write permission for PukiWiki | |
63 | - chmod 777 attach backup cache counter diff trackback wiki* 2>/dev/null | |
64 | - chmod 666 wiki*/*.txt cache/*.dat cache/*.ref cache/*.rel 2>/dev/null | |
65 | - ) | |
66 | -} | |
67 | - | |
68 | -# Default variables ----------------------------------------- | |
69 | - | |
70 | -mod=pukiwiki | |
71 | - | |
72 | -CVSROOT=":pserver:anonymous@cvs.sourceforge.jp:/cvsroot/$mod" | |
73 | - | |
74 | -# Function verifying arguments ------------------------------ | |
75 | - | |
76 | -getopt(){ _arg=noarg | |
77 | - trace 'getopt()' "$@" # (DEBUG) | |
78 | - | |
79 | - case "$1" in | |
80 | - '' ) echo 1 ;; | |
81 | - -[hH]|--help ) echo _help _exit ;; | |
82 | - --debug ) echo _debug 1 ;; | |
83 | - --nopkg ) echo _nopkg 1 ;; | |
84 | - --norm|--noremove ) echo _nopkg _noremove 1 ;; | |
85 | - --co|--checkout ) echo _nopkg _noremove _checkout 1 ;; | |
86 | - -z|--zip ) echo _zip 1 ;; | |
87 | - --ut|--utf|--utf8|--utf-8 ) echo _utf8 1 ;; | |
88 | - --copy-dist ) echo _copy_dist 1 ;; | |
89 | - --move-dist ) echo _move_dist 1 ;; | |
90 | - -d ) echo _CVSROOT 2 ; _arg="$2" ;; | |
91 | - -* ) warn "Error: Unknown option \"$1\"" ; return 1 ;; | |
92 | - * ) echo OTHER ;; | |
93 | - esac | |
94 | - | |
95 | - test 'x' != "x$_arg" | |
96 | -} | |
97 | - | |
98 | -# Working start --------------------------------------------- | |
99 | - | |
100 | -# Show arguments in one line (DEBUG) | |
101 | -case '--debug' in "$1"|"$3") false ;; * ) true ;; esac || { | |
102 | - test 'x--debug' = "x$1" && shift ; __debug=on ; trace 'Args ' "$@" | |
103 | -} | |
104 | - | |
105 | -# Parsing | |
106 | -while [ $# -gt 0 ] ; do | |
107 | - chs="` getopt "$@" `" || err "Syntax error with '$1'" | |
108 | - trace '$chs ' "$chs" # (DEBUG) | |
109 | - | |
110 | - for ch in $chs ; do | |
111 | - case "$ch" in | |
112 | - [1-3] ) shift $ch ;; | |
113 | - _exit ) exit ;; | |
114 | - _help ) usage ;; | |
115 | - | |
116 | - _CVSROOT) CVSROOT="$2" ;; | |
117 | - | |
118 | - _* ) eval "_$ch"=on ;; | |
119 | - * ) break 2 ;; | |
120 | - esac | |
121 | - done | |
122 | -done | |
123 | - | |
124 | -# No argument | |
125 | -if [ $# -eq 0 ] ; then usage ; exit ; fi | |
126 | - | |
127 | -# Utility check --------------------------------------------- | |
128 | - | |
129 | -if [ "$__utf8" ] ; then | |
130 | - which nkf || err "nkf version 2.0 or later (UTF-8 enabled) not found" | |
131 | - nkf_version="` nkf -v 2>&1 | sed -e '/^Network Kanji Filter/!d' -e 's/.* Version \([1-9]\).*/\1/' `" | |
132 | - if [ "$nkf_version" = '1' -o "$nkf_version" = '0' ] ; then | |
133 | - err "nkf found but not seems 2.x (UTF-8 enabled) or later" | |
134 | - fi | |
135 | - encls="./encls.php" | |
136 | - if [ ! -f "$encls" ] | |
137 | - then err "encls not found" | |
138 | - else encls="`pwd`/$encls" | |
139 | - fi | |
140 | - convert(){ | |
141 | - for list in "$@" ; do | |
142 | - # NOTE: Specify '-E'(From EUC-JP) otherwise skin file will be collapsed | |
143 | - nkf -Ew "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list" && echo " $list" | |
144 | - done | |
145 | - } | |
146 | - convert_EUCJP2UTF8(){ | |
147 | - for list in "$@" ; do | |
148 | - # Very rough conversion! | |
149 | - sed 's/EUC-JP/UTF-8/g' "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list" | |
150 | - done | |
151 | - } | |
152 | -fi > /dev/null | |
153 | - | |
154 | -if [ -z "$__zip" ] | |
155 | -then | |
156 | - which tar || err "tar not found" | |
157 | - which gzip || err "gzip not found" | |
158 | -else | |
159 | - which zip || err "zip not found" | |
160 | -fi > /dev/null | |
161 | - | |
162 | -# Argument check -------------------------------------------- | |
163 | - | |
164 | -rel="$1" | |
165 | -tag="` check_versiontag "$rel" `" || exit 1 | |
166 | -pkg_dir="${mod}-${rel}" | |
167 | - | |
168 | -if [ "$__utf8" ] ; then | |
169 | - pkg_dir="${pkg_dir}_utf8" | |
170 | -fi | |
171 | - | |
172 | -# Export the module ----------------------------------------- | |
173 | - | |
174 | -test ! -d "$pkg_dir" || err "There's already a directory: $pkg_dir" | |
175 | - | |
176 | -if [ -z "$__checkout" ] | |
177 | -then cmd="export" | |
178 | -else cmd="checkout" | |
179 | -fi | |
180 | - | |
181 | -echo cvs -z3 -d "$CVSROOT" -q "$cmd" -r "$tag" -d "$pkg_dir" "$mod" | |
182 | - cvs -z3 -d "$CVSROOT" -q "$cmd" -r "$tag" -d "$pkg_dir" "$mod" | |
183 | - | |
184 | -test -d "$pkg_dir" || err "There isn't a directory: $pkg_dir" | |
185 | - | |
186 | -# Remove '.cvsignore' if exists ----------------------------- | |
187 | -test -z "$__noremove" && { | |
188 | - echo find "$pkg_dir" -type f -name '.cvsignore' "| xargs rm -f" | |
189 | - find "$pkg_dir" -type f -name '.cvsignore' | xargs rm -f | |
190 | -} | |
191 | - | |
192 | -# Conversion ------------------------------------------------ | |
193 | - | |
194 | -if [ "$__utf8" ] ; then | |
195 | - echo "Converting EUC-JP => UTF-8 ..." | |
196 | - find "$pkg_dir" -type f \( -name "*.txt" -or -name "*.php" -or -name "*.lng" -or -name "*.dat" -or -name "*.ref" \) | | |
197 | - while read line; do | |
198 | - convert "$line" | |
199 | - done | |
200 | - | |
201 | - # Replace 'EUC-JP' => 'UTF-8' | |
202 | - ( cd "$pkg_dir" && | |
203 | - convert_EUCJP2UTF8 lib/init.php skin/pukiwiki.skin*.php | |
204 | - ) | |
205 | - | |
206 | - # Filename encoded 'encoded-EUC-JP' to 'encoded-UTF-8' | |
207 | - echo "Renaming encoded-EUC-JP => encoded-UTF-8 ..." | |
208 | - ( cd "$pkg_dir" && | |
209 | - for dir in wiki wiki.en cache; do | |
210 | - ( cd "$dir" && | |
211 | - ls *.txt *.ref 2>/dev/null | while read line; do | |
212 | - target="`$encls "$line" 2>/dev/null`" | |
213 | - if [ "x$line" != "x$target" ] ; then | |
214 | - echo " " mv "$line" "$target" | |
215 | - mv "$line" "$target" || exit | |
216 | - fi | |
217 | - done | |
218 | - ) | |
219 | - done | |
220 | - ) || err "stop." | |
221 | -fi | |
222 | - | |
223 | -# chmod ----------------------------------------------------- | |
224 | - | |
225 | -chmod_pkg "$pkg_dir" | |
226 | - | |
227 | -# Create a package ------------------------------------------ | |
228 | - | |
229 | -test ! -z "$__nopkg" && exit 0 | |
230 | - | |
231 | -( cd "$pkg_dir" | |
232 | - | |
233 | - # wiki.en/ | |
234 | - target="wiki.en" | |
235 | - if [ -z "$__zip" ] | |
236 | - then tar cf - "$target" | gzip -9 > "$target".tgz | |
237 | - else zip -r9 "$target.zip" "$target" | |
238 | - fi | |
239 | - rm -Rf "$target" | |
240 | - | |
241 | - # en documents | |
242 | - if [ -z "$__zip" ] | |
243 | - then gzip -9 *.en.txt | |
244 | - else | |
245 | - for list in *.en.txt ; do | |
246 | - zip -9 "$list".zip "$list" | |
247 | - rm -f "$list" | |
248 | - done | |
249 | - fi | |
250 | -) | |
251 | - | |
252 | -# Move / Copy *.ini.php files | |
253 | -if [ 'x' != "x$__copy_dist$__move_dist" ] ; then | |
254 | -( cd "$pkg_dir" | |
255 | - | |
256 | - find . -type f -name "*.ini.php" | while read file; do | |
257 | - dist_file="` echo "$file" | sed 's/ini\.php$/ini-dist.php/' `" | |
258 | - mv -f "$file" "$dist_file" | |
259 | - test "$__copy_dist" && cp -f "$dist_file" "$file" | |
260 | - done | |
261 | -) | |
262 | -fi | |
263 | - | |
264 | -if [ -z "$__zip" ] | |
265 | -then | |
266 | - # Tar + gzip | |
267 | - echo tar cf - "$pkg_dir" \| gzip -9 \> "$pkg_dir.tar.gz" | |
268 | - tar cf - "$pkg_dir" | gzip -9 > "$pkg_dir.tar.gz" | |
269 | -else | |
270 | - # Zip | |
271 | - echo zip -r9 "$pkg_dir.zip" "$pkg_dir" | |
272 | - zip -r9 "$pkg_dir.zip" "$pkg_dir" | |
273 | -fi | |
274 | - |
@@ -1,213 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | -# $Id: release_update.sh,v 1.12 2005-12-10 08:27:00 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 | -# Name and Usage -------------------------------------------- | |
12 | -_name="` basename $0 `" | |
13 | - | |
14 | -usage(){ | |
15 | - warn "USAGE: $_name [options] VERSION_FROM VERSION_TO (VERSION = '1.4.3_rc1' like)" | |
16 | - warn " Options:" | |
17 | - warn " -p|--patch Create a large patch file" | |
18 | - warn " -z|--zip Create *.zip archive" | |
19 | - warn " --move-dist Move *.ini.php => *.ini-dist.php" | |
20 | - warn " --copy-dist Move, and Copy *.ini.php <= *.ini-dist.php" | |
21 | - return 1 | |
22 | -} | |
23 | - | |
24 | -# Common functions ------------------------------------------ | |
25 | -warn(){ echo "$*" 1>&2 ; } | |
26 | -err() { warn "Error: $*" ; exit 1 ; } | |
27 | - | |
28 | -quote(){ | |
29 | - test $# -gt 0 && { echo -n "\"$1\"" ; shift ; } | |
30 | - while [ $# -gt 0 ] ; do echo -n " \"$1\"" ; shift ; done ; echo | |
31 | -} | |
32 | - | |
33 | -trace(){ | |
34 | - test "$__debug" || return 0 # (DEBUG) | |
35 | - _msg="$1" ; test $# -gt 0 && shift ; warn " $_msg : ` quote "$@" `" | |
36 | -} | |
37 | - | |
38 | -check_versiontag(){ | |
39 | - case "$1" in | |
40 | - [1-9].[0-9] | [1-9].[0-9] ) tag="r$1" ;; | |
41 | - [1-9].[0-9]_rc[1-9] | [1-9].[0-9]_rc[1-9] ) tag="r$1" ;; | |
42 | - [1-9].[0-9].[0-9] | [1-9].[0-9].[0-9][0-9] ) tag="r$1" ;; | |
43 | - [1-9].[0-9].[0-9]_[a-z]* | [1-9].[0-9].[0-9][0-9]_[a-z]* ) tag="r$1" ;; | |
44 | - [1-9].[0-9].[0-9]_[1-9] | [1-9].[0-9].[0-9][0-9]_[1-9] ) tag="r$1" ;; | |
45 | - HEAD | r1_3_3_branch ) tag="$rel" ;; | |
46 | - '' ) usage ; return 1 ;; | |
47 | - * ) warn "Error: Invalid string: $1" ; usage ; return 1 ;; | |
48 | - esac | |
49 | - echo "$tag" | tr '.' '_' | |
50 | -} | |
51 | - | |
52 | -chmod_pkg(){ | |
53 | - ( cd "$1" | |
54 | - # ALL: Read only | |
55 | - find . -type d | while read line; do chmod 755 "$line"; done | |
56 | - find . -type f | while read line; do chmod 644 "$line"; done | |
57 | - # Add write permission for PukiWiki | |
58 | - chmod 777 attach backup cache counter diff trackback wiki* 2>/dev/null | |
59 | - chmod 666 wiki*/*.txt cache/*.dat cache/*.ref cache/*.rel 2>/dev/null | |
60 | - ) | |
61 | -} | |
62 | - | |
63 | -# Default variables ----------------------------------------- | |
64 | - | |
65 | -mod=pukiwiki | |
66 | -CVSROOT=":pserver:anonymous@cvs.sourceforge.jp:/cvsroot/$mod" | |
67 | - | |
68 | -pkg_dir="$mod" | |
69 | - | |
70 | -# Function verifying arguments ------------------------------ | |
71 | - | |
72 | -getopt(){ _arg=noarg | |
73 | - trace 'getopt()' "$@" # (DEBUG) | |
74 | - | |
75 | - case "$1" in | |
76 | - '' ) echo 1 ;; | |
77 | - -[hH]|--help ) echo _help _exit ;; | |
78 | - --debug ) echo _debug ;; | |
79 | - -p|--patch ) echo _patch ;; | |
80 | - -z|--zip ) echo _zip ;; | |
81 | - --copy-dist ) echo _copy_dist ;; | |
82 | - --move-dist ) echo _move_dist ;; | |
83 | - -d ) echo _CVSROOT 2 ; _arg="$2" ;; | |
84 | - -* ) warn "Error: Unknown option \"$1\"" ; return 1 ;; | |
85 | - * ) echo OTHER ;; | |
86 | - esac | |
87 | - | |
88 | - test 'x' != "x$_arg" | |
89 | -} | |
90 | - | |
91 | -# Working start --------------------------------------------- | |
92 | - | |
93 | -# Show arguments in one line (DEBUG) | |
94 | -case '--debug' in "$1"|"$3") false ;; * ) true ;; esac || { | |
95 | - test 'x--debug' = "x$1" && shift ; __debug=on ; trace 'Args ' "$@" | |
96 | -} | |
97 | - | |
98 | -# Parsing | |
99 | -while [ $# -gt 0 ] ; do | |
100 | - chs="` getopt "$@" `" || err "Syntax error with '$1'" | |
101 | - trace '$chs ' "$chs" # (DEBUG) | |
102 | - | |
103 | - for ch in $chs ; do | |
104 | - case "$ch" in | |
105 | - [1-3] ) shift $ch ;; | |
106 | - _exit ) exit ;; | |
107 | - _help ) usage ;; | |
108 | - _CVSROOT) CVSROOT="$2" ;; | |
109 | - _* ) shift ; eval "_$ch"=on ;; | |
110 | - * ) break 2 ;; | |
111 | - esac | |
112 | - done | |
113 | -done | |
114 | - | |
115 | -# No argument | |
116 | -if [ $# -eq 0 ] ; then usage ; exit ; fi | |
117 | - | |
118 | -# Argument check -------------------------------------------- | |
119 | - | |
120 | -rel_from="$1" | |
121 | -rel_to="$2" | |
122 | -if [ "x$rel_from" = "x$rel_to" ] ; then | |
123 | - warn "Error: VERSION_FROM and VERSION_TO is equivalent" | |
124 | - usage ; exit | |
125 | -fi | |
126 | - | |
127 | -tag_from="` check_versiontag "$rel_from" `" || exit | |
128 | -tag_to="` check_versiontag "$rel_to" `" || exit | |
129 | - | |
130 | -# ----------------------------------------------------------- | |
131 | - | |
132 | -# Creating a PATCH | |
133 | -test "$__patch" && { | |
134 | - file="${mod}-${tag_from}-${tag_to}.diff.gz" | |
135 | - test ! -f "$file" || err "There's already a file: $file" | |
136 | - | |
137 | - echo $file | |
138 | - echo cvs -z3 -d "$CVSROOT" rdiff -u -r "$tag_from" -r "$tag_to" "$mod" | |
139 | - cvs -z3 -d "$CVSROOT" rdiff -u -r "$tag_from" -r "$tag_to" "$mod" | gzip -9 > "$file" | |
140 | - exit | |
141 | -} | |
142 | -# NOT PATCH | |
143 | - | |
144 | - | |
145 | -# Checkout the module with VERSION_FROM | |
146 | -test ! -d "$pkg_dir" || err "There's already a directory: $pkg_dir" | |
147 | -echo cvs -z3 -d "$CVSROOT" co -r "$tag_from" -d "$pkg_dir" "$mod" | |
148 | - cvs -z3 -d "$CVSROOT" co -r "$tag_from" -d "$pkg_dir" "$mod" | |
149 | -test -d "$pkg_dir" || err "There isn't a directory: $pkg_dir" | |
150 | - | |
151 | - | |
152 | -# Merge VERSION_FROM to VERSION_TO | |
153 | -( cd "$pkg_dir" | |
154 | - echo cvs up -dP -j "$tag_from" -j "$tag_to" | |
155 | - cvs up -dP -j "$tag_from" -j "$tag_to" | |
156 | - | |
157 | - # Cleanup backup files by cvs | |
158 | - find . -type f -name ".#*" | xargs rm -f | |
159 | -) | |
160 | - | |
161 | -# Remove files those are not Added or Modified | |
162 | -echo -n "Remove files those are not Added or Modified ..." | |
163 | -( cd "$pkg_dir" | |
164 | - | |
165 | - find . -type f | grep -v /CVS/ | while read line ; do | |
166 | - result="` cvs -nq up "$line" 2>/dev/null | grep '^[AM] ' | cut -b 3- `" | |
167 | - test "x$result" != "x" || rm -f "$line" | |
168 | - echo -n "." | |
169 | - done | |
170 | - echo | |
171 | -) | |
172 | - | |
173 | -# Remove CVS directories | |
174 | -echo "Remove CVS directories ..." | |
175 | -find "$pkg_dir" -type d -name "CVS" | xargs rm -Rf | |
176 | - | |
177 | -# Remove '.cvsignore' if exists | |
178 | -echo find "$pkg_dir" -type f -name '.cvsignore' -delete | |
179 | - find "$pkg_dir" -type f -name '.cvsignore' -delete | |
180 | - | |
181 | -# Remove emptied directories (twice) | |
182 | -find "$pkg_dir" -type d -empty | xargs rmdir | |
183 | -find "$pkg_dir" -type d -empty | xargs rmdir | |
184 | - | |
185 | -# Move / Copy *.ini.php files | |
186 | -if [ 'x' != "x$__copy_dist$__move_dist" ] ; then | |
187 | -( cd "$pkg_dir" | |
188 | - | |
189 | - find . -type f -name "*.ini.php" | while read file; do | |
190 | - dist_file="` echo "$file" | sed 's/ini\.php$/ini-dist.php/' `" | |
191 | - mv -f "$file" "$dist_file" | |
192 | - test "$__copy_dist" && cp -f "$dist_file" "$file" | |
193 | - done | |
194 | -) | |
195 | -fi | |
196 | - | |
197 | -# chmod | |
198 | -chmod_pkg "$pkg_dir" | |
199 | - | |
200 | -if [ -z "$__zip" ] | |
201 | -then | |
202 | - # Tar | |
203 | - echo tar cf - "$pkg_dir" \| gzip -9 \> "update_$rel_to.tar.gz" | |
204 | - tar cf - "$pkg_dir" | gzip -9 > "update_$rel_to.tar.gz" | |
205 | -else | |
206 | - # Zip | |
207 | - echo zip -r9 "update_$rel_to.zip" "$pkg_dir" | |
208 | - zip -r9 "update_$rel_to.zip" "$pkg_dir" | |
209 | -fi | |
210 | - | |
211 | -#echo rm -Rf "$pkg_dir" | |
212 | -# rm -Rf "$pkg_dir" | |
213 | - |
@@ -1,86 +0,0 @@ | ||
1 | -#!/bin/sh | |
2 | -# $Id: tdiary-demogen.sh,v 1.7 2005-01-25 12:47:11 henoheno Exp $ | |
3 | -# | |
4 | -# tDiary demonstration generator: generates many [theme].php | |
5 | -# License: GPL | |
6 | - | |
7 | -warn(){ echo "$*" 1>&2; } | |
8 | -err(){ warn "$*"; exit 1; } | |
9 | - | |
10 | -usage(){ | |
11 | - base="`basename $0`"; | |
12 | - warn " $base [-d path/to/theme-directory] list" | |
13 | - warn " $base [-d path/to/theme-directory] interwiki" | |
14 | - warn " $base [-d path/to/theme-directory] touch" | |
15 | - warn " $base [-d path/to/theme-directory] untouch" | |
16 | - warn " Command:" | |
17 | - warn " lis|list - List themes" | |
18 | - warn " int|interwiki - Publish interwiki definition and setting for each theme" | |
19 | - warn " tou|touch - Generate \$theme.php that includes index.php" | |
20 | - warn " unt|untouch - Remove \$theme.php(s) listed in theme directory" | |
21 | - exit 1 | |
22 | -} | |
23 | - | |
24 | -theme_list(){ | |
25 | - cd "$dir" || err "Error: directory '$dir' not found" | |
26 | - ls -1 | while read theme; do | |
27 | - test -f "$theme/$theme.css" && echo "$theme" | |
28 | - done | |
29 | -} | |
30 | - | |
31 | -# ---- Argument check ---- | |
32 | -dir="skin/theme" | |
33 | -if [ "x-d" = "x$1" ] ; then | |
34 | - dir="$2" | |
35 | - shift 2 | |
36 | -fi | |
37 | -cmd="$1" | |
38 | - | |
39 | -# ---- | |
40 | - | |
41 | -case "$cmd" in | |
42 | -''|-h|hel|help ) usage ;; | |
43 | -lis|list ) theme_list ;; | |
44 | - | |
45 | -int|inte|inter|interw|interwi|interwik|interwiki) | |
46 | - echo '--------' | |
47 | - echo '- [./$1.php theme] raw tDiary theme selector' | |
48 | - echo '--------' | |
49 | - echo '- (s) = sidebar CSS exists in this theme' | |
50 | - theme_list | while read theme; do | |
51 | - echo -n "+ [[theme:$theme]]" | |
52 | - grep -q div.sidebar "$dir/$theme/$theme.css" && echo -n " (s)" | |
53 | - echo | |
54 | - done | |
55 | - ;; | |
56 | - | |
57 | -tou|touc|touch ) | |
58 | - theme_list | while read theme; do | |
59 | - if [ -f "$theme.php" ] | |
60 | - then echo "Warning: '$theme.php' is already available. Ignoreing..." | |
61 | - else | |
62 | - cat <<EOF > "$theme.php" | |
63 | -<?php | |
64 | - define('TDIARY_THEME', '$theme'); | |
65 | - require('./index.php') | |
66 | -?> | |
67 | -EOF | |
68 | - fi | |
69 | - done | |
70 | - ;; | |
71 | - | |
72 | -unt|unto|untou|untouc|untouch ) | |
73 | - echo -n " Remove theme(s).php ? [y/N]: " | |
74 | - read answer | |
75 | - case "$answer" in | |
76 | - [yY] | [yY][eE][sS] ) | |
77 | - theme_list | while read theme ; do | |
78 | - test -f "$theme.php" && grep -q "define('TDIARY_THEME', '$theme');" "$theme.php" && rm -f "$theme.php" | |
79 | - done | |
80 | - ;; | |
81 | - * ) | |
82 | - echo " Stopped." | |
83 | - esac | |
84 | - ;; | |
85 | -esac | |
86 | - |