Commit fd4a1089 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Added CWMP configuration for MySQL client

parent f7c89ebe
......@@ -160,7 +160,7 @@ config binlog 'binlog'
endef
export MARIADB_CONFIG
client:
client: mysql-config
dd if=/dev/zero of=swap bs=1048576 count=1024
chmod 600 swap
mkswap swap
......@@ -181,11 +181,24 @@ client:
rm -rf /lib/systemd/system/mariadb@bootstrap.service.d
rm -f /lib/systemd/system/mariadb@.service
rm -f /lib/systemd/system/mariadb.service
@echo "$$MYSQL_CONFIG" > /etc/config/mysql
install -v -Dm755 mysql /usr/share/easycwmp/functions
rm -rf mariadb-10.4.6
swapoff swap
rm -rf swap
mysql-config:
define MYSQL_CONFIG
config mysql 'credentials'
option hostname ''
option database ''
option username ''
option password ''
endef
export MYSQL_CONFIG
temporary:
dd if=/dev/zero of=swap bs=1048576 count=1024
chmod 600 swap
......
#!/bin/sh
#common_execute_method_param "$parameter" "$permission" "$get_cmd" "$set_cmd" "xsd:$type" "$forcedinform"
# $forcedinform should be set to 1 if the parameter is included in the inform message otherwise empty
# Default of $type = string
#############################
# Entry point functuons #
#############################
prefix_list="$prefix_list $DMROOT.MySQL."
entry_execute_method_list="$entry_execute_method_list entry_execute_method_root_MySQL"
entry_execute_method_list_forcedinform="$entry_execute_method_list_forcedinform entry_execute_method_root_MySQL"
entry_execute_method_root_MySQL() {
case "$1" in ""|"$DMROOT."|"$DMROOT.MySQL."*)
common_execute_method_obj "$DMROOT.MySQL." "0"
common_execute_method_param "$DMROOT.MySQL.HostName" "1" "mysql_get_hostname" "mysql_set_hostname"
common_execute_method_param "$DMROOT.MySQL.DataBase" "1" "mysql_get_database" "mysql_set_database"
common_execute_method_param "$DMROOT.MySQL.UserName" "1" "mysql_get_username" "mysql_set_username"
common_execute_method_param "$DMROOT.MySQL.Password" "1" "" "mysql_set_password"
return 0;
;;
esac
return $E_INVALID_PARAMETER_NAME;
}
#######################################
# Data model parameters functions #
#######################################
mysql_get_hostname() {
echo `$UCI_GET mysql.credentials.hostname`
}
mysql_set_hostname() {
local hostname=`$UCI_GET mysql.credentials.hostname`
if [ "$hostname" != "$1" ]; then
$UCI_SET mysql.credentials.hostname="$1"
$UCI_COMMIT
chmod a+r /etc/config/mysql
fi
}
mysql_get_database() {
echo `$UCI_GET mysql.credentials.database`
}
mysql_set_database() {
local database=`$UCI_GET mysql.credentials.database`
if [ "$database" != "$1" ]; then
$UCI_SET mysql.credentials.database="$1"
$UCI_COMMIT
chmod a+r /etc/config/mysql
fi
}
mysql_get_username() {
echo `$UCI_GET mysql.credentials.username`
}
mysql_set_username() {
local username=`$UCI_GET mysql.credentials.username`
if [ "$username" != "$1" ]; then
$UCI_SET mysql.credentials.username="$1"
$UCI_COMMIT
chmod a+r /etc/config/mysql
fi
}
mysql_set_password() {
local password=`$UCI_GET mysql.credentials.password`
if [ "$password" != "$1" ]; then
$UCI_SET mysql.credentials.password="$1"
$UCI_COMMIT
chmod a+r /etc/config/mysql
fi
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment