| verzia 1.5, 2003/06/19 09:11:48 |
verzia 1.6, 2003/06/19 09:23:38 |
|
|
| # - virtualdomains and rcpthosts are handled |
# - virtualdomains and rcpthosts are handled |
| # 16/06/2003 - option --help implemented |
# 16/06/2003 - option --help implemented |
| # - extended command line parsing with --alias option |
# - extended command line parsing with --alias option |
| # - local aliases support implemented |
# - local aliases implemented |
| |
# 17/06/2003 - external aliases implemented |
| # |
# |
| |
|
| # $Platon: scripts/shell/sysadmin/qmail-manage.sh,v 1.4 2003/06/19 09:05:38 nepto Exp $ |
# $Platon: scripts/shell/sysadmin/qmail-manage.sh,v 1.5 2003/06/19 09:11:48 nepto Exp $ |
| |
|
| # |
# |
| # SYSTEM COMMANDS CONFIGURATION |
# SYSTEM COMMANDS CONFIGURATION |
| Riadok 174 alias_username="` $ECHO \"$alias\" | $SE |
|
| Riadok 175 alias_username="` $ECHO \"$alias\" | $SE |
|
| alias_domain="` $ECHO \"$alias\" | $SED 's/^.*@//g' `"; |
alias_domain="` $ECHO \"$alias\" | $SED 's/^.*@//g' `"; |
| alias_qmail_key="=$domain2-$alias_username"; |
alias_qmail_key="=$domain2-$alias_username"; |
| |
|
| # alias sanity check |
# sanity check |
| |
if [ "$domain" = "$domain2" ]; then |
| |
error 'something went wrong, $domain is equal to $domain2'; |
| |
fi |
| |
|
| |
# alias sanity check and type extraction |
| if [ $alias_f ]; then |
if [ $alias_f ]; then |
| if [ "$alias_domain" != "$domain" ]; then |
|
| error 'alias domain is not equal to e-mail domain'; |
|
| fi |
|
| if [ "$alias_username" = "$username" ]; then |
if [ "$alias_username" = "$username" ]; then |
| error 'alias username is equal to e-mail username'; |
error 'alias username is equal to e-mail username'; |
| fi |
fi |
| |
if [ "$alias_domain" != "$domain" ]; then |
| # sanity check |
alias_f="E"; # external alias |
| if [ "$domain" = "$domain2" ]; then |
else |
| error 'something went wrong, $domain is equal to $domain2'; |
alias_f="L"; # local alias |
| fi |
fi |
| fi |
fi |
| |
|
|
|
| >"$DIR_PASSWORDS/$domain"; |
>"$DIR_PASSWORDS/$domain"; |
| fi |
fi |
| |
|
| # if we are making an alias, get appropriate information |
# if we are making an local alias, get appropriate information |
| if [ $alias_f ]; then |
if [ "$alias_f" = "L" ]; then |
| notice "extracting real mailbox path for alias"; |
notice "extracting real mailbox path for local alias"; |
| mailbox="` $GREP "^$alias_qmail_key:" "$DIR_DOMAINS/$domain" \ |
mailbox="` $GREP "^$alias_qmail_key:" "$DIR_DOMAINS/$domain" \ |
| | sed 's/^[^:]*:[^:]*:[^:]*:[^:]*:\(.[^:]*\):.*$/\1/g' `"; |
| sed 's/^[^:]*:[^:]*:[^:]*:[^:]*:\(.[^:]*\):.*$/\1/g' `"; |
| if [ "X$mailbox" = "X" ]; then |
if [ "X$mailbox" = "X" ]; then |
|
|
| # (/var/qmail/bin/maildirmake) a do toho isteho adresara nakopirovat |
# (/var/qmail/bin/maildirmake) a do toho isteho adresara nakopirovat |
| # defaultny .qmail subor ktory bude mat niekde zadefinovanu cestu.. |
# defaultny .qmail subor ktory bude mat niekde zadefinovanu cestu.. |
| |
|
| if [ ! $alias_f ]; then if [ ! -d "$mailbox" ]; then |
if [ "$alias_f" = "L" ]; then |
| # if this fails we have a really big problem... |
# do nothing |
| mkdir -p "$mailbox" || error "mailbox '$mailbox' creation failure"; |
else |
| cd "$mailbox" \ |
if [ ! -d "$mailbox" ]; then |
| |
# if this fails we have a really big problem... |
| |
mkdir -p "$mailbox" || error "mailbox '$mailbox' creation failure"; |
| |
cd "$mailbox" \ |
| && $MAILDIRMAKE ./Maildir/ \ |
&& $MAILDIRMAKE ./Maildir/ \ |
| && cd - \ |
&& cd - \ |
| && notice "mailbox '$mailbox' was created" \ |
&& notice "mailbox '$mailbox' was created" \ |
| && cp -f "$file_default_dotqmail" "$mailbox/.qmail" 2>/dev/null |
&& cp -f "$file_default_dotqmail" "$mailbox/.qmail" 2>/dev/null |
| fi; fi |
fi; |
| |
if [ "$alias_f" = "E" ]; then |
| |
echo "$alias" > "$mailbox/.qmail"; |
| |
fi |
| |
fi |
| |
|
| # call finish() function |
# call finish() function |
| finish; |
finish; |