Browse Source

Check return code

pull/59/head
Bob Mottram 6 years ago
parent
commit
20d65a0b7a
  1. 5
      src/freedombone-adduser
  2. 6
      src/freedombone-addxmpp

5
src/freedombone-adduser

@ -97,6 +97,11 @@ chmod 600 /home/$MY_USERNAME/README
echo "Adding an XMPP account for $MY_USERNAME"
freedombone-addxmpp -e "$MY_USERNAME@$HOSTNAME" -p "$NEW_USER_PASSWORD"
if [ ! "$?" = "0" ]; then
echo "XMPP account not created"
userdel -r $MY_USERNAME
exit 6
fi
clear
echo "New user $MY_USERNAME was created"

6
src/freedombone-addxmpp

@ -64,11 +64,12 @@ done
if [ ! -d /etc/prosody ]; then
echo 'xmpp server is not installed'
exit 1
exit 0
fi
if [ ! $EMAIL_ADDRESS ]; then
show_help
exit 1
fi
if [ ! $NEW_USER_PASSWORD ]; then
@ -77,6 +78,9 @@ else
USERNAME=$(echo $EMAIL_ADDRESS | awk -F '@' '{print $1}')
DOMAIN_NAME=$(echo $EMAIL_ADDRESS | awk -F '@' '{print $2}')
prosodyctl register $USERNAME $DOMAIN_NAME "$NEW_USER_PASSWORD"
if [ ! "$?" = "0" ]; then
exit 2
fi
fi
exit 0

Loading…
Cancel
Save