FreeBSD/Fedora fixes

This commit is contained in:
Tube 2023-10-23 02:47:29 +02:00
parent 177ab077e3
commit 4635b346e1
1 changed files with 23 additions and 8 deletions

View File

@ -25,9 +25,8 @@ vars:
"cfg_dir" string => "/usr/local/etc/mysql"; "cfg_dir" string => "/usr/local/etc/mysql";
"cfg_file" string => "/usr/local/etc/mysql/my.cnf"; "cfg_file" string => "/usr/local/etc/mysql/my.cnf";
"bin_dir" string => "/usr/local/bin"; "bin_dir" string => "/usr/local/bin";
"install_db_cmd" string => "$(bin_dir)/mariadb-install-db --user=$(user) > /dev/null";
"default_datadir" string => "/var/db/mysql"; "default_datadir" string => "/var/db/mysql";
"mysqld_cmd" string => "/usr/local/libexec/mysqld";
debian:: debian::
"user" string => "mysql"; "user" string => "mysql";
"server_pkgs" slist => {"mariadb-server"}; "server_pkgs" slist => {"mariadb-server"};
@ -37,8 +36,8 @@ vars:
"cfg_dir" string => "/etc/mysql"; "cfg_dir" string => "/etc/mysql";
"cfg_file" string => "/etc/mysql/my.cnf"; "cfg_file" string => "/etc/mysql/my.cnf";
"bin_dir" string => "/usr/bin"; "bin_dir" string => "/usr/bin";
"install_db_cmd" string => "$(bin_dir)/mariadb-install-db --user=$(user) > /dev/null ";
"default_datadir" string => "/var/lib/mysql"; "default_datadir" string => "/var/lib/mysql";
"mysqld_cmd" string => "/usr/sbin/mysqld";
fedora:: fedora::
"user" string => "mysql"; "user" string => "mysql";
@ -49,15 +48,13 @@ vars:
"cfg_dir" string => "/etc/mysql"; "cfg_dir" string => "/etc/mysql";
"cfg_file" string => "/etc/my.cnf"; "cfg_file" string => "/etc/my.cnf";
"bin_dir" string => "/usr/bin"; "bin_dir" string => "/usr/bin";
"install_db_cmd" string => "$(bin_dir)/mariadb-install-db --user=$(user) > /dev/null";
"default_datadir" string => "/var/lib/mysql"; "default_datadir" string => "/var/lib/mysql";
"mysqld_cmd" string => "/usr/sbin/mysqld";
any:: any::
"mysql_cmd" string => "$(bin_dir)/mysql"; "mysql_cmd" string => "$(bin_dir)/mysql";
"mysqldump_cmd" string => "$(bin_dir)/mysqldump"; "mysqldump_cmd" string => "$(bin_dir)/mysqldump";
"datadir" string => ifelse(isvariable("cfg[settings][mysqld][datadir]"),
"$(cfg[settings][mysqld][datadir])",
"$(default_datadir)");
files: files:
freebsd:: freebsd::
@ -99,12 +96,27 @@ reports:
bundle agent install_mysql_server(cfg) bundle agent install_mysql_server(cfg)
{ {
classes:
"type_$(mysql.type)" ;
vars: vars:
"mysqld_idx" slist => getindices(@(cfg[settings][mysqld])); "mysqld_idx" slist => getindices(@(cfg[settings][mysqld]));
"settings[mysqld][$(mysqld_idx)]" string => "$(cfg[settings][mysqld][$(mysqld_idx)])"; "settings[mysqld][$(mysqld_idx)]" string => "$(cfg[settings][mysqld][$(mysqld_idx)])";
"datadir" string => ifelse(isvariable("cfg[settings][mysqld][datadir]"),
"$(cfg[settings][mysqld][datadir])",
"$(mysql.default_datadir)");
type_mariadb::
"install_db_cmd" string => "if [ ! -d $(datadir)/mysql ]; then $(mysql.bin_dir)/mariadb-install-db --user=$(mysql.user)>/dev/null ; fi";
type_mysql8::
"install_db_cmd" string => "if [ ! -d $(datadir)/mysql ]; then $(mysql.mysqld_cmd) --initialize-insecure --user=$(mysql.user); fi";
"j" string => storejson(@(cfg)); "j" string => storejson(@(cfg));
methods: methods:
"any" usebundle => wmde_install_packages(@(mysql.server_pkgs),"mysql_server"); "any" usebundle => wmde_install_packages(@(mysql.server_pkgs),"mysql_server");
@ -124,8 +136,11 @@ files:
handle => "myslq_server_cfg_edited", handle => "myslq_server_cfg_edited",
classes => if_repaired("mysql_server_repaired"); classes => if_repaired("mysql_server_repaired");
commands: commands:
"$(mysql.install_db_cmd)" "$(install_db_cmd)"
handle=>"mysql_datadir_initialized", handle=>"mysql_datadir_initialized",
contain => wmde_cmd_useshell, contain => wmde_cmd_useshell,
inform => "false", inform => "false",