diff --git a/contrib/bin/fusiondirectory-setup b/contrib/bin/fusiondirectory-setup
index 4be48dbfdc1137781fa0f2a90c58a47b3e98e8ec..fccd8a9f65a5129858101e8a5c20e7b1752704f5 100755
--- a/contrib/bin/fusiondirectory-setup
+++ b/contrib/bin/fusiondirectory-setup
@@ -322,9 +322,56 @@ sub check_config {
 ############################################################# Change install directories #################################################################################
 
 sub install_directories {
+  my $filecontent = <<eof;
+<?php
+  require_once('variables_common.inc');
 
-  print "This function is not implemented yet";
+  /*! \\file
+   * Define common locations and variables
+   * Generated by fusiondirectory-setup */
 
+  if(!defined("CONFIG_DIR")){
+    define ("CONFIG_DIR", "$vars{fd_config_dir}"); /* FusionDirectory etc path */
+  }
+
+  /* Allow setting the config file in the apache configuration
+      e.g.  SetEnv CONFIG_FILE fusiondirectory.conf 1.0
+   */
+  if(!defined("CONFIG_FILE")){
+    define ("CONFIG_FILE", "$vars{config_file}"); /* FusionDirectory filename */
+  }
+
+  /* Smarty compile dir */
+  define ("SPOOL_DIR","$vars{fd_spool_dir}"); /* FusionDirectory spool directory */
+
+  /* Global cache dir */
+  define ("CACHE_DIR","$vars{fd_cache}"); /* FusionDirectory var directory */
+
+  /* Global locale cache dir */
+  define ("LOCALE_DIR", "$locale_cache_dir"); /* FusionDirectory locale directory */
+
+  /* Global tmp dir */
+  define ("TEMP_DIR", "$tmp_dir"); /* FusionDirectory tmp directory */
+
+  /* Directory containing the configuration template */
+  define ("CONFIG_TEMPLATE_DIR", "$template_dir"); /* FusionDirectory template directory */
+
+  /* Directory containing the fai logs */
+  define ("FAI_LOG_DIR", "$fai_log_dir"); /* FusionDirectory fai directory */
+
+  /* Directory containing the vacation files */
+  define ("VACATION_DIR", "$vars{fd_cache}/vacation/"); /* FusionDirectory vacation directory */
+
+  /* name of the class.cache file */
+  define("CLASS_CACHE", "$vars{class_cache}"); /* name of the class cache */
+?>
+eof
+
+  my $variables_path = "$vars{fd_home}/include/variables.inc";
+  my $variables_file = file ($variables_path);
+  my $vars_file = $variables_file->openw() or die ("! Unable to open $variables_path in write mode\n");
+  $vars_file->print($filecontent);
+  $vars_file->close or die ("! Can't close $variables_file\n");
 }
 
 ############################################################# LDAP conformity check #################################################################################
diff --git a/include/variables.inc b/include/variables.inc
index bd1ffeace9e0046b68284cec9eb58d6300777cdf..a035c32b3112cbde9b79643e00537473d9d9006b 100644
--- a/include/variables.inc
+++ b/include/variables.inc
@@ -1,86 +1,42 @@
 <?php
+  require_once('variables_common.inc');
 
-/*
-  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
-  Copyright (C) 2003-2010  Cajus Pollmeier
-  Copyright (C) 2011  FusionDirectory
+  /*! \file
+   * Define common locations and variables
+   * Generated by fusiondirectory-setup */
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
+  if(!defined("CONFIG_DIR")){
+    define ("CONFIG_DIR", "/etc/fusiondirectory"); /* FusionDirectory etc path */
+  }
 
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
+  /* Allow setting the config file in the apache configuration
+      e.g.  SetEnv CONFIG_FILE fusiondirectory.conf 1.0
+   */
+  if(!defined("CONFIG_FILE")){
+    define ("CONFIG_FILE", "fusiondirectory.conf"); /* FusionDirectory filename */
+  }
 
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
+  /* Smarty compile dir */
+  define ("SPOOL_DIR","/var/spool/fusiondirectory"); /* FusionDirectory spool directory */
 
-/*! \file
- * Define common locations and variables */
+  /* Global cache dir */
+  define ("CACHE_DIR","/var/cache/fusiondirectory"); /* FusionDirectory var directory */
 
-/* Allow setting the config file in the apache configuration
-    e.g. SetEnv CONFIG_DIR /etc/fusiondirectory
-*/
-if(!isset($_SERVER['CONFIG_DIR'])){
-  define ("CONFIG_DIR", "/etc/fusiondirectory"); /*! Define FusionDirectory etc path */
-}else{
-  define ("CONFIG_DIR",$_SERVER['CONFIG_DIR']);
-}
+  /* Global locale cache dir */
+  define ("LOCALE_DIR", "/var/cache/fusiondirectory/locale"); /* FusionDirectory locale directory */
 
-/* Allow setting the config file in the apache configuration
-    e.g.  SetEnv CONFIG_FILE fusiondirectory.conf 1.0
- */
-if(!isset($_SERVER['CONFIG_FILE'])){
-  define ("CONFIG_FILE", "fusiondirectory.conf"); /*! Define FusionDirectory filename */
-}else{
-  define ("CONFIG_FILE",$_SERVER['CONFIG_FILE']);
-}
+  /* Global tmp dir */
+  define ("TEMP_DIR", "/var/cache/fusiondirectory/tmp"); /* FusionDirectory tmp directory */
 
-/* Smarty compile dir */
-define ("SPOOL_DIR","/var/spool/fusiondirectory"); /*! Define FusionDirectory spool directory */
+  /* Directory containing the configuration template */
+  define ("CONFIG_TEMPLATE_DIR", "/var/cache/fusiondirectory/template"); /* FusionDirectory template directory */
 
-/* Global cache dir */
-define ("CACHE_DIR","/var/cache/fusiondirectory"); /*! Define FusionDirectory var directory */
+  /* Directory containing the fai logs */
+  define ("FAI_LOG_DIR", "/var/cache/fusiondirectory/fai"); /* FusionDirectory fai directory */
 
-/* Global locale cache dir */
-define ("LOCALE_DIR", "/var/cache/fusiondirectory/locale"); /*! Define FusionDirectory locale directory */
+  /* Directory containing the vacation files */
+  define ("VACATION_DIR", "/var/cache/fusiondirectory/vacation/"); /* FusionDirectory vacation directory */
 
-/* Global tmp dir */
-define ("TEMP_DIR","/var/cache/fusiondirectory/tmp"); /*! Define FusionDirectory tmp directory */
-
-/* Directory containing the configuration template */
-define ("CONFIG_TEMPLATE_DIR", "/var/cache/fusiondirectory/template/"); /*! Define FusionDirectory template directory */
-
-/* Directory containing the fai logs */
-define ("FAI_LOG_DIR", "/var/cache/fusiondirectory/fai/"); /*! Define FusionDirectory fai directory */
-
-/* Directory containing the vacation files */
-define ("VACATION_DIR", "/var/cache/fusiondirectory/vacation/"); /*! Define FusionDirectory vacation directory */
-
-/* php library path */
-define ("PHP_DIR", "/usr/share/php"); /*! Define php directory */
-
-/* fpdf library path */ 
-define("FPDF","/usr/share/php/fpdf/fpdf.php"); /*! Define fpdf library path */
-
-/* Global FPDF FONT define */
-define("FPDF_FONTPATH", "/usr/share/php/fpdf/font/"); /*! Define fpdf font path  */
-
-/* path for smarty libraries */
-define("SMARTY", "/usr/share/php/smarty/libs/Smarty.class.php"); /*! Define smarty2 library path */
-define("SMARTY3", "/usr/share/php/smarty3/Smarty.class.php"); /*! Define smarty3 library path */
-
-/* name of the class.cache file */
-define("CLASS_CACHE", "class.cache"); /*! Define the name of the class cache */
-
-/* name of the utility used to create windows passwords */
-define ("MKNTPWD", "/usr/sbin/fusiondirectory-mkntpassword"); /*! Define the name of the binary used to create smb password */
-
-/* FusionDirectory Version */
-define ("FD_VERSION", "1.0.3"); /*! Define FusionDirectory version */
+  /* name of the class.cache file */
+  define("CLASS_CACHE", "class.cache"); /* name of the class cache */
 ?>
diff --git a/include/variables_common.inc b/include/variables_common.inc
new file mode 100644
index 0000000000000000000000000000000000000000..8732d8e6ec5e8ab52d6715933dfff8711f576116
--- /dev/null
+++ b/include/variables_common.inc
@@ -0,0 +1,58 @@
+<?php
+
+/*
+  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
+  Copyright (C) 2003-2010  Cajus Pollmeier
+  Copyright (C) 2011  FusionDirectory
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+/*! \file
+ * Define common locations and variables */
+
+/* Allow setting the config file in the apache configuration
+    e.g. SetEnv CONFIG_DIR /etc/fusiondirectory
+*/
+if(isset($_SERVER['CONFIG_DIR'])){
+  define ("CONFIG_DIR",$_SERVER['CONFIG_DIR']);
+}
+
+/* Allow setting the config file in the apache configuration
+    e.g.  SetEnv CONFIG_FILE fusiondirectory.conf 1.0
+ */
+if(isset($_SERVER['CONFIG_FILE'])){
+  define ("CONFIG_FILE",$_SERVER['CONFIG_FILE']);
+}
+
+/* php library path */
+define ("PHP_DIR", "/usr/share/php"); /*! Define php directory */
+
+/* fpdf library path */ 
+define("FPDF","/usr/share/php/fpdf/fpdf.php"); /*! Define fpdf library path */
+
+/* Global FPDF FONT define */
+define("FPDF_FONTPATH", "/usr/share/php/fpdf/font/"); /*! Define fpdf font path  */
+
+/* path for smarty libraries */
+define("SMARTY", "/usr/share/php/smarty/libs/Smarty.class.php"); /*! Define smarty2 library path */
+define("SMARTY3", "/usr/share/php/smarty3/Smarty.class.php"); /*! Define smarty3 library path */
+
+/* name of the utility used to create windows passwords */
+define ("MKNTPWD", "/usr/sbin/fusiondirectory-mkntpassword"); /*! Define the name of the binary used to create smb password */
+
+/* FusionDirectory Version */
+define ("FD_VERSION", "1.0.3"); /*! Define FusionDirectory version */
+?>