Commit eaa0ed97 authored by Benoît's avatar Benoît
Browse files

Adapted script for gitlab migration

parent c1355c92
......@@ -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="https://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"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment