Переглянути джерело

Merge pull request #83 from YunoHost-Apps/fix-mysql

Update etc_zabbix_web_init.zabbix.conf.php.sh
Robles Rodolphe 11 місяців тому
батько
коміт
1da93b9af4

+ 1 - 1
conf/etc_apt_preferences.d_zabbix

@@ -4,4 +4,4 @@ Pin-Priority: 900
 
 Package: zabbix-*
 Pin: origin security.debian.org
-Pin-Priority: -1
+Pin-Priority: 1

+ 1 - 1
conf/etc_zabbix_web_init.zabbix.conf.php.sh

@@ -18,7 +18,7 @@ global \$DB;
 \$DB['PORT']     = '0';
 \$DB['DATABASE'] = '"$(yunohost app setting zabbix db_name)"';
 \$DB['USER']     = '"$(yunohost app setting zabbix db_user)"';
-\$DB['PASSWORD'] = '"$(yunohost app setting zabbix mysqlpwd)"';
+\$DB['PASSWORD'] = '"$(yunohost app setting zabbix db_pwd)"';
 
 // Schema name. Used for IBM DB2 and PostgreSQL.
 \$DB['SCHEMA'] = '';

+ 1 - 1
scripts/backup

@@ -43,7 +43,7 @@ ynh_backup --src_path="/etc/sudoers.d/zabbix"
 ynh_backup --src_path="/usr/share/zabbix-cli"
 
 # Backup pinning preferences repo
-yhn_backup --src_path="/etc/apt/preferences.d/zabbix_repo"
+ynh_backup --src_path="/etc/apt/preferences.d/zabbix_repo"
 
 #=================================================
 # BACKUP THE MYSQL DATABASE

+ 4 - 4
scripts/install

@@ -50,16 +50,16 @@ chmod 644 "/etc/apt/preferences.d/zabbix_repo"
 chmod 400 "/etc/zabbix/web/zabbix.conf.php"
 chown "$app:www-data" "/etc/zabbix/web/zabbix.conf.php"
 
-ynh_replace_string --match_string="DBName=zabbix" --replace_string="DBName=$db_name" --target_file=/etc/zabbix/zabbix_server.conf
-ynh_replace_string --match_string="DBUser=zabbix" --replace_string="DBUser=$db_user" --target_file=/etc/zabbix/zabbix_server.conf
-ynh_replace_string --match_string="# DBPassword=" --replace_string="# DBPassword=\nDBPassword=$db_pwd" --target_file=/etc/zabbix/zabbix_server.conf
+ynh_replace_string --match_string="DBName=zabbix" --replace_string="DBName=$db_name" --target_file="/etc/zabbix/zabbix_server.conf"
+ynh_replace_string --match_string="DBUser=zabbix" --replace_string="DBUser=$db_user" --target_file="/etc/zabbix/zabbix_server.conf"
+ynh_replace_string --match_string="# DBPassword=" --replace_string="# DBPassword=\nDBPassword=$db_pwd" --target_file="/etc/zabbix/zabbix_server.conf"
 
 #=================================================
 # SYSTEM CONFIGURATION
 #=================================================
 ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
 
-ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen
+ynh_replace_string --match_string="# ${language}\.UTF-8 UTF-8" --replace_string="${language}\.UTF-8 UTF-8" --target_file="/etc/locale.gen"
 locale-gen
 
 # Create a PHP-FPM config (with conf/extra_php-fpm.conf being appended to it)

+ 4 - 2
scripts/remove

@@ -12,10 +12,10 @@ source /usr/share/yunohost/helpers
 #=================================================
 ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
 
-ynh_exec_warn_less yunohost user delete $zabbix_username --purge
-
 # need remove pinning
+if [ -f "/etc/apt/preferences.d/zabbix_repo" ]; then
 ynh_secure_remove --file="/etc/apt/preferences.d/zabbix_repo"
+fi
 
 # Remove the dedicated systemd config
 ynh_systemd_action --service_name="$app-server" --action="stop" --log_path="/var/log/$app/${app}_server.log"
@@ -44,6 +44,8 @@ ynh_secure_remove --file="/etc/sudoers.d/$app"
 
 ynh_secure_remove --file="/usr/share/zabbix-cli"
 
+ynh_exec_warn_less yunohost user delete $zabbix_username --purge
+
 #=================================================
 # END OF SCRIPT
 #=================================================