#!/bin/sh
-# $Id: release.sh,v 1.23 2005/09/20 14:37:03 henoheno Exp $
+# $Id: release.sh,v 1.26 2006/05/14 15:35:37 henoheno Exp $
# $CVSKNIT_Id: release.sh,v 1.11 2004/05/28 14:26:24 henoheno Exp $
# Release automation script for PukiWiki
# ==========================================================
if [ "$__utf8" ] ; then
which nkf || err "nkf version 2.0 or later (UTF-8 enabled) not found"
nkf_version="` nkf -v 2>&1 | sed -e '/^Network Kanji Filter/!d' -e 's/.* Version \([1-9]\).*/\1/' `"
- if [ "$nkf_version" = '1' ] ; then
- err "nkf found but seems 1.x"
+ if [ "$nkf_version" = '1' -o "$nkf_version" = '0' ] ; then
+ err "nkf found but not seems 2.x (UTF-8 enabled) or later"
+ fi
+ encls="./encls.php"
+ if [ ! -f "$encls" ]
+ then err "encls not found"
+ else encls="`pwd`/$encls"
fi
convert(){
for list in "$@" ; do
- # NOTE: Specify '-E'(From EUC-JP) otherwise skin file will be collapse
- nkf -Ew "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list"
+ # NOTE: Specify '-E'(From EUC-JP) otherwise skin file will be collapsed
+ nkf -Ew "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list" && echo " $list"
done
}
convert_EUCJP2UTF8(){
tag="` check_versiontag "$rel" `" || exit 1
pkg_dir="${mod}-${rel}"
+if [ "$__utf8" ] ; then
+ pkg_dir="${pkg_dir}_utf8"
+fi
+
# Export the module -----------------------------------------
test ! -d "$pkg_dir" || err "There's already a directory: $pkg_dir"
if [ "$__utf8" ] ; then
echo "Converting EUC-JP => UTF-8 ..."
- find "$pkg_dir" -type f \( -name "*.txt" -or -name "*.php" -or -name "*.lng" -or -name "*.dat" \) |
+ find "$pkg_dir" -type f \( -name "*.txt" -or -name "*.php" -or -name "*.lng" -or -name "*.dat" -or -name "*.ref" \) |
while read line; do
- echo " $line"
convert "$line"
done
convert_EUCJP2UTF8 lib/init.php skin/pukiwiki.skin*.php
)
- # Filename about wiki/*.txt or something are not coverted yet
+ # Filename encoded 'encoded-EUC-JP' to 'encoded-UTF-8'
+ echo "Renaming encoded-EUC-JP => encoded-UTF-8 ..."
+ ( cd "$pkg_dir" &&
+ for dir in wiki wiki.en cache; do
+ ( cd "$dir" &&
+ ls *.txt *.ref 2>/dev/null | while read line; do
+ target="`$encls "$line" 2>/dev/null`"
+ if [ "x$line" != "x$target" ] ; then
+ echo " " mv "$line" "$target"
+ mv "$line" "$target" || exit
+ fi
+ done
+ )
+ done
+ ) || err "stop."
fi
# chmod -----------------------------------------------------