Commit 4022284a authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Initial commit

parents
all: postgresql-config
@echo "$$POSTGRESQL_CONFIG" > /etc/config/postgresql
install -v -Dm755 postgresql /usr/share/easycwmp/functions
postgresql-config:
define POSTGRESQL_CONFIG
config postgresql 'credentials'
option hostname ''
option database ''
option username ''
option password ''
endef
export POSTGRESQL_CONFIG
#!/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.PostgreSQL."
entry_execute_method_list="$entry_execute_method_list entry_execute_method_root_PostgreSQL"
entry_execute_method_list_forcedinform="$entry_execute_method_list_forcedinform entry_execute_method_root_PostgreSQL"
entry_execute_method_root_PostgreSQL() {
case "$1" in ""|"$DMROOT."|"$DMROOT.PostgreSQL."*)
common_execute_method_obj "$DMROOT.PostgreSQL." "0"
common_execute_method_param "$DMROOT.PostgreSQL.HostName" "1" "postgresql_get_hostname" "postgresql_set_hostname"
common_execute_method_param "$DMROOT.PostgreSQL.Database" "1" "postgresql_get_database" "postgresql_set_database"
common_execute_method_param "$DMROOT.PostgreSQL.UserName" "1" "postgresql_get_username" "postgresql_set_username"
common_execute_method_param "$DMROOT.PostgreSQL.Password" "1" "" "postgresql_set_password"
return 0;
;;
esac
return $E_INVALID_PARAMETER_NAME;
}
#######################################
# Data model parameters functions #
#######################################
postgresql_get_hostname() {
echo `$UCI_GET postgresql.credentials.hostname`
}
postgresql_set_hostname() {
local hostname=`$UCI_GET postgresql.credentials.hostname`
if [ "$hostname" != "$1" ]; then
$UCI_SET postgresql.credentials.hostname="$1"
$UCI_COMMIT
chmod a+r /etc/config/postgresql
fi
}
postgresql_get_database() {
echo `$UCI_GET postgresql.credentials.database`
}
postgresql_set_database() {
local database=`$UCI_GET postgresql.credentials.database`
if [ "$database" != "$1" ]; then
$UCI_SET postgresql.credentials.database="$1"
$UCI_COMMIT
chmod a+r /etc/config/postgresql
fi
}
postgresql_get_username() {
echo `$UCI_GET postgresql.credentials.username`
}
postgresql_set_username() {
local username=`$UCI_GET postgresql.credentials.username`
if [ "$username" != "$1" ]; then
$UCI_SET postgresql.credentials.username="$1"
$UCI_COMMIT
chmod a+r /etc/config/postgresql
fi
}
postgresql_set_password() {
local password=`$UCI_GET postgresql.credentials.password`
if [ "$password" != "$1" ]; then
$UCI_SET postgresql.credentials.password="$1"
$UCI_COMMIT
chmod a+r /etc/config/postgresql
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