+check_versiontag(){
+ case "$1" in
+ [1-9].[0-9] | [1-9].[0-9] ) tag="r$1" ;;
+ [1-9].[0-9]_rc[1-9] | [1-9].[0-9]_rc[1-9] ) tag="r$1" ;;
+ [1-9].[0-9].[0-9] | [1-9].[0-9].[0-9][0-9] ) tag="r$1" ;;
+ [1-9].[0-9].[0-9]_[a-z]* | [1-9].[0-9].[0-9][0-9]_[a-z]* ) tag="r$1" ;;
+ [1-9].[0-9].[0-9]_[1-9] | [1-9].[0-9].[0-9][0-9]_[1-9] ) tag="r$1" ;;
+ HEAD | r1_3_3_branch ) tag="$rel" ;;
+ '' ) usage ; return 1 ;;
+ * ) warn "Error: Invalid string: $1" ; usage ; return 1 ;;
+ esac
+ 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
+ )
+}
+