From 668435d13dbcb2682a15d87208a845cdd085b134 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Fri, 5 Jul 2019 13:50:11 +0200 Subject: [PATCH] Update install avoid sed -i --- scripts/install | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/scripts/install b/scripts/install index 02b0ff6..1b61425 100644 --- a/scripts/install +++ b/scripts/install @@ -275,32 +275,17 @@ systemctl reload nginx ### `ynh_replace_string` is used to replace a string in a file. ### (It's compatible with sed regular expressions syntax) ynh_print_info "Generate zabbix config files" - -echo "/usr/share/zabbix/conf/zabbix.conf.php +confUserPpath=$(find /var/cache/yunohost/ -name "usr_share_zabbix_conf_zabbix.conf.php") +cp "$confServerPath" /usr/share/zabbix/conf/zabbix.conf.php +ynh_replace_string --match_string="db_name" --replace_string="$db_name" --target_file=/usr/share/zabbix/conf/zabbix.conf.php +ynh_replace_string --match_string="db_user" --replace_string="$db_user" --target_file=/usr/share/zabbix/conf/zabbix.conf.php +ynh_replace_string --match_string="db_pwd" --replace_string="$db_pwd" --target_file=/usr/share/zabbix/conf/zabbix.conf.php chown -R www-data. /usr/share/zabbix -sed -i "s/DBName=zabbix/DBName=$db_name/g" /etc/zabbix/zabbix_server.conf -sed -i "s/DBUser=zabbix/DBUser=$db_user/g" /etc/zabbix/zabbix_server.conf -sed -i "126a DBPassword=$db_pwd" /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 ynh_replace_string --match_string="# Timeout=3" --replace_string="# Timeout=3\nTimeout=10" --target_file=/etc/zabbix/zabbix_agentd.conf