Create etherpad database
This commit is contained in:
parent
9074a7cc2f
commit
b97d95b2eb
|
@ -52,6 +52,35 @@ etherpad_variables=(ETHERPAD_COMMIT
|
|||
DDNS_PROVIDER
|
||||
MY_USERNAME)
|
||||
|
||||
function get_mariadb_etherpad_admin_password {
|
||||
if [ -f /home/$MY_USERNAME/README ]; then
|
||||
if grep -q "MariaDB etherpad admin password" /home/$MY_USERNAME/README; then
|
||||
ETHERPAD_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "MariaDB etherpad admin password" | awk -F ':' '{print $2}' | sed 's/^ *//')
|
||||
fi
|
||||
if grep -q "etherpad administrator password" /home/$MY_USERNAME/README; then
|
||||
ETHERPAD_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "etherpad administrator password" | awk -F ':' '{print $2}' | sed 's/^ *//')
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function etherpad_create_database {
|
||||
function_check get_mariadb_etherpad_admin_password
|
||||
get_mariadb_etherpad_admin_password
|
||||
if [ ! $ETHERPAD_ADMIN_PASSWORD ]; then
|
||||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
ETHERPAD_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
ETHERPAD_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
if [ ! $ETHERPAD_ADMIN_PASSWORD ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
function_check create_database
|
||||
create_database etherpad "$ETHERPAD_ADMIN_PASSWORD" $MY_USERNAME
|
||||
}
|
||||
|
||||
function create_etherpad_settings {
|
||||
echo '{' > /var/www/$ETHERPAD_DOMAIN_NAME/htdocs/settings.json
|
||||
echo " \"title\": \"${ETHERPAD_TITLE}\"," >> /var/www/$ETHERPAD_DOMAIN_NAME/htdocs/settings.json
|
||||
|
|
Loading…
Reference in New Issue