As I start using scalix I see many somehow cryptic commands which often caused trouble for some users, me included. As I did not find anything compareable I started this one. It is based upon the advanced bash scriptung guide template for getopt_simple. I am in no way a bash professional so please bare with me, don't complain, edit it so it is more useful, less erroneous, more userfriendly, less sluggish written, more convinient and of course more powerful.
As you see I left a bunch of unuseful lines in it... more or less intention, I like verbosity and the template gave a good start (even if I've found a more reasonable template... anyway, it's late, I'm tired, good night

Code: Select all
#!/bin/bash
# create-email-folder.sh a convinient way to add
# an emailable folder for scalix
#
# Author: Michael Schmitt
# Contributors:
#
# copy, use, edit, enhance it or throw it away. Do
# whatever you want as long as nobody is hurt...
# and of course it is covered by the GPL ;)
# template used was getopt_simple from
# http://www.tldp.org/LDP/abs/html/
echo Usage: create-email-folder.sh -n=foldername -m1=mailnode1 -m2=mailnode2 -e=e-mailaddress
echo Note: -m1 and -m2 represent your mailnode as m1,m2 syntax
echo as I am to dumb to parse the output of omshowmn in a smart way
create_folder()
{
echo "create_folder()"
echo "Parameters are '$*'"
until [ -z "$1" ]
do
echo "Processing parameter of: '$1'"
if [ ${1:0:1} = '-' ]
then
tmp=${1:1} # Strip off leading '-' . . .
parameter=${tmp%%=*} # Extract name.
value=${tmp##*=} # Extract value.
echo "Parameter: '$parameter', value: '$value'"
eval $parameter=$value
fi
shift
done
}
# Pass all options to create_folder().
create_folder $*
echo "Foldername is '$n'"
echo "Mailnode1 is '$m1'"
echo "Mailnode2 is '$m2'"
echo "Mailaddress is '$e'"
omaddent -e "S=+BB/CN=$n/OU1=$m1/OU2=$m2/DDT1=BB/DDV1=$n/IA=$e"
exit 0
greetings
Michael