#!/bin/sh
-# $Id: release_update.sh,v 1.7 2005/03/21 12:28:38 henoheno Exp $
+# $Id: release_update.sh,v 1.12 2005/12/10 08:27:00 henoheno Exp $
# $CVSKNIT_Id: release.sh,v 1.11 2004/05/28 14:26:24 henoheno Exp $
# Release automation script for PukiWiki
# ==========================================================
_name="` basename $0 `"
usage(){
- warn "USAGE: `basename $0` VERSION_FROM VERSION_TO (VERSION = '1.4.3_rc1' like)"
+ warn "USAGE: $_name [options] VERSION_FROM VERSION_TO (VERSION = '1.4.3_rc1' like)"
+ warn " Options:"
+ warn " -p|--patch Create a large patch file"
+ warn " -z|--zip Create *.zip archive"
+ warn " --move-dist Move *.ini.php => *.ini-dist.php"
+ warn " --copy-dist Move, and Copy *.ini.php <= *.ini-dist.php"
return 1
}
echo "$tag" | tr '.' '_'
}
+chmod_pkg(){
+ ( cd "$1"
+ # ALL: Read only
+ find . -type d | while read line; do chmod 755 "$line"; done
+ find . -type f | while read line; do chmod 644 "$line"; done
+ # Add write permission for PukiWiki
+ chmod 777 attach backup cache counter diff trackback wiki* 2>/dev/null
+ chmod 666 wiki*/*.txt cache/*.dat cache/*.ref cache/*.rel 2>/dev/null
+ )
+}
+
# Default variables -----------------------------------------
mod=pukiwiki
'' ) echo 1 ;;
-[hH]|--help ) echo _help _exit ;;
--debug ) echo _debug ;;
- #-z|--zip ) echo _zip ;;
- #--copy-dist ) echo _copy_dist ;;
- #--move-dist ) echo _move_dist ;;
+ -p|--patch ) echo _patch ;;
+ -z|--zip ) echo _zip ;;
+ --copy-dist ) echo _copy_dist ;;
+ --move-dist ) echo _move_dist ;;
-d ) echo _CVSROOT 2 ; _arg="$2" ;;
-* ) warn "Error: Unknown option \"$1\"" ; return 1 ;;
* ) echo OTHER ;;
# -----------------------------------------------------------
+# Creating a PATCH
+test "$__patch" && {
+ file="${mod}-${tag_from}-${tag_to}.diff.gz"
+ test ! -f "$file" || err "There's already a file: $file"
+
+ echo $file
+ echo cvs -z3 -d "$CVSROOT" rdiff -u -r "$tag_from" -r "$tag_to" "$mod"
+ cvs -z3 -d "$CVSROOT" rdiff -u -r "$tag_from" -r "$tag_to" "$mod" | gzip -9 > "$file"
+ exit
+}
+# NOT PATCH
+
+
# Checkout the module with VERSION_FROM
test ! -d "$pkg_dir" || err "There's already a directory: $pkg_dir"
echo cvs -z3 -d "$CVSROOT" co -r "$tag_from" -d "$pkg_dir" "$mod"
cvs -z3 -d "$CVSROOT" co -r "$tag_from" -d "$pkg_dir" "$mod"
test -d "$pkg_dir" || err "There isn't a directory: $pkg_dir"
+
# Merge VERSION_FROM to VERSION_TO
( cd "$pkg_dir"
echo cvs up -dP -j "$tag_from" -j "$tag_to"
)
# Remove files those are not Added or Modified
+echo -n "Remove files those are not Added or Modified ..."
( cd "$pkg_dir"
find . -type f | grep -v /CVS/ | while read line ; do
)
# Remove CVS directories
- find "$pkg_dir" -type d -name "CVS" | xargs rm -Rf
+echo "Remove CVS directories ..."
+find "$pkg_dir" -type d -name "CVS" | xargs rm -Rf
# Remove '.cvsignore' if exists
echo find "$pkg_dir" -type f -name '.cvsignore' -delete
find "$pkg_dir" -type f -name '.cvsignore' -delete
-# Remove emptied directories
+# Remove emptied directories (twice)
find "$pkg_dir" -type d -empty | xargs rmdir
find "$pkg_dir" -type d -empty | xargs rmdir
-# chmod
+# Move / Copy *.ini.php files
+if [ 'x' != "x$__copy_dist$__move_dist" ] ; then
( cd "$pkg_dir"
- # ALL: Read only
- find . -type d | while read line; do
- chmod 755 "$line"
- done
- find . -type f | while read line; do
- chmod 644 "$line"
- done
-
- # Add write permission for PukiWiki
- chmod 777 attach backup cache counter diff trackback wiki* 2>/dev/null
- chmod 666 wiki*/*.txt cache/*.dat 2>/dev/null
-
+ find . -type f -name "*.ini.php" | while read file; do
+ dist_file="` echo "$file" | sed 's/ini\.php$/ini-dist.php/' `"
+ mv -f "$file" "$dist_file"
+ test "$__copy_dist" && cp -f "$dist_file" "$file"
+ done
)
+fi
-# Tar
-echo tar cf - "$pkg_dir" \| gzip -9 \> "update_$rel_to.tar.gz"
- tar cf - "$pkg_dir" | gzip -9 > "update_$rel_to.tar.gz"
-
-# Zip
-#echo zip -r9 "update_$rel_to.zip" "$pkg_dir"
-# zip -r9 "update_$rel_to.zip" "$pkg_dir"
+# chmod
+chmod_pkg "$pkg_dir"
+
+if [ -z "$__zip" ]
+then
+ # Tar
+ echo tar cf - "$pkg_dir" \| gzip -9 \> "update_$rel_to.tar.gz"
+ tar cf - "$pkg_dir" | gzip -9 > "update_$rel_to.tar.gz"
+else
+ # Zip
+ echo zip -r9 "update_$rel_to.zip" "$pkg_dir"
+ zip -r9 "update_$rel_to.zip" "$pkg_dir"
+fi
#echo rm -Rf "$pkg_dir"
# rm -Rf "$pkg_dir"