]> git.lyx.org Git - lyx.git/blob - development/tools/updatestats.sh
Reduce whitespace differences to LyX
[lyx.git] / development / tools / updatestats.sh
1 #!/bin/sh
2 # A script to update the LyX i18n.inc statistics
3
4 # The script expects an environment variable FARM that 
5 # will provide it with the location of the LyX www tree.
6
7 if [ -z "$FARM" ]; then
8   echo "You must set the FARM variable to run this script, e.g.:";
9   echo "# FARM=/cvs/lyx-www/ bash updatestats.sh";
10   exit 1;
11 fi
12
13 FARM=${FARM%/};
14 FARM="$FARM/farm/cookbook/LyX";
15 # Sanity check
16 if [ ! -f "$FARM/i18n.php" ]; then 
17   echo "$FARM does not look like LyX's www tree!";
18   exit 1;
19 fi
20
21 # Get us to the root of the tree we are in.
22 MYDIR=${0%updatestats.sh};
23 if [ -n "$MYDIR" ]; then
24   cd $MYDIR;
25 fi
26 cd ../../;
27 LYXROOT=$(pwd);
28
29 # Are we in trunk or branch?
30 TRUNK="TRUE";
31 if ls status.* 2>/dev/null | grep -q status; then 
32   TRUNK="";
33 fi
34
35 # Sanity check
36 if ! cd po/; then 
37   echo "Cannot cd to po/ directory!";
38   pwd
39   exit 1;
40 fi
41
42 echo Running make i18n.inc...
43 make i18n.inc;
44 if [ -n "$TRUNK" ]; then
45   mv i18n.inc i18n_trunk.inc
46   I18NFILE=i18n_trunk.inc;
47 else
48   I18NFILE=i18n.inc;
49 fi
50
51 if ! cd $FARM; then
52   echo "Unable to cd to $FARM!";
53   exit 1;
54 fi
55
56 # Are we under svn or git?
57 GIT="";
58 if [ -d .git/ ]; then GIT="TRUE"; fi
59
60 echo
61 echo Updating the www-user tree...
62 svn up
63
64 echo Copying $I18NFILE...;
65 cp $LYXROOT/po/$I18NFILE .;
66
67 echo Committing...;
68 if [ -z "$GIT" ]; then
69   svn commit -m "* $I18NFILE: update stats" $I18NFILE;
70 else
71   git commit -m "* $I18NFILE: update stats" $I18NFILE;
72   git svn dcommit;
73 fi
74
75 echo DONE!