Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
HaiSoft (public)
Plesk - Mail Autoconfig
Commits
eaa0ed97
Commit
eaa0ed97
authored
Jun 19, 2018
by
Benoît
Browse files
Adapted script for gitlab migration
parent
c1355c92
Changes
1
Hide whitespace changes
Inline
Side-by-side
plesk_mail_autoconfig.sh
View file @
eaa0ed97
...
...
@@ -7,26 +7,40 @@
# These will be visible inside your config files
companyname
=
"HaiSoft"
companyshortname
=
"HaiSoft"
companylowercasename
=
"haisoft"
companyurl
=
"haisoft.net"
docurl
=
"http://
help
.haisoft.
net/
"
docurl
=
"http
s
://
wiki
.haisoft.
fr/index.php?title=E-mail#Configuration_automatique
"
hostname
=
"
$(
hostname
)
"
applewebpagelanguage
=
"fr"
# Git repo, useful if you want to fork it
gituser
=
"HaiSoftSARL"
gitrepo
=
"plesk_mail_autoconfig"
# Git Platform - github and gitlab are supported
gitplatform
=
"gitlab"
# When forking this repo, you can set your own git info
gitlaburl
=
"https://gitlab.haisoft.net"
githuburl
=
"https://raw.githubusercontent.com"
gituser
=
"pub"
gitrepo
=
"Plesk_MailAutoconfig"
gitbranch
=
"master"
## Edit with care or don't
if
[
${
gitplatform
}
=
gitlab
]
;
then
gitrawfullurl
=
"
${
gitlaburl
}
/
${
gituser
}
/
${
gitrepo
}
/raw/
${
gitbranch
}
"
elif
[
${
gitplatform
}
=
github
]
;
then
gitrawfullurl
=
"
${
githuburl
}
/
${
gituser
}
/
${
gitrepo
}
/
${
gitbranch
}
"
else
fn_logecho
"[ Warning ] Selected git platform
${
gitplatform
}
not supported."
exit
fi
## Edit with care or don't
# Hosting directory
# The place where we host our configuration files
defaulthostingdir
=
"/var/www/vhosts/default/htdocs"
# Thunderbird autoconfig paths
autoconfigpath
=
"
${
defaulthostingdir
}
/mail"
autoconfigfile
=
"config-v1.1.xml"
autoconfigpathfile
=
"
${
autoconfigpath
}
/
${
autoconfigfile
}
"
autoconfigpathfile
=
"
${
autoconfigpath
}
/config-v1.1.xml"
# Outlook autodiscover paths
autodiscoverpath
=
"
${
defaulthostingdir
}
/mail"
...
...
@@ -39,7 +53,7 @@ applepath="${defaulthostingdir}/mail"
applewebpagepath
=
"
${
applepath
}
/apple.xml"
applemobileconfpathfile
=
"
${
autodiscoverpath
}
/apple.mobileconfig"
appleweblogo
=
"logo.png"
appleweblogourl
=
"
https://raw.githubusercontent.com/
${
gituser
}
/
${
gitrepo
}
/
${
gitbranch
}
/
${
appleweblogo
}
"
appleweblogourl
=
"
${
gitrawfullurl
}
/
${
appleweblogo
}
"
# URLs used for tests
autoconfigurl
=
"http://autoconfig.
${
hostname
}
/mail/config-v1.1.xml"
...
...
@@ -156,15 +170,13 @@ echo ""
fn_logecho
"[ INFO ] Writing Thunderbird autoconfig config file"
sleep
1
echo
""
curl
"
https://raw.githubusercontent.com/
${
gituser
}
/
${
gitrepo
}
/
${
gitbranch
}
/config-v1.1.xml"
>
"
${
autoconfigpathfile
}
"
curl
"
${
gitrawfullurl
}
/config-v1.1.xml"
>
"
${
autoconfigpathfile
}
"
# Replace values with settings
fn_logecho
"[ ... ] Populating Thunderbird autoconfig file"
sleep
0.5
sed
-i
-e
"s/HOSTNAME/
${
hostname
}
/g"
"
${
autoconfigpathfile
}
"
sed
-i
-e
"s/COMPANYURL/
${
companyurl
}
/g"
"
${
autoconfigpathfile
}
"
sed
-i
-e
"s/COMPANYNAME/
${
companyname
}
/g"
"
${
autoconfigpathfile
}
"
sed
-i
-e
"s/COMPANYSHORTNAME/
${
companyshortname
}
/g"
"
${
autoconfigpathfile
}
"
sed
-i
-e
"s@DOCURL@
${
docurl
}
@g"
"
${
autoconfigpathfile
}
"
# DNS for autoconfig
...
...
@@ -185,7 +197,7 @@ done
echo
""
fn_logecho
"[ INFO ] Writing Outlook autodiscover file"
sleep
1
curl
"
https://raw.githubusercontent.com/
${
gituser
}
/
${
gitrepo
}
/
${
gitbranch
}
/autodiscover.xml"
>
"
${
autodiscoverpathfile
}
"
curl
"
${
gitrawfullurl
}
/autodiscover.xml"
>
"
${
autodiscoverpathfile
}
"
# Outlook settings
fn_logecho
"[ ... ] Populating Outlook autodiscover file"
...
...
@@ -199,14 +211,14 @@ fn_logecho "[ INFO ] Writing Apple config files"
echo
""
sleep
0.5
if
[
${
applewebpagelanguage
}
=
fr
]
;
then
curl
"
https://raw.githubusercontent.com/
${
gituser
}
/
${
gitrepo
}
/
${
gitbranch
}
/apple_fr.xml"
>
"
${
applewebpagepath
}
"
curl
"
${
gitrawfullurl
}
/apple_fr.xml"
>
"
${
applewebpagepath
}
"
elif
[
${
applewebpagelanguage
}
=
en
]
;
then
curl
"
https://raw.githubusercontent.com/
${
gituser
}
/
${
gitrepo
}
/
${
gitbranch
}
/apple_en.xml"
>
"
${
applewebpagepath
}
"
curl
"
${
gitrawfullurl
}
/apple_en.xml"
>
"
${
applewebpagepath
}
"
else
fn_logecho
"[ Warning ] Selected language
${
applewebpagelanguage
}
is not available. Reverting to english."
curl
"
https://raw.githubusercontent.com/
${
gituser
}
/
${
gitrepo
}
/
${
gitbranch
}
/apple_en.xml"
>
"
${
applewebpagepath
}
"
curl
"
${
gitrawfullurl
}
/apple_en.xml"
>
"
${
applewebpagepath
}
"
fi
curl
"
https://raw.githubusercontent.com/
${
gituser
}
/
${
gitrepo
}
/
${
gitbranch
}
/apple.mobileconfig"
>
"
${
applemobileconfpathfile
}
"
curl
"
${
gitrawfullurl
}
/apple.mobileconfig"
>
"
${
applemobileconfpathfile
}
"
# Apple web page Logo
fn_logecho
"[ ... ] Downloading
${
appleweblogo
}
logo for Apple web page"
...
...
@@ -283,4 +295,4 @@ else
fn_logecho
"[ Warning ] Apple
${
appleconfigurl
}
does not seem to be accessible"
fi
fn_logecho
"[ OK ] Done"
fn_logecho
"[ OK ] Done"
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment