Code

Added additional cmd checks
[gosa.git] / gosa-core / debian / patches / 04_fix_locale_location.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 04_fix_locale_location.dpatch by  <cajus@localhost>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: No description.
7 @DPATCH@
8 diff -urNad gosa-core~/include/php_setup.inc gosa-core/include/php_setup.inc
9 --- gosa-core~/include/php_setup.inc    2008-03-17 23:52:36.000000000 +0100
10 +++ gosa-core/include/php_setup.inc     2008-04-09 09:22:55.000000000 +0200
11 @@ -20,7 +20,7 @@
12   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
13   */
14  
15 -define ("LOCALE_DIR", dirname(dirname(__FILE__))."/locale/compiled");
16 +define ("LOCALE_DIR", "/var/cache/gosa/locale");
17  
18  function gosaRaiseError($errno, $errstr, $errfile, $errline)
19  {
20 diff -urNad gosa-core~/update-gosa gosa-core/update-gosa
21 --- gosa-core~/update-gosa      2008-04-02 15:58:24.000000000 +0200
22 +++ gosa-core/update-gosa       2008-04-09 09:22:31.000000000 +0200
23 @@ -169,20 +169,20 @@
24  
25         /* For each language, merge the target .mo to the compiled directory. */
26         foreach ($languages as $language => $po_files){
27 -               if (!is_dir(LOCALE_DIR."/compiled/${language}/LC_MESSAGES")){
28 -                       if (!mkdir (LOCALE_DIR."/compiled/${language}/LC_MESSAGES", 0755, TRUE)){
29 -                               echo "Failed to create '".LOCALE_DIR."/compiled/${language}/LC_MESSAGES'- aborted";
30 +               if (!is_dir("/var/cache/gosa/locale/${language}/LC_MESSAGES")){
31 +                       if (!mkdir ("/var/cache/gosa/locale/${language}/LC_MESSAGES", 0755, TRUE)){
32 +                               echo "Failed to create '/var/cache/gosa/locale/${language}/LC_MESSAGES'- aborted";
33                                 exit (3);
34                         }
35                 }
36  
37                 /* Cat all these po files into one single file */
38 -               system ("(cd ".LOCALE_DIR." && msgcat ".implode(" ", $po_files)." > compiled/${language}/LC_MESSAGES/messages.po)", $val);
39 +               system ("(cd ".LOCALE_DIR." && msgcat ".implode(" ", $po_files)." > /var/cache/gosa/locale/${language}/LC_MESSAGES/messages.po)", $val);
40                 if ($val != 0){
41                         echo "Merging of message files failed - aborted";
42                         exit (4);
43                 }
44 -               system ("(cd ".LOCALE_DIR."/compiled/${language}/LC_MESSAGES && msgfmt -o messages.mo messages.po && rm messages.po)", $val);
45 +               system ("(cd /var/cache/gosa/locale/${language}/LC_MESSAGES && msgfmt -o messages.mo messages.po && rm messages.po)", $val);
46                 if ($val != 0){
47                         echo "Compiling of message files failed - aborted";
48                         exit (5);