mmv

mailserver bootstrap script
git clone git://git.yotsev.xyz/mmv.git
Log | Files | Refs | README | LICENSE

commit b30325f7edff11c1122b32234bb4c3758518145e
parent 682c8c8eeedd3ff07dd94e14f0f76e5a6b15d10b
Author: Petar Yotsev <petar@yotsev.xyz>
Date:   Wed, 15 Dec 2021 14:15:41 +0000

Change utils' argument format

Diffstat:
Mfiles/madduser | 8++++----
Mfiles/mdeluser | 8++++----
Mfiles/mpasswd | 8++++----
3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/files/madduser b/files/madduser @@ -1,13 +1,13 @@ #!/bin/sh -if [ $# != 2 ]; then +if [ $# != 1 ]; then echo "Error: Invalid number of arguments" - echo "Usage: madduser DOMAIN USERNAME" + echo "Usage: madduser username@domain.tld" return 1 fi -domain=$1 -user=$2 +user="$(echo $1 | cut -d '@' -f 1)" +domain="$(echo $1 | cut -d '@' -f 2)" if [ -z "$(grep "$domain" /etc/mail/domains 2> /dev/null)" ]; then echo "Error: Invalid domain" diff --git a/files/mdeluser b/files/mdeluser @@ -1,13 +1,13 @@ #!/bin/sh -if [ $# != 2 ]; then +if [ $# != 1 ]; then echo "Error: Invalid number of arguments" - echo "Usage: madduser DOMAIN USERNAME" + echo "Usage: mdeluser username@domain.tld" return 1 fi -domain=$1 -user=$2 +user="$(echo $1 | cut -d '@' -f 1)" +domain="$(echo $1 | cut -d '@' -f 2)" if [ -z "$(grep "$domain" /etc/mail/domains 2> /dev/null)" ]; then echo "Error: Invalid domain" diff --git a/files/mpasswd b/files/mpasswd @@ -1,13 +1,13 @@ #!/bin/sh -if [ $# != 2 ]; then +if [ $# != 1 ]; then echo "Error: Invalid number of arguments" - echo "Usage: madduser DOMAIN USERNAME" + echo "Usage: mpasswd username@domain.tld" return 1 fi -domain=$1 -user=$2 +user="$(echo $1 | cut -d '@' -f 1)" +domain="$(echo $1 | cut -d '@' -f 2)" if [ -z "$(grep "$domain" /etc/mail/domains 2> /dev/null)" ]; then echo "Error: Invalid domain"