diff --git a/bin/centreon b/bin/centreon index 900ed5c455d..404d9973432 100755 --- a/bin/centreon +++ b/bin/centreon @@ -1,8 +1,8 @@ #!@PHP_BIN@ setLogin($options["u"]); $api->setPassword($options["p"]); $api->checkUser($useSha1, true); @@ -157,9 +156,6 @@ if (isset($options["w"]) && $options['o'] == "CentreonWorker" && !empty($options } } -/** - * Now works - */ if ($api->login == "" || $api->password == "") { if (file_exists($_SERVER["HOME"] . "/.centreonApi")) { $uid = posix_getpwuid(fileowner($_SERVER["HOME"] . "/.centreonApi")); diff --git a/bin/console b/bin/console index 22fd0d26f9c..7cbf0445ac2 100755 --- a/bin/console +++ b/bin/console @@ -1,5 +1,23 @@ #!@PHP_BIN@ /usr/share/centreon + default to [/usr/share/centreon] + > Path /usr/share/centreon OK - :: - Where is your Centreon log directory ? - default to [/usr/local/centreon/log] - > /var/log/centreon + default to [/var/log/centreon] + > Do you want me to create this directory ? [/var/log/centreon] [y/n], default to [n]: @@ -352,14 +349,7 @@ Definition of installation paths [y/n], default to [n]: > y Path /var/lib/centreon OK - - Where is rrdtool - default to [/usr/bin/rrdtool] - > /opt/rrdtool-broker/bin/rrdtool - /opt/rrdtool-broker/bin/rrdtool OK - - :: - + /usr/bin/rrdtool OK /usr/bin/mail OK Where is your php binary ? @@ -368,8 +358,8 @@ Definition of installation paths /usr/bin/php OK Where is PEAR [PEAR.php] - default to [/usr/share/pear/PEAR.php] - > /usr/share/php/PEAR.php + default to [/usr/share/php/PEAR.php] + > Path /usr/share/php/PEAR.php OK /usr/bin/perl OK Composer dependencies are installed OK @@ -379,6 +369,8 @@ Definition of installation paths Finding Apache user : www-data Finding Apache group : www-data +> **Notice**: If the PHP FPM folder is not found, you'll be asked to specify the path to the 'conf.d' file. For Ubuntu, using the PHP v 7.3 eg : /etc/php/7.3/fpm/pool.d/ + Centreon user and group ----------------------- @@ -415,7 +407,7 @@ the user will likely be *centreon-broker*. :: Monitoring logs directory ------------------------- -:: + :: What is the Monitoring engine log directory ?[/var/log/centreon-engine] default to [/var/log/centreon-engine] @@ -431,7 +423,7 @@ Monitoring logs directory Sudo configuration ------------------ -:: + :: ------------------------------------------------------------------------ Configure Sudo @@ -471,7 +463,7 @@ Sudo configuration Apache configuration -------------------- -:: + :: ------------------------------------------------------------------------ Configure Apache server @@ -492,7 +484,7 @@ Apache configuration PHP FPM configuration --------------------- -:: + :: ------------------------------------------------------------------------ Configure PHP FPM service @@ -501,30 +493,31 @@ PHP FPM configuration Do you want to add Centreon PHP FPM sub configuration file ? [y/n], default to [n]: > y - Creating directory /var/lib/centroen/sessions OK + Creating directory /var/lib/centreon/sessions OK Create 'etc/php/7.2/fpm/pool.d/centreon.conf' OK Configuring PHP FPM OK Do you want to reload PHP FPM service ? [y/n], default to [n]: > y - Reloading PHP FPM service OK Preparing Centreon temporary files - Change right on /var/log/centreon OK - Change right on /etc/centreon OK + Modify rights on /var/log/centreon OK + Modify rights on /var/lib/centreon/installs OK + Modify rights on /etc/centreon OK + Modify rights on /var/cache/centreon OK Change macros for insertBaseConf.sql OK Change macros for sql update files OK Change macros for php files OK - Change macros for php config file OK + Change macros for php env and config file OK Change macros for perl binary OK - Change right on /etc/centreon-engine OK + Modify rights on /etc/centreon-engine OK Add group centreon-broker to user www-data OK Add group centreon-broker to user centreon-engine OK Add group centreon to user centreon-broker OK - Change right on /etc/centreon-broker OK - Copy CentWeb in system directory OK + Modify rights on /etc/centreon-broker OK + Copy CentWeb in system directory Install CentWeb (web front of centreon) OK - Change right for install directory OK + Modify rights for install directory OK Install libraries OK Write right to Smarty Cache OK Change macros for centreon.cron OK @@ -533,10 +526,10 @@ PHP FPM configuration Change macros for downtimeManager.php OK Change macros for centreon-backup.pl OK Install cron directory OK - Change right for eventReportBuilder OK - Change right for dashboardBuilder OK - Change right for centreon-backup.pl OK - Change right for centreon-backup-mysql.pl OK + Modify rights for eventReportBuilder OK + Modify rights for dashboardBuilder OK + Modify rights for centreon-backup.pl OK + Modify rights for centreon-backup-mysql.sh OK Change macros for centreon.logrotate OK Install Centreon logrotate.d file OK Prepare centFillTrapDB OK @@ -549,21 +542,17 @@ PHP FPM configuration Install centreonSyncPlugins OK Prepare centreonSyncArchives OK Install centreonSyncArchives OK - Prepare generateSqlLite OK Install generateSqlLite OK Install changeRrdDsName.pl OK - Prepare export-mysql-indexes OK Install export-mysql-indexes OK - Prepare import-mysql-indexes OK Install import-mysql-indexes OK - Prepare clapi binary OK Install clapi binary OK Centreon Web Perl lib installed OK Pear module installation ------------------------ -:: + :: ------------------------------------------------------------------------ Pear Modules @@ -574,10 +563,12 @@ Pear module installation Date 1.4.6 1.4.7 OK All PEAR modules OK +> **Notice**: If the modules are not installed or up-to-date, you will be offered to do so. + Configuration file installation ------------------------------- -:: + :: ------------------------------------------------------------------------ Centreon Post Install @@ -585,10 +576,10 @@ Configuration file installation Create /usr/share/centreon/www/install/install.conf.php OK Create /etc/centreon/instCentWeb.conf OK -Performance data component (Centstorage) installation +Performance data component (CentStorage) installation ----------------------------------------------------- -:: + :: ------------------------------------------------------------------------ Starting CentStorage Installation @@ -617,17 +608,17 @@ Performance data component (Centstorage) installation install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/status' OK Creating Centreon Directory '/var/lib/centreon/metrics' OK - Change right : /var/run/centreon OK + Modify rights : /var/run/centreon OK Install logAnalyserBroker OK Install nagiosPerfTrace OK Change macros for centstorage.cron OK Install CentStorage cron OK Create /etc/centreon/instCentStorage.conf OK -Poller communication subsystem (Centcore) installation +Poller communication subsystem (CentCore) installation ------------------------------------------------------ -:: + :: ------------------------------------------------------------------------ Starting CentCore Installation @@ -639,8 +630,8 @@ Poller communication subsystem (Centcore) installation Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Copy CentCore in binary directory OK - Change right : /var/run/centreon OK - Change right : /var/lib/centreon OK + Modify rights : /var/run/centreon OK + Modify rights : /var/lib/centreon OK Change macros for centcore.logrotate OK Install Centreon Core logrotate.d file OK Replace CentCore init script Macro OK @@ -661,7 +652,7 @@ Poller communication subsystem (Centcore) installation Plugin installation ------------------- -:: + :: ------------------------------------------------------------------------ Starting Centreon Plugins Installation @@ -682,7 +673,7 @@ Plugin installation Centreon SNMP trap management installation ------------------------------------------ -:: + :: ------------------------------------------------------------------------ Starting CentreonTrapD Installation @@ -697,8 +688,8 @@ Centreon SNMP trap management installation /etc/snmp OK Where is your CentreonTrapd binaries directory ? - default to [/usr/local/centreon/bin] - > /usr/share/centreon/bin + default to [/usr/share/centreon/bin] + > /usr/share/centreon/bin OK Finding Apache user : www-data @@ -759,8 +750,7 @@ Once composer is installed, go to the centreon directory Macro modifications ------------------- -Macros may not have been properly replaced. Run the following commands to -correct their values: :: +> **Notice**: Macros may not have been properly replaced. Run the following commands to correct their values: :: $ sed -i -e 's/_CENTREON_PATH_PLACEHOLDER_/centreon/g' /usr/share/centreon/www/index.html $ sed -i -e 's/@PHP_BIN@/\/usr\/bin\/php/g' /usr/share/centreon/bin/centreon diff --git a/doc/en/upgrade/from_sources.rst b/doc/en/upgrade/from_sources.rst index 6b1ec77af1f..88139c86d91 100644 --- a/doc/en/upgrade/from_sources.rst +++ b/doc/en/upgrade/from_sources.rst @@ -35,7 +35,6 @@ go back to [Step 01] and install the prerequisites:: # Centreon (www.centreon.com) # # Thanks for using Centreon # # # - # vYY.MM.x # # # # infos@centreon.com # # # @@ -109,13 +108,13 @@ Certain new information are required. Specify the path to the binaries for Centr Specify the path for the additional data used by Centreon Web:: Where is your Centreon data information directory - default to [/usr/local/centreon/data] + default to [/usr/share/centreon/data] > - Do you want me to create this directory ? [/usr/local/centreon/data] + Do you want me to create this directory ? [/usr/share/centreon/data] [y/n], default to [n]: > y - Path /usr/local/centreon/data + Path /usr/share/centreon/data /usr/bin/composer OK /usr/bin/perl OK Check PHP version OK @@ -269,7 +268,7 @@ Apache configuration ------------------------------------------------------------------------ Centreon Post Install ------------------------------------------------------------------------ - Create /usr/local/centreon/www/install/install.conf.php OK + Create /usr/share/centreon/www/install/install.conf.php OK Create /etc/centreon/instCentWeb.conf OK Upgrading Centreon Storage diff --git a/doc/fr/installation/common/install_packages.rst b/doc/fr/installation/common/install_packages.rst index d1e46eee907..7695ac101ef 100644 --- a/doc/fr/installation/common/install_packages.rst +++ b/doc/fr/installation/common/install_packages.rst @@ -139,7 +139,7 @@ cette option dans /etc/my.cnf *ne fonctionnera pas*. **Pour MariaDB** : :: # mkdir -p /etc/systemd/system/mariadb.service.d/ - # echo -ne "[Service]\nLimitNOFILE=32000\n" | tee /etc/systemd/system/mariadb.service.d/limits.conf + # echo -ne "[Service]\nLimitNOFILE=32000\n" | tee /etc/systemd/system/mariadb.service.d/centreon.conf # systemctl daemon-reload # systemctl restart mysql diff --git a/doc/fr/installation/common/web_install.rst b/doc/fr/installation/common/web_install.rst index da3187bf604..c4712dee154 100644 --- a/doc/fr/installation/common/web_install.rst +++ b/doc/fr/installation/common/web_install.rst @@ -59,6 +59,7 @@ Cliquez sur **Next**. [mysqld] innodb_file_per_table=1 + open_files_limit=32000 4. Redémarrez le service mysql: :: diff --git a/doc/fr/installation/from_sources.rst b/doc/fr/installation/from_sources.rst index db0a0d0336a..bf74a488b94 100644 --- a/doc/fr/installation/from_sources.rst +++ b/doc/fr/installation/from_sources.rst @@ -218,7 +218,7 @@ Déplacez-vous dans le répertoire extrait : :: $ cd centreon-YY.MM.x -Exécutez le script d'installation : :: +Exécutez le script d'installation en tant qu'utilisateur root ou en utilisant la commande 'sudo': :: $ ./install.sh -i @@ -247,7 +247,6 @@ d'installation des prérequis : :: # Centreon (www.centreon.com) # # Thanks for using Centreon # # # - # vYY.MM.x # # # # infos@centreon.com # # # @@ -316,22 +315,20 @@ Répondez [y] à toutes les questions :: Définition des chemins d'installation ------------------------------------- -:: + :: ------------------------------------------------------------------------ Start CentWeb Installation ------------------------------------------------------------------------ Where is your Centreon directory ? - default to [/usr/local/centreon] - > /usr/share/centreon + default to [/usr/share/centreon] + > Path /usr/share/centreon OK - :: - Where is your Centreon log directory ? - default to [/usr/local/centreon/log] - > /var/log/centreon + default to [/var/log/centreon] + > Do you want me to create this directory ? [/var/log/centreon] [y/n], default to [n]: @@ -357,14 +354,7 @@ Définition des chemins d'installation [y/n], default to [n]: > y Path /var/lib/centreon OK - - Where is rrdtool - default to [/usr/bin/rrdtool] - > /opt/rrdtool-broker/bin/rrdtool - /opt/rrdtool-broker/bin/rrdtool OK - - :: - + /usr/bin/rrdtool OK /usr/bin/mail OK Where is your php binary ? @@ -373,8 +363,8 @@ Définition des chemins d'installation /usr/bin/php OK Where is PEAR [PEAR.php] - default to [/usr/share/pear/PEAR.php] - > /usr/share/php/PEAR.php + default to [/usr/share/php/PEAR.php] + > Path /usr/share/php/PEAR.php OK /usr/bin/perl OK Composer dependencies are installed OK @@ -384,6 +374,8 @@ Définition des chemins d'installation Finding Apache user : www-data Finding Apache group : www-data +> **Notice**: Si le répertoire de PHP FPM n'est pas trouvé, il vous sera demandé de spécifier le chemin vers le fichier 'conf.d'. Par exemple sur Ubuntu, en utilisant le PHP 7.3 : /etc/php/7.3/fpm/pool.d/ + Utilisateur et groupe centreon ------------------------------ @@ -420,7 +412,7 @@ l'utilisateur sera vraisemblablement *centreon-broker*. :: Répertoire des journaux d'évènements ------------------------------------ -:: + :: What is the Monitoring engine log directory ?[/var/log/centreon-engine] default to [/var/log/centreon-engine] @@ -436,7 +428,7 @@ Répertoire des journaux d'évènements Configuration des droits sudo ----------------------------- -:: + :: ------------------------------------------------------------------------ Configure Sudo @@ -478,7 +470,7 @@ Configuration des droits sudo Configuration du serveur Apache ------------------------------- -:: + :: ------------------------------------------------------------------------ Configure Apache server @@ -498,7 +490,7 @@ Configuration du serveur Apache Configuration de PHP FPM ------------------------ -:: + :: ------------------------------------------------------------------------ Configure PHP FPM service @@ -507,7 +499,7 @@ Configuration de PHP FPM Do you want to add Centreon PHP FPM sub configuration file ? [y/n], default to [n]: > y - Creating directory /var/lib/centroen/sessions OK + Creating directory /var/lib/centreon/sessions OK Create 'etc/php/7.2/fpm/pool.d/centreon.conf' OK Configuring PHP FPM OK @@ -516,21 +508,21 @@ Configuration de PHP FPM > y Reloading PHP FPM service OK Preparing Centreon temporary files - Change right on /var/log/centreon OK - Change right on /etc/centreon OK + Modify rights on /var/log/centreon OK + Modify rights on /etc/centreon OK Change macros for insertBaseConf.sql OK Change macros for sql update files OK Change macros for php files OK Change macros for php config file OK Change macros for perl binary OK - Change right on /etc/centreon-engine OK + Modify rights on /etc/centreon-engine OK Add group centreon-broker to user www-data OK Add group centreon-broker to user centreon-engine OK Add group centreon to user centreon-broker OK - Change right on /etc/centreon-broker OK + Modify rights on /etc/centreon-broker OK Copy CentWeb in system directory OK Install CentWeb (web front of centreon) OK - Change right for install directory OK + Modify rights for install directory OK Install libraries OK Write right to Smarty Cache OK Change macros for centreon.cron OK @@ -539,10 +531,10 @@ Configuration de PHP FPM Change macros for downtimeManager.php OK Change macros for centreon-backup.pl OK Install cron directory OK - Change right for eventReportBuilder OK - Change right for dashboardBuilder OK - Change right for centreon-backup.pl OK - Change right for centreon-backup-mysql.pl OK + Modify rights for eventReportBuilder OK + Modify rights for dashboardBuilder OK + Modify rights for centreon-backup.pl OK + Modify rights for centreon-backup-mysql.pl OK Change macros for centreon.logrotate OK Install Centreon logrotate.d file OK Prepare centFillTrapDB OK @@ -569,7 +561,7 @@ Configuration de PHP FPM Installation des modules pear ----------------------------- -:: + :: ------------------------------------------------------------------------ Pear Modules @@ -580,10 +572,12 @@ Installation des modules pear Date 1.4.6 1.4.7 OK All PEAR modules OK +> **Notice**: Si des modules ne sont pas installés ou mis à jour, il vous sera proposé de le faire. + Installation du fichier de configuration ---------------------------------------- -:: + :: ------------------------------------------------------------------------ Centreon Post Install @@ -591,10 +585,10 @@ Installation du fichier de configuration Create /usr/share/centreon/www/install/install.conf.php OK Create /etc/centreon/instCentWeb.conf OK -Installation du composant Centstorage +Installation du composant CentStorage ------------------------------------- -:: + :: ------------------------------------------------------------------------ Starting CentStorage Installation @@ -623,17 +617,17 @@ Installation du composant Centstorage install www/install/createTablesCentstorage.sql OK Creating Centreon Directory '/var/lib/centreon/status' OK Creating Centreon Directory '/var/lib/centreon/metrics' OK - Change right : /var/run/centreon OK + Modify rights : /var/run/centreon OK Install logAnalyserBroker OK Install nagiosPerfTrace OK Change macros for centstorage.cron OK Install CentStorage cron OK Create /etc/centreon/instCentStorage.conf OK -Installation du composant Centcore +Installation du composant CentCore ---------------------------------- -:: + :: ------------------------------------------------------------------------ Starting CentCore Installation @@ -645,8 +639,8 @@ Installation du composant Centcore Preparing Centreon temporary files /tmp/centreon-setup exists, it will be moved... Copy CentCore in binary directory OK - Change right : /var/run/centreon OK - Change right : /var/lib/centreon OK + Modify rights : /var/run/centreon OK + Modify rights : /var/lib/centreon OK Change macros for centcore.logrotate OK Install Centreon Core logrotate.d file OK Replace CentCore init script Macro OK @@ -667,7 +661,7 @@ Installation du composant Centcore Installation des plugins ------------------------ -:: + :: ------------------------------------------------------------------------ Starting Centreon Plugins Installation @@ -688,7 +682,7 @@ Installation des plugins Installation du système de gestion des traps SNMP (CentreonTrapD) ----------------------------------------------------------------- -:: + :: ------------------------------------------------------------------------ Starting CentreonTrapD Installation @@ -703,8 +697,8 @@ Installation du système de gestion des traps SNMP (CentreonTrapD) /etc/snmp OK Where is your CentreonTrapd binaries directory ? - default to [/usr/local/centreon/bin] - > /usr/share/centreon/bin + default to [/usr/share/centreon/bin] + > /usr/share/centreon/bin OK Finding Apache user : www-data @@ -765,8 +759,7 @@ Une fois que composer est installé, rendez-vous dans les répertoires Centreon Modification des macro ---------------------- -Il se peut que des macros n'aient pas été remplacées. Exécutez les commandes -suivantes pour corriger leurs valeurs : :: +> **Notice**: Il se peut que des macros n'aient pas été remplacées. Exécutez les commandes suivantes pour corriger leurs valeurs : :: $ sed -i -e 's/_CENTREON_PATH_PLACEHOLDER_/centreon/g' /usr/share/centreon/www/index.html $ sed -i -e 's/@PHP_BIN@/\/usr\/bin\/php/g' /usr/share/centreon/bin/centreon diff --git a/doc/fr/upgrade/from_sources.rst b/doc/fr/upgrade/from_sources.rst index 01b2a3d36b9..f5b448963f2 100644 --- a/doc/fr/upgrade/from_sources.rst +++ b/doc/fr/upgrade/from_sources.rst @@ -35,7 +35,6 @@ revenir à l'étape [Step 01] et installer les prérequis : :: # Centreon (www.centreon.com) # # Thanks for using Centreon # # # - # vYY.MM.x # # # # infos@centreon.com # # # @@ -111,13 +110,13 @@ Le chemin vers les binaires de centreon : :: Le chemin des données supplémentaires de Centreon Web : :: Where is your Centreon data information directory - default to [/usr/local/centreon/data] + default to [/usr/share/centreon/data] > - Do you want me to create this directory ? [/usr/local/centreon/data] + Do you want me to create this directory ? [/usr/share/centreon/data] [y/n], default to [n]: > y - Path /usr/local/centreon/data + Path /usr/share/centreon/data /usr/bin/composer OK /usr/bin/perl OK Check PHP version OK @@ -271,7 +270,7 @@ Configuration d'Apache ------------------------------------------------------------------------ Centreon Post Install ------------------------------------------------------------------------ - Create /usr/local/centreon/www/install/install.conf.php OK + Create /usr/share/centreon/www/install/install.conf.php OK Create /etc/centreon/instCentWeb.conf OK Mise à jour de Centreon Storage diff --git a/install.sh b/install.sh index 7785188027e..9047fc057b6 100755 --- a/install.sh +++ b/install.sh @@ -2,6 +2,7 @@ #---- ## @Synopsis Install Script for Centreon project ## @Copyright Copyright 2008, Guillaume Watteeux +## @Copyright Copyright 2008-2020, Centreon ## @License GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ## Centreon Install Script ## Use @@ -14,27 +15,24 @@ ## -h print usage ## #---- -################################################################### -# Centreon is developed with GPL Licence 2.0 -# -# GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt -# -# Developed by : Julien Mathis - Romain Le Merlus -# Contributors : Guillaume Watteeux - Maximilien Bersoult -# -################################################################### -# 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. -# -# For information : infos@centreon.com -#################################################################### +## Centreon is developed with GPL Licence 2.0 +## +## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +## +## Developed by : Julien Mathis - Romain Le Merlus +## Contributors : Guillaume Watteeux - Maximilien Bersoult +## +## 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. +## +## For information : infos@centreon.com # # Todo list # - upgrade process @@ -414,6 +412,8 @@ fi purge_centreon_tmp_dir "silent" server=$(hostname -f) +# Replace global variables + ${CAT} << __EOT__ ############################################################################### # # diff --git a/libinstall/CentCore.sh b/libinstall/CentCore.sh index 6a9ffe071a5..b7f006d5afd 100755 --- a/libinstall/CentCore.sh +++ b/libinstall/CentCore.sh @@ -2,12 +2,28 @@ #---- ## @Synopsis Install script for CentCore ## @Copyright Copyright 2008, Guillaume Watteeux +## @Copyright Copyright 2008-2020, Centreon ## @license GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ## Install script for CentCore #---- -# install script for centcore -################################# -# SVN: $Id$ +## Centreon is developed with GPL Licence 2.0 +## +## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +## +## Developed by : Julien Mathis - Romain Le Merlus +## Contributors : Guillaume Watteeux - Maximilien Bersoult +## +## 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. +## +## For information : infos@centreon.com echo -e "\n$line" echo -e "\t$(gettext "Starting CentCore Installation")" diff --git a/libinstall/CentPlugins.sh b/libinstall/CentPlugins.sh index 5ca60544e1d..cd8d6d2c862 100755 --- a/libinstall/CentPlugins.sh +++ b/libinstall/CentPlugins.sh @@ -2,12 +2,28 @@ #---- ## @Synopsis Install script for CentPlugins ## @Copyright Copyright 2008, Guillaume Watteeux +## @Copyright Copyright 2008-2020, Centreon ## @license GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ## Install script for CentPlugins #---- -# install script for CentPlugins -################################# -# SVN: $Id$ +## Centreon is developed with GPL Licence 2.0 +## +## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +## +## Developed by : Julien Mathis - Romain Le Merlus +## Contributors : Guillaume Watteeux - Maximilien Bersoult +## +## 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. +## +## For information : infos@centreon.com echo -e "\n$line" echo -e "\t$(gettext "Starting Centreon Plugins Installation")" diff --git a/libinstall/CentPluginsTraps.sh b/libinstall/CentPluginsTraps.sh index 43f40259eee..9eb52c04662 100755 --- a/libinstall/CentPluginsTraps.sh +++ b/libinstall/CentPluginsTraps.sh @@ -2,12 +2,28 @@ #---- ## @Synopsis Install script for CentPluginsTraps ## @Copyright Copyright 2008, Guillaume Watteeux +## @Copyright Copyright 2008-2020, Centreon ## @license GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ## Install script for CentPluginsTraps #---- -# install script for CentPlugins -################################# -# SVN: $Id$ +## Centreon is developed with GPL Licence 2.0 +## +## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +## +## Developed by : Julien Mathis - Romain Le Merlus +## Contributors : Guillaume Watteeux - Maximilien Bersoult +## +## 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. +## +## For information : infos@centreon.com echo -e "\n$line" echo -e "\t$(gettext "Starting CentreonTrapD Installation")" diff --git a/libinstall/CentStorage.sh b/libinstall/CentStorage.sh index a760dd4276b..40dd2027033 100755 --- a/libinstall/CentStorage.sh +++ b/libinstall/CentStorage.sh @@ -2,12 +2,28 @@ #---- ## @Synopsis Install script for CentStorage ## @Copyright Copyright 2008, Guillaume Watteeux +## @Copyright Copyright 2008-2020, Centreon ## @license GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ## Install script for CentStorage #---- -# install centreon centstorage -################################# -# SVN: $Id$ +## Centreon is developed with GPL Licence 2.0 +## +## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +## +## Developed by : Julien Mathis - Romain Le Merlus +## Contributors : Guillaume Watteeux - Maximilien Bersoult +## +## 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. +## +## For information : infos@centreon.com echo -e "\n$line" echo -e "\t$(gettext "Starting CentStorage Installation")" diff --git a/libinstall/CentWeb.sh b/libinstall/CentWeb.sh index 96e26362876..9007d476e4c 100755 --- a/libinstall/CentWeb.sh +++ b/libinstall/CentWeb.sh @@ -2,12 +2,29 @@ #---- ## @Synopsis Install script for Centreon Web Front (CentWeb) ## @Copyright Copyright 2008, Guillaume Watteeux +## @Copyright Copyright 2008-2020, Centreon ## @license GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ## Install script for Centreon Web Front (CentWeb) #---- -# Install script for Centreon Web Front -################################# -# SVN: $Id$ +#---- +## Centreon is developed with GPL Licence 2.0 +## +## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +## +## Developed by : Julien Mathis - Romain Le Merlus +## Contributors : Guillaume Watteeux - Maximilien Bersoult +## +## 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. +## +## For information : infos@centreon.com # debug ? #set -x @@ -117,29 +134,36 @@ copyInTempFile 2>>$LOG_FILE ## InstallCentreon -# change right centreon_log directory -log "INFO" "$(gettext "Change right on") $CENTREON_LOG" +# change rights centreon_log directory +log "INFO" "$(gettext "Modify rights on") $CENTREON_LOG" $INSTALL_DIR/cinstall $cinstall_opts \ -u "$CENTREON_USER" -g "$CENTREON_GROUP" -d 775 \ "$CENTREON_LOG" >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Change right on") $CENTREON_LOG" +check_result $? "$(gettext "Modify rights on") $CENTREON_LOG" -# change right on successful installations files -log "INFO" "$(gettext "Change right on") $CENTREON_VARLIB/installs" +# change rights on successful installations files +log "INFO" "$(gettext "Modify rights on") $CENTREON_VARLIB/installs" $INSTALL_DIR/cinstall $cinstall_opts \ -u "$CENTREON_USER" -g "$CENTREON_GROUP" -d 775 \ "$CENTREON_VARLIB/installs" >> "$LOG_FILE" 2>&1 chmod -R g+rwxs $CENTREON_VARLIB/installs -check_result $? "$(gettext "Change right on") $CENTREON_VARLIB/installs" +check_result $? "$(gettext "Modify rights on") $CENTREON_VARLIB/installs" -# change right on centreon etc -log "INFO" "$(gettext "Change right on") $CENTREON_ETC" +# change rights on centreon etc +log "INFO" "$(gettext "Modify rights on") $CENTREON_ETC" $INSTALL_DIR/cinstall $cinstall_opts \ -u "$CENTREON_USER" -g "$CENTREON_GROUP" -d 775 \ "$CENTREON_ETC" >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Change right on") $CENTREON_ETC" +check_result $? "$(gettext "Modify rights on") $CENTREON_ETC" + +# change rights on centreon cache folder +log "INFO" "$(gettext "Modify rights on") $CENTREON_CACHEDIR" +$INSTALL_DIR/cinstall $cinstall_opts \ + -u "$CENTREON_USER" -g "$CENTREON_GROUP" -d 775 \ + "$CENTREON_CACHEDIR" >> "$LOG_FILE" 2>&1 +check_result $? "$(gettext "Modify rights on") $CENTREON_CACHEDIR" -## Copy Web Front Source in final +## Copy Web Front and Backend Sources in final folder log "INFO" "$(gettext "Copy CentWeb and GPL_LIB in temporary final directory")" cp -Rf $TMP_DIR/src/api $TMP_DIR/final cp -Rf $TMP_DIR/src/www $TMP_DIR/final @@ -152,6 +176,7 @@ cp -f $TMP_DIR/src/composer.json $TMP_DIR/final cp -f $TMP_DIR/src/package.json $TMP_DIR/final cp -f $TMP_DIR/src/package-lock.json $TMP_DIR/final cp -f $TMP_DIR/src/.env $TMP_DIR/final +cp -f $TMP_DIR/src/.env.local.php $TMP_DIR/final cp -Rf $TMP_DIR/src/src $TMP_DIR/final ## Prepare and copy composer module @@ -202,7 +227,7 @@ log "INFO" "$( gettext "Copying www/install/insertBaseConf.sql in final director cp $TMP_DIR/work/www/install/insertBaseConf.sql \ $TMP_DIR/final/www/install/insertBaseConf.sql >> "$LOG_FILE" 2>&1 -### Chagne Macro for sql update file +### Change Macro for sql update file macros="@CENTREON_ETC@,@CENTREON_CACHEDIR@,@CENTPLUGINSTRAPS_BINDIR@,@CENTREON_LOG@,@CENTREON_VARLIB@,@CENTREON_ENGINE_CONNECTORS@" find_macros_in_dir "$macros" "$TMP_DIR/src/" "www" "Update*.sql" "file_sql_temp" @@ -226,16 +251,20 @@ ${CAT} "$file_sql_temp" | while read file ; do done check_result $flg_error "$(gettext "Change macros for sql update files")" -### Step 2.0: Change right on Centreon WebFront +### Step 2.0: Modify rights on Centreon WebFront and replace macros + +## create a random APP_SECRET key +HEX_KEY=($(dd if=/dev/urandom bs=32 count=1 status=none | $PHP_BIN -r "echo bin2hex(fread(STDIN, 32));")) +log "INFO" "$(gettext "Generated a random key") : $HEX_KEY" ## use this step to change macros on php file... -macros="@CENTREON_ETC@,@CENTREON_CACHEDIR@,@CENTPLUGINSTRAPS_BINDIR@,@CENTREON_LOG@,@CENTREON_VARLIB@,@CENTREONTRAPD_BINDIR@" +macros="@CENTREON_ETC@,@CENTREON_CACHEDIR@,@CENTPLUGINSTRAPS_BINDIR@,@CENTREON_LOG@,@CENTREON_VARLIB@,@CENTREONTRAPD_BINDIR@,@PHP_BIN@" find_macros_in_dir "$macros" "$TMP_DIR/src/" "www" "*.php" "file_php_temp" - -log "INFO" "$(gettext "Apply macros")" +find_macros_in_dir "$macros" "$TMP_DIR/src/" "bin" "*" "file_bin_temp" +log "INFO" "$(gettext "Apply macros on php files")" flg_error=0 -${CAT} "$file_php_temp" | while read file ; do +${CAT} "$file_php_temp" "$file_bin_temp" | while read file ; do log "MACRO" "$(gettext "Change macro for") : $file" [ ! -d $(dirname $TMP_DIR/work/$file) ] && \ mkdir -p $(dirname $TMP_DIR/work/$file) >> $LOG_FILE 2>&1 @@ -245,6 +274,7 @@ ${CAT} "$file_php_temp" | while read file ; do -e 's|@CENTREONTRAPD_BINDIR@|'"$CENTREON_BINDIR"'|g' \ -e 's|@CENTREON_VARLIB@|'"$CENTREON_VARLIB"'|g' \ -e 's|@CENTREON_LOG@|'"$CENTREON_LOG"'|g' \ + -e 's|@PHP_BIN@|'"$PHP_BIN"'|g' \ $TMP_DIR/src/$file > $TMP_DIR/work/$file [ $? -ne 0 ] && flg_error=1 log "MACRO" "$(gettext "Copy in final dir") : $file" @@ -252,13 +282,13 @@ ${CAT} "$file_php_temp" | while read file ; do done check_result $flg_error "$(gettext "Change macros for php files")" -macros="@CENTREON_ETC@,@CENTREON_CACHEDIR@,@CENTPLUGINSTRAPS_BINDIR@,@CENTREON_LOG@,@CENTREON_VARLIB@,@CENTREONTRAPD_BINDIR@" +macros="@CENTREON_ETC@,@CENTREON_CACHEDIR@,@CENTPLUGINSTRAPS_BINDIR@,@CENTREON_LOG@,@CENTREON_VARLIB@,@CENTREONTRAPD_BINDIR@,%APP_SECRET%" find_macros_in_dir "$macros" "$TMP_DIR/src" "config" "*.php*" "file_php_config_temp" - -log "INFO" "$(gettext "Apply macros")" +find_macros_in_dir "$macros" "$TMP_DIR/src/" "." ".env*" "file_env_temp" +log "INFO" "$(gettext "Apply macros on env and config files")" flg_error=0 -${CAT} "$file_php_config_temp" | while read file ; do +${CAT} "$file_php_config_temp" "$file_env_temp" | while read file ; do log "MACRO" "$(gettext "Change macro for") : $file" [ ! -d $(dirname $TMP_DIR/work/$file) ] && \ mkdir -p $(dirname $TMP_DIR/work/$file) >> $LOG_FILE 2>&1 @@ -268,12 +298,13 @@ ${CAT} "$file_php_config_temp" | while read file ; do -e 's|@CENTREONTRAPD_BINDIR@|'"$CENTREON_BINDIR"'|g' \ -e 's|@CENTREON_VARLIB@|'"$CENTREON_VARLIB"'|g' \ -e 's|@CENTREON_LOG@|'"$CENTREON_LOG"'|g' \ + -e 's|%APP_SECRET%|'"$HEX_KEY"'|g' \ $TMP_DIR/src/$file > $TMP_DIR/work/$file [ $? -ne 0 ] && flg_error=1 log "MACRO" "$(gettext "Copy in final dir") : $file" cp -f $TMP_DIR/work/$file $TMP_DIR/final/$file >> $LOG_FILE 2>&1 done -check_result $flg_error "$(gettext "Change macros for php config file")" +check_result $flg_error "$(gettext "Change macros for php env and config file")" ### Step 2.1 : replace macro for perl binary @@ -301,8 +332,8 @@ ${CAT} "$file_perl_temp" | while read file ; do done check_result $flg_error "$(gettext "Change macros for perl binary")" -### Step 3: Change right on monitoringengine_etcdir -log "INFO" "$(gettext "Change right on") $MONITORINGENGINE_ETC" +### Step 3: Modify rights on monitoring engine /etc/centreon folder +log "INFO" "$(gettext "Modify rights on") $MONITORINGENGINE_ETC" flg_error=0 $INSTALL_DIR/cinstall $cinstall_opts \ -g "$MONITORINGENGINE_GROUP" -d 775 \ @@ -315,10 +346,10 @@ find "$MONITORINGENGINE_ETC" -type f -print | \ find "$MONITORINGENGINE_ETC" -type f -print | \ xargs -I '{}' ${CHOWN} "$MONITORINGENGINE_USER":"$MONITORINGENGINE_GROUP" '{}' >> "$LOG_FILE" 2>&1 [ $? -ne 0 ] && flg_error=1 -check_result $flg_error "$(gettext "Change right on") $MONITORINGENGINE_ETC" +check_result $flg_error "$(gettext "Modify rights on") $MONITORINGENGINE_ETC" -### Change right to broker_etcdir -log "INFO" "$(gettext "Change right on ") $BROKER_ETC" +### Modify rights to broker /etc/centreon-broker folder +log "INFO" "$(gettext "Modify rights on ") $BROKER_ETC" flg_error=0 if [ -z "$BROKER_USER" ]; then BROKER_USER=$MONITORINGENGINE_USER @@ -340,7 +371,7 @@ if [ "$MONITORINGENGINE_ETC" != "$BROKER_ETC" ]; then find "$BROKER_ETC" -type f -print | \ xargs -I '{}' ${CHOWN} "$BROKER_USER":"$BROKER_GROUP" '{}' >> "$LOG_FILE" 2>&1 [ $? -ne 0 ] && flg_error=1 - check_result $flg_error "$(gettext "Change right on") $BROKER_ETC" + check_result $flg_error "$(gettext "Modify rights on") $BROKER_ETC" fi if [ "$upgrade" = "1" ]; then @@ -349,7 +380,7 @@ if [ "$upgrade" = "1" ]; then check_result $? "$(gettext "All users are disconnected")" fi -### Step 4: Copy final stuff in system directoy +### Step 4: Copy final stuff in system folder echo_info "$(gettext "Copy CentWeb in system directory")" $INSTALL_DIR/cinstall $cinstall \ -u "$CENTREON_USER" -g "$CENTREON_GROUP" -d 775 \ @@ -371,9 +402,9 @@ $CHOWN -R $WEB_USER:$WEB_GROUP $INSTALL_DIR_CENTREON/src cp -Rf $TMP_DIR/final/api $INSTALL_DIR_CENTREON/ >> "$LOG_FILE" 2>&1 $CHOWN -R $WEB_USER:$WEB_GROUP $INSTALL_DIR_CENTREON/api -log "INFO" "$(gettext "Change right for install directory")" +log "INFO" "$(gettext "Modify rights for install directory")" $CHOWN -R $WEB_USER:$WEB_GROUP $INSTALL_DIR_CENTREON/www/install/ -check_result $? "$(gettext "Change right for install directory")" +check_result $? "$(gettext "Modify rights for install directory")" [ ! -d "$INSTALL_DIR_CENTREON/www/modules" ] && \ $INSTALL_DIR/cinstall $cinstall_opts \ @@ -391,6 +422,9 @@ $CHOWN $WEB_USER:$WEB_GROUP $INSTALL_DIR_CENTREON/bootstrap.php cp -f $TMP_DIR/final/.env $INSTALL_DIR_CENTREON/.env >> "$LOG_FILE" 2>&1 $CHOWN $WEB_USER:$WEB_GROUP $INSTALL_DIR_CENTREON/.env +cp -f $TMP_DIR/final/.env.local.php $INSTALL_DIR_CENTREON/.env.local.php >> "$LOG_FILE" 2>&1 +$CHOWN $WEB_USER:$WEB_GROUP $INSTALL_DIR_CENTREON/.env.local.php + cp -f $TMP_DIR/final/container.php $INSTALL_DIR_CENTREON/container.php >> "$LOG_FILE" 2>&1 $CHOWN $WEB_USER:$WEB_GROUP $INSTALL_DIR_CENTREON/container.php @@ -434,9 +468,9 @@ $INSTALL_DIR/cinstall $cinstall_opts \ $TMP_DIR/final/GPL_LIB/* $INSTALL_DIR_CENTREON/GPL_LIB/ >> "$LOG_FILE" 2>&1 check_result $? "$(gettext "Install libraries")" -log "INFO" "$(gettext "Add right for Smarty cache and compile")" +log "INFO" "$(gettext "Add rights for Smarty cache and compile")" $CHMOD -R g+w $INSTALL_DIR_CENTREON/GPL_LIB/SmartyCache -check_result $? "$(gettext "Write right to Smarty Cache")" +check_result $? "$(gettext "Write rights to Smarty Cache")" ## Cron stuff ## need to add stuff for Unix system... (freeBSD...) @@ -492,21 +526,21 @@ $INSTALL_DIR/cinstall $cinstall_opts \ $TMP_DIR/final/cron/* $INSTALL_DIR_CENTREON/cron/ >> "$LOG_FILE" 2>&1 check_result $? "$(gettext "Install cron directory")" -log "INFO" "$(gettext "Change right for eventReportBuilder")" +log "INFO" "$(gettext "Modify rights for eventReportBuilder")" ${CHMOD} 755 $INSTALL_DIR_CENTREON/cron/eventReportBuilder >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Change right for eventReportBuilder")" +check_result $? "$(gettext "Modify rights for eventReportBuilder")" -log "INFO" "$(gettext "Change right for dashboardBuilder")" +log "INFO" "$(gettext "Modify rights for dashboardBuilder")" ${CHMOD} 755 $INSTALL_DIR_CENTREON/cron/dashboardBuilder >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Change right for dashboardBuilder")" +check_result $? "$(gettext "Modify rights for dashboardBuilder")" -log "INFO" "$(gettext "Change right for centreon-backup.pl")" +log "INFO" "$(gettext "Modify rights for centreon-backup.pl")" ${CHMOD} 755 $INSTALL_DIR_CENTREON/cron/centreon-backup.pl >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Change right for centreon-backup.pl")" +check_result $? "$(gettext "Modify rights for centreon-backup.pl")" -log "INFO" "$(gettext "Change right for centreon-backup-mysql.sh")" +log "INFO" "$(gettext "Modify rights for centreon-backup-mysql.sh")" ${CHMOD} 755 $INSTALL_DIR_CENTREON/cron/centreon-backup-mysql.sh >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Change right for centreon-backup-mysql.sh")" +check_result $? "$(gettext "Modify rights for centreon-backup-mysql.sh")" ## Logrotate log "INFO" "$(gettext "Change macros for centreon.logrotate")" @@ -587,11 +621,6 @@ $INSTALL_DIR/cinstall $cinstall_opts \ check_result $? "$(gettext "Install centreonSyncArchives")" ## Install generateSqlLite -log "INFO" "$(gettext "Prepare generateSqlLite")" -cp $TMP_DIR/src/bin/generateSqlLite \ - $TMP_DIR/final/bin/generateSqlLite >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Prepare generateSqlLite")" - log "INFO" "$(gettext "Install generateSqlLite")" $INSTALL_DIR/cinstall $cinstall_opts \ -m 755 \ @@ -608,11 +637,6 @@ $INSTALL_DIR/cinstall $cinstall_opts \ check_result $? "$(gettext "Install changeRrdDsName.pl")" ## Install binaries for check indexes -log "INFO" "$(gettext "Prepare export-mysql-indexes")" -cp $TMP_DIR/src/bin/export-mysql-indexes \ - $TMP_DIR/final/bin/export-mysql-indexes >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Prepare export-mysql-indexes")" - log "INFO" "$(gettext "Install export-mysql-indexes")" $INSTALL_DIR/cinstall $cinstall_opts \ -m 755 \ @@ -620,11 +644,6 @@ $INSTALL_DIR/cinstall $cinstall_opts \ $CENTREON_BINDIR/export-mysql-indexes >> $LOG_FILE 2>&1 check_result $? "$(gettext "Install export-mysql-indexes")" -log "INFO" "$(gettext "Prepare import-mysql-indexes")" -cp $TMP_DIR/src/bin/import-mysql-indexes \ - $TMP_DIR/final/bin/import-mysql-indexes >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Prepare import-mysql-indexes")" - log "INFO" "$(gettext "Install import-mysql-indexes")" $INSTALL_DIR/cinstall $cinstall_opts \ -m 755 \ @@ -633,11 +652,6 @@ $INSTALL_DIR/cinstall $cinstall_opts \ check_result $? "$(gettext "Install import-mysql-indexes")" # Install Centreon CLAPI command line -log "INFO" "$(gettext "Prepare clapi binary")" -cp $TMP_DIR/src/bin/centreon \ - $TMP_DIR/final/bin/centreon >> "$LOG_FILE" 2>&1 -check_result $? "$(gettext "Prepare clapi binary")" - log "INFO" "$(gettext "Install clapi binary")" $INSTALL_DIR/cinstall $cinstall_opts \ -m 755 \ @@ -717,4 +731,3 @@ createConfFile createCentreonInstallConf ## wait sql inject script.... - diff --git a/libinstall/cinstall b/libinstall/cinstall index 9e8b5fa334a..c3a370f6062 100755 --- a/libinstall/cinstall +++ b/libinstall/cinstall @@ -1,8 +1,8 @@ #!/usr/bin/env bash - #---- ## @Synopsis Redefine install command for Centreon Install ## @Copyright Copyright 2008, Guillaume Watteeux +## @Copyright Copyright 2008-2020, Centreon ## @License GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ## This program is't a "fork" of install command. Specificly develop for ## Centreon Install Script. @@ -36,10 +36,12 @@ ## -v verbose mode ## #---- -## Centreon is developped with GPL Licence 2.0 -## -## Developped by : Julien Mathis - Romain Le Merlus -## Contribute : Guillaume Watteeux - Maximilien Bersoult +## Centreon is developed with GPL Licence 2.0 +## +## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +## +## Developed by : Julien Mathis - Romain Le Merlus +## Contributors : Guillaume Watteeux - Maximilien Bersoult ## ## This program is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License @@ -52,7 +54,6 @@ ## GNU General Public License for more details. ## ## For information : infos@centreon.com -# SVN: $Id$ # Enable Shell debug ? #set -x diff --git a/libinstall/functions b/libinstall/functions index 5832bc984f6..d7e65fab8ae 100755 --- a/libinstall/functions +++ b/libinstall/functions @@ -1,14 +1,29 @@ #!/bin/sh - #---- ## @Synopsis This file contains functions to be used by Centreon install scripts ## @Copyright Copyright 2008, Guillaume Watteeux +## @Copyright Copyright 2008-2020, Centreon ## @Licence GPLv2 ## This file contains functions to be used by Centreon install scripts #---- - -################################# -# SVN: $Id$ +## Centreon is developed with GPL Licence 2.0 +## +## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +## +## Developed by : Julien Mathis - Romain Le Merlus +## Contributors : Guillaume Watteeux - Maximilien Bersoult +## +## 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. +## +## For information : infos@centreon.com # debug ? #set -x @@ -332,39 +347,39 @@ answer_with_createdir() { ## @return 0 end #---- answer_with_createfile() { - local message=$1 - local default=$2 - local var_ref=$3 - local res="not_define" - local first=0 - while [ ! -f "$res" ] ; do - [ $first -eq 1 ] && echo_passed "$(gettext "File $res does not exists.")" "$critical" - echo -e "\n$message" - [ "$default" != "NO_DEFAULT" ] && echo -e "$(gettext "default to") [$default]" - echo -en "> " - read res - if [ -z "$res" ] ; then - [ "$default" != "NO_DEFAULT" ] && res=$default - fi - if [ -z "${res#/}" -o "$yes" = "$res" -o "$no" = "$res" ] ; then - echo_passed "$(gettext "You select slash...")" - res="not_define" - else - first=1 - [ -f "$res" ] && break - yes_no_default "$(gettext "Do you want me to create this file ?") [$res]" - if [ $? -eq 0 ] ; then - touch $res - if [ $? -ne 0 ] ; then - echo_passed "$(gettext "Could not create file.")" "$critical" - #continue - fi - log "INFO" "$(gettext "Creating") : $res" - fi + local message=$1 + local default=$2 + local var_ref=$3 + local res="not_define" + local first=0 + while [ ! -f "$res" ] ; do + [ $first -eq 1 ] && echo_passed "$(gettext "File $res does not exists.")" "$critical" + echo -e "\n$message" + [ "$default" != "NO_DEFAULT" ] && echo -e "$(gettext "default to") [$default]" + echo -en "> " + read res + if [ -z "$res" ] ; then + [ "$default" != "NO_DEFAULT" ] && res=$default + fi + if [ -z "${res#/}" -o "$yes" = "$res" -o "$no" = "$res" ] ; then + echo_passed "$(gettext "You select slash...")" + res="not_define" + else + first=1 + [ -f "$res" ] && break + yes_no_default "$(gettext "Do you want me to create this file ?") [$res]" + if [ $? -eq 0 ] ; then + touch $res + if [ $? -ne 0 ] ; then + echo_passed "$(gettext "Could not create file.")" "$critical" + #continue fi - done - eval $var_ref=$res - return 0 + log "INFO" "$(gettext "Creating") : $res" + fi + fi + done + eval $var_ref=$res + return 0 } #---- @@ -1621,19 +1636,37 @@ createConfFile() { ${CAT} << __EOT__ > $INSTALL_DIR_CENTREON_CONF . * - * The Software is provided to you AS IS and WITH ALL FAULTS. - * Centreon makes no representation and gives no warranty whatsoever, - * whether express or implied, and without limitation, with regard to the quality, - * any particular or intended purpose of the Software found on the Centreon web site. - * In no event will Centreon be liable for any direct, indirect, punitive, special, - * incidental or consequential damages however they may arise and even if Centreon has - * been previously advised of the possibility of such damages. + * Linking this program statically or dynamically with other modules is making a + * combined work based on this program. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this program give Centreon + * permission to link this program with independent modules to produce an executable, + * regardless of the license terms of these independent modules, and to copy and + * distribute the resulting executable under terms of Centreon choice, provided that + * Centreon also meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module which is not + * derived from this program. If you modify this program, you may extend this + * exception to your version of the program, but you are not obliged to do so. If you + * do not wish to do so, delete this exception statement from your version. + * + * For more information : contact@centreon.com * - * For information : contact@centreon.com */ \$conf_centreon['centreon_dir'] = "$INSTALL_DIR_CENTREON/"; @@ -1641,6 +1674,7 @@ createConfFile() { \$conf_centreon['centreon_dir_www'] = "$INSTALL_DIR_CENTREON/www/"; \$conf_centreon['centreon_dir_rrd'] = "$INSTALL_DIR_CENTREON/rrd/"; \$conf_centreon['centreon_log'] = "$CENTREON_LOG"; +\$conf_centreon['centreon_cachedir'] = "$CENTREON_CACHEDIR"; \$conf_centreon['centreon_varlib'] = "$CENTREON_VARLIB"; \$conf_centreon['centreon_group'] = "$CENTREON_GROUP"; \$conf_centreon['centreon_user'] = "$CENTREON_USER"; @@ -2092,7 +2126,7 @@ check_broker_user() #---- copyInTempFile() { - local srclistcp="bin cron config logrotate GPL_LIB lang lib snmptrapd src vendor www api libinstall .env bootstrap.php container.php composer.json package.json package-lock.json" + local srclistcp="bin cron config logrotate GPL_LIB lang lib snmptrapd src vendor www api libinstall .env .env.local.php bootstrap.php container.php composer.json package.json package-lock.json" # Prepare centreon Plugins echo "$(gettext "Preparing Centreon temporary files")" if [ -d $TMP_DIR ] ; then @@ -2249,7 +2283,7 @@ find_OS() { #---- ## use this function to clean and exit centreon install ## This function use <@function purge_centreon_tmp_dir> function. -## TODO: Need to add fonctionnality +## TODO: Need to add functionality ## - delete install file ## - restore inital rigth ## - ... @@ -2367,10 +2401,10 @@ clean_sudo() { #---- ## Find file with macro in directory. ## @param macro (separate with comma) -## @param directoty where to find +## @param folder where to find ## @param sub directory to find ## @param file to search (possible to use pattern) -## @param variable where define a list of file (temporaty file) +## @param variable where define a list of file (temporary file) ## @Globals LOG_FILE, TMP_DIR #---- find_macros_in_dir() { @@ -2395,6 +2429,7 @@ find_macros_in_dir() { return 0 } + #---- ## Check result and print a message ## @param return code to check diff --git a/libinstall/gettext b/libinstall/gettext index eb6baab37cd..6ce4dc6ce4c 100755 --- a/libinstall/gettext +++ b/libinstall/gettext @@ -2,8 +2,27 @@ #---- ## @Synopsis Dummy script for gettext ## @Copyright Copyright 2008, Guillaume Watteeux +## @Copyright Copyright 2008-2020, Centreon ## @license GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt ## Dummy script for gettext. Use when gettext not found on system. #---- +## Centreon is developed with GPL Licence 2.0 +## +## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +## +## Developed by : Julien Mathis - Romain Le Merlus +## Contributors : Guillaume Watteeux - Maximilien Bersoult +## +## 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. +## +## For information : infos@centreon.com echo "$*" diff --git a/varinstall/vars b/varinstall/vars index ce3e5ace978..180eb454f7e 100644 --- a/varinstall/vars +++ b/varinstall/vars @@ -15,7 +15,7 @@ CENTREON_CONF="/etc/centreon.conf" PEAR_MODULES_LIST="pear.lst" PHP_MODULES_LIST="php_modules.lst" DEFAULT_INSTALL_DIR_NAGIOS="/usr/local/nagios" -DEFAULT_INSTALL_DIR_CENTREON="/usr/local/centreon" +DEFAULT_INSTALL_DIR_CENTREON="/usr/share/centreon" DEFAULT_RRD_PERL="/usr/lib/perl5" DEFAULT_SUDO_FILE="/etc/sudoers.d/centreon" DEFAULT_WEB_USER="www-data" @@ -28,10 +28,10 @@ DEFAULT_BIN_SSH="/usr/bin/ssh" DEFAULT_BIN_SCP="/usr/bin/scp" DEFAULT_INIT_D="/etc/init.d" DEFAULT_CRON_D="/etc/cron.d" -DEFAULT_PEAR_PATH="/usr/share/pear" +DEFAULT_PEAR_PATH="/usr/share/php" DEFAULT_PHP_BIN="/usr/bin/php" DEFAULT_PERL_BIN="/usr/bin/perl" -DEFAULT_CENTREON_LOG="/usr/local/centreon/log" +DEFAULT_CENTREON_LOG="/var/log/centreon" DEFAULT_CENTREON_ETC="/etc/centreon" DEFAULT_CENTREON_RUNDIR="/var/run/centreon" DEFAULT_CENTREON_CACHEDIR="/var/cache/centreon" @@ -41,13 +41,13 @@ DEFAULT_CENTPLUGINS_TMP="/var/lib/centreon/centplugins" DEFAULT_CENTSTORAGE_BINDIR="bin" DEFAULT_CENTCORE_BINDIR="bin" DEFAULT_SNMP_ETC="/etc/snmp" -DEFAULT_SNMPTT_BINDIR="/usr/local/centreon/bin/" -DEFAULT_CENTPLUGINSTRAPS_BINDIR="/usr/local/centreon/bin" +DEFAULT_SNMPTT_BINDIR="/usr/share/centreon/bin/" +DEFAULT_CENTPLUGINSTRAPS_BINDIR="/usr/share/centreon/bin" DEFAULT_CENTREON_USER="centreon" DEFAULT_CENTREON_GROUP="centreon" DEFAULT_PLUGIN_DIR="/usr/lib/nagios/plugins" DEFAULT_CENTREON_PLUGINS="/usr/lib/centreon/plugins" -DEFAULT_CENTREON_BINDIR="/usr/local/centreon/bin" +DEFAULT_CENTREON_BINDIR="/usr/share/centreon/bin" DEFAULT_MONITORINGENGINE_USER="centreon-engine" DEFAULT_MONITORINGENGINE_BINARY="/usr/sbin/centengine" DEFAULT_MONITORINGENGINE_ETC="/etc/centreon-engine"