| verzia 1.1, 2003/05/28 14:42:12 |
verzia 1.2, 2003/06/18 09:25:34 |
|
|
| # 20/05/2003 - created |
# 20/05/2003 - created |
| # 28/05/2003 - support for startup()/finish() functions |
# 28/05/2003 - support for startup()/finish() functions |
| # - virtualdomains and rcpthosts are handled |
# - virtualdomains and rcpthosts are handled |
| |
# 16/06/2003 - option --help implemented |
| |
# - extended command line parsing with --alias option |
| # |
# |
| |
|
| # $Platon$ |
# $Platon: scripts/shell/sysadmin/qmail-manage.sh,v 1.1 2003/05/28 14:42:12 nepto Exp $ |
| |
|
| # |
# |
| # SYSTEM COMMANDS CONFIGURATION |
# SYSTEM COMMANDS CONFIGURATION |
| Riadok 58 finish() # modify this function to fit y |
|
| Riadok 60 finish() # modify this function to fit y |
|
| |
|
| usage() |
usage() |
| { |
{ |
| $ECHO "$PRG <e-mail-address> <password>"; |
$ECHO "$PRG [ --help ] [ --alias <alias> ] <e-mail-address> <password>"; |
| exit 1; |
exit 1; |
| } |
} |
| |
|
|
|
| # |
# |
| |
|
| # check param count |
# check param count |
| if [ $# -lt 2 ]; then |
if [ $# -lt 1 ]; then |
| usage; |
usage; |
| fi |
fi |
| |
|
| # get e-mail and password |
# command line parsing |
| email="$1"; |
for option; do |
| password="$2"; |
# If the previous option needs an argument, assign it. |
| |
if test -n "$prev"; then |
| |
eval "$prev=\$option"; |
| |
prev=; |
| |
continue; |
| |
fi |
| |
|
| |
case "$option" in |
| |
-*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; |
| |
*) optarg= ;; |
| |
esac |
| |
|
| |
case "$option" in |
| |
|
| |
--alias | --alia | --ali | --al | --a | \ |
| |
-alias | -alia | -ali | -al | -a) |
| |
prev='alias' ;; |
| |
|
| |
--alias=* | --alia=* | --ali=* | --al=* | --a=* | \ |
| |
-alias=* | -alia=* | -ali=* | -al=* | -a=*) |
| |
alias="$optarg" ;; |
| |
|
| |
--help | --hel | --he | --h | -help | -hel | -he | -h) |
| |
usage; ;; |
| |
|
| |
-*) |
| |
error "invalid option '$option'; use --help to show usage" 1>&2; |
| |
exit 1; ;; |
| |
|
| |
*) |
| |
# get e-mail and password |
| |
if [ -z "$email" ]; then |
| |
email="$option"; |
| |
else |
| |
if [ -z "$password" ]; then |
| |
password="$option"; |
| |
else |
| |
error "too many parameter on command line"; |
| |
fi |
| |
fi |
| |
;; |
| |
esac |
| |
done |
| |
|
| # check if e-mail address seems to be valid |
# check if e-mail address seems to be valid |
| if [ "` $ECHO \"$email\" | $GREP -E '^[^@ ]+@[^@ ]+\.[^@ ]+$' `" ]; then |
if [ "` $ECHO \"$email\" | $GREP -E '^[^@ ]+@[^@ ]+\.[^@ ]+$' `" ]; then |
|
|
| finish; |
finish; |
| |
|
| if :; then |
if :; then |
| else # just comment this line to enable debug information |
#else # just comment this line to enable debug information |
| # debug print |
# debug print |
| echo "email: $email"; |
echo "email: $email"; |
| |
echo "alias: $alias"; |
| echo "password: $password"; |
echo "password: $password"; |
| echo "password2: $password2"; |
echo "password2: $password2"; |
| echo "username: $username"; |
echo "username: $username"; |