Return values

This commit is contained in:
Bob Mottram 2016-11-19 23:11:36 +00:00
parent 9d93731673
commit 5b6702c26c
1 changed files with 8 additions and 2 deletions

View File

@ -203,12 +203,18 @@ function remove_user_etherpad {
function add_user_etherpad { function add_user_etherpad {
new_username="$1" new_username="$1"
new_user_password="$2" new_user_password="$2"
${PROJECT_NAME}-pass -u $new_username -a etherpad -p "$new_user_password"
read_config_param ETHERPAD_DOMAIN_NAME read_config_param ETHERPAD_DOMAIN_NAME
if ! grep -q "\"$new_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then if ! grep -q "\"$new_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
${PROJECT_NAME}-pass -u $new_username -a etherpad -p "$new_user_password"
sed -i "/\"users\": {/a \"$new_username\": { \"password\": \"$new_user_password\", \"is_admin\": false }," /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json sed -i "/\"users\": {/a \"$new_username\": { \"password\": \"$new_user_password\", \"is_admin\": false }," /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
if grep -q "\"$new_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
systemctl restart etherpad systemctl restart etherpad
else
echo '1'
return
fi fi
fi
echo '0'
} }
function install_interactive_etherpad { function install_interactive_etherpad {