mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-03 17:44:49 +02:00
Adjust coding style in "bin" scripts (#279)
The main shell script (start-mailserver.sh) uses two spaces for indentation. All other shell scripts should use this coding style.
This commit is contained in:
parent
46278ec890
commit
76d2c779df
3 changed files with 68 additions and 66 deletions
|
@ -3,27 +3,26 @@
|
|||
DATABASE=/tmp/docker-mailserver/postfix-accounts.cf
|
||||
|
||||
function usage {
|
||||
echo 'Usage: addmailuser <user@domain.tld> [password]'
|
||||
exit 1
|
||||
echo 'Usage: addmailuser <user@domain.tld> [password]'
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
USER=$1
|
||||
if [ -e "$DATABASE" ] && [ ! -z "$(grep $USER -i $DATABASE)" ]; then
|
||||
echo "User already exists"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -z "$2" ]; then
|
||||
PASS="$2"
|
||||
else
|
||||
read -s -p "Enter Password: " PASS
|
||||
if [ -z "$PASS" ]; then
|
||||
echo "Password can't be empty"
|
||||
exit 1
|
||||
USER=$1
|
||||
if [ -e "$DATABASE" ] && [ ! -z "$(grep $USER -i $DATABASE)" ]; then
|
||||
echo "User already exists"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
ENTRY=$(echo "$USER|$(doveadm pw -s SHA512-CRYPT -u "$USER" -p "$PASS")")
|
||||
echo "$ENTRY" >> $DATABASE
|
||||
if [ ! -z "$2" ]; then
|
||||
PASS="$2"
|
||||
else
|
||||
read -s -p "Enter Password: " PASS
|
||||
if [ -z "$PASS" ]; then
|
||||
echo "Password can't be empty"
|
||||
exit 1
|
||||
fi
|
||||
ENTRY=$(echo "$USER|$(doveadm pw -s SHA512-CRYPT -u "$USER" -p "$PASS")")
|
||||
echo "$ENTRY" >> $DATABASE
|
||||
else
|
||||
usage
|
||||
usage
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue