1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
#!/bin/bash
# 7/11/2011
# Shell script used (under Linux) to create the TexMaths-<version>.oxt package
# The created package can be used on Linux, MacOS X and Windows
# The version number must be passed at the command line and is used to update
# the description.xml file
# Display usage information
usage(){
echo "Usage: ./makepkg version_number"
echo "Example: ./makepkg 0.48.1"
exit 1
}
# Update po files
update_po(){
echo
echo Updating po files...
cd po
./xgettextbas ../TexMaths/*.xba > TexMaths.pot 2> /dev/null
for File in `ls *.po 2>/dev/null`
do
echo $File
msgmerge -N $File TexMaths.pot > $File.tmp
mv $File.tmp $File
done
cd ..
}
# Create package
make_package(){
echo
echo Making package release...
cat description.xml \
| sed s/"<version value=\".*\""/"<version value=\"${ver}\""/ \
> tmp.xml
mv tmp.xml description.xml
href="http://downloads.sourceforge.net/texmaths/TexMaths-${ver}.oxt"
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<description xmlns=\"http://openoffice.org/extensions/update/2006\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">
<identifier value=\"org.roland65.texmaths\"/>
<display-name>
<name>TexMaths</name>
</display-name>
<version value=\"${ver}\"/>
<update-download>
<src xlink:href=\"${href}\"/>
</update-download>
</description>" > ../TexMaths.update.xml
zip -r ../TexMaths-${ver}.oxt \
AddonRegistry.{xcs,xcu} \
Addons.xcu \
ChangeLog \
makepkg \
description.xml \
README \
META-INF/manifest.xml \
Office/UI/*.xcu \
icons/*.{bmp,png,svg} \
icons/symbols-black/*.svg \
icons/symbols-white/*.svg \
TexMaths/*.{xba,xdl,xlb} \
license.txt \
help/* \
po/*
}
# Main part
# Get package version from the description.xml file
#ver=`grep "<version value=" description.xml | sed 's/<version value="//g' | sed 's/"\/>//' | sed 's/ //g'`
# Version number must be entered at the command line
[ "$1" = "" ] && usage
ver=$1
echo Version = $ver
# Update po files
update_po
# Make package
make_package
# Display message
echo
echo Done!
exit 0
|