#!/bin/sh # # Copyright (c) 2005 Kimmo Suominen # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # 3. The name of the author may not be used to endorse or promote # products derived from this software without specific prior # written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # Create WordPress/fi_FI tar.gz and zip files. # # 20050222 Kimmo Suominen # 20050315 Kimmo Suominen - Use standard repository layout (UTF-8) # export PATH PATH=/bin:/usr/bin:/usr/pkg/bin:/usr/local/bin # if [ $# -lt 3 ] then echo "Usage: $0 basename distfile directory [...]" 1>&2 exit 1 fi # if [ ! -r "${2}" ] then echo "Cannot read: ${2}" 1>&2 exit 1 fi ORIGINAL="${2}" PACKAGE="${1}" shift 2 # umask 022 # CURDIR=`pwd` # for dir do case "${dir}" in /*) SRCDIR="${dir}" ;; *) SRCDIR="${CURDIR}/${dir}" ;; esac # case "${SRCDIR}" in */cy/*) LANG="cy" ;; */eo/*) LANG="eo" ;; */fa/*) LANG="fa" ;; */??_??*/*) LANG=`echo "${SRCDIR}" | sed -e 's,.*/\(.._..[^/]*\)/.*,\1,'` case "${LANG}" in */*) echo "Skipped: ${SRCDIR}" continue ;; esac ;; *) echo "Skipped: ${SRCDIR}" continue ;; esac # for pofile in "${SRCDIR}/messages/"*.po do if [ ! -f "${pofile}" ] then continue fi # bf=`basename "${pofile}" .po` case "${bf}" in "${LANG}".*) charset=`echo "${bf}" | awk -F. '{print $NF}'` ;; "${LANG}") charset='' ;; *) echo "WARNING: ${LANG}: Unknown PO file: ${bf}" continue ;; esac # WRKDIR=`mktemp -d -t wp` # if [ ! -d "${WRKDIR}" ] then echo "Creating work directory failed!" 1>&2 exit 1 fi # trap "rm -rf '${WRKDIR}'" 0 1 3 13 15 # cd "${WRKDIR}" || exit 1 tar -xzf "${ORIGINAL}" # mkdir -p "wordpress/wp-includes/languages" msgfmt -o "wordpress/wp-includes/languages/${LANG}.mo" "${pofile}" # for i in \ "theme${charset:+/${charset}}" \ "theme${charset:+/${charset}}/default" do theme="${i}" if [ -f "${SRCDIR}/${i}/index.php" ] then break fi done # for pair in \ "${theme} wp-content/themes/default" \ "dist${charset:+/${charset}} ." do set -- ${pair} if [ -d "${SRCDIR}/${1}" ] then ( cd "${SRCDIR}/${1}" && \ pax -rw -pp -s '|.*/\..*||' . "${WRKDIR}/wordpress/${2}" ) else echo "WARNING: ${LANG}: ${1} is missing" fi done # chmod -R u=rwX,go=rX wordpress # pfile="${CURDIR}/${PACKAGE}-${LANG}${charset:+.${charset}}" for i in tar.gz zip do case "$i" in zip) cmd="zip -qr" ;; *) cmd="tar -czf" ;; esac eval $cmd "${pfile}.${i}" wordpress || rm -f "${pfile}.${i}" # if [ -f "${pfile}.${i}" ] then echo "Created: ${pfile}.${i}" fi done # cd "${CURDIR}" rm -rf "${WRKDIR}" done done