ocornu / webmonkey

Webmonkey (aka Greasemonkey+) is a fork of the popular Greasemonkey extension for Firefox.

This URL has Read+Write access

webmonkey / build.sh
100755 49 lines (41 sloc) 1.255 kb
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
#!/bin/sh
 
# Set up variables
NAME=webmonkey
VERSION=`grep "<em:version>" src/install.rdf | sed -r "s/^\s*<em:version>(.+)<\/em:version>\s*$/\\1/"`
BUILD=$VERSION
if [ "$1" != "-r" ]; then
DATE=`date +"%Y%m%d"`
BUILD="$BUILD.$DATE.${1-0}"
fi
XPI="$NAME-$BUILD.xpi"
 
# Copy base structure to a temporary build directory and change to it
echo "Creating working directory ..."
rm -rf build
mkdir build
cd src
cp -r chrome.manifest install.rdf LICENSE \
defaults components content locale modules skin \
../build/
cd ../build
 
echo "Gathering all locales into chrome.manifest ..."
LOCALES=\"en-US\"
for entry in locale/*; do
entry=`basename $entry`
  if [ $entry != en-US ]; then
echo "locale $NAME $entry locale/$entry/" >> chrome.manifest
    LOCALES=$LOCALES,\ \"$entry\"
  fi
done
 
echo "Patching install.rdf version ..."
sed "s!<em:version>.*</em:version>!<em:version>$BUILD</em:version>!" \
  install.rdf > install.rdf.tmp
mv install.rdf.tmp install.rdf
 
echo "Cleaning up unwanted files ..."
find . -depth -name '.svn' -exec rm -rf "{}" \;
find . -depth -name '*~' -exec rm -rf "{}" \;
find . -depth -name '#*' -exec rm -rf "{}" \;
 
echo "Creating $XPI ..."
zip -qr9X "../$XPI" *
 
echo "Cleaning up temporary files ..."
cd ..
rm -rf build