]> git.lyx.org Git - lyx.git/blob - development/tools/updatelfuns.sh
Amend b8502a3ea2735c4
[lyx.git] / development / tools / updatelfuns.sh
1 #!/bin/bash
2
3 if [ -z "$BASH_VERSION" ]; then
4         # http://article.gmane.org/gmane.editors.lyx.devel/159697
5         echo "You must use bash to run this script";
6         exit 1;
7 fi
8
9 function do_convert {
10         for i in *; do 
11                 if [ ! -f "$i" ]; then continue; fi
12                 cp "$i" "$i.old"; 
13                 python "$lyxdir/lib/scripts/prefs2prefs.py" -l <"$i.old" >"$i"; 
14         done
15 }
16
17 # find out where we are relative to the program directory
18 curdir=$(pwd);
19 progloc=$0;
20 pathto=${progloc%/*};
21 # get us into development/tools
22 if [ "$progloc" != "$pathto" ]; then
23         if ! cd "$pathto"; then
24         echo "Couldn't get to development/tools!";
25         exit 1;
26         fi
27 fi
28
29 curdir=$(pwd);
30 lyxdir=${curdir%/development/tools*};
31
32 if ! cd "$lyxdir/lib/ui/"; then
33         echo "Couldn't get to lib/ui!";
34         exit 1;
35 fi
36
37 do_convert;
38
39 if ! cd "$lyxdir/lib/bind/"; then
40         echo "Couldn't get to lib/bind!";
41         exit 1;
42 fi
43
44 do_convert;
45
46 #now do the subdirectories
47 for d in *; do 
48         if [ ! -d "$d" ]; then continue; fi
49         pushd "$d";
50         do_convert;
51         popd;
52 done