Commit ba8f055a authored by Marco Mariani's avatar Marco Mariani

cover several "user=zimbra" cases in configuration files

parent 2e2a9405
......@@ -199,7 +199,6 @@ git-executable = ${git:location}/bin/git
[zimbra-sources-search-replace]
# replace all remaining occurrences of /opt/zimbra
recipe = plone.recipe.command
ZIMBRA_HOME = ${environment:ZIMBRA_HOME}
PERL_BINARY = ${perl:location}/bin/perl
......@@ -208,13 +207,26 @@ update-command = ${:command}
command =
cd ${zimbra-sources:location}
find . -name LocalConfig.java -exec sed -i 's#= FS + "opt" + FS + "zimbra"#= "${:ZIMBRA_HOME}"#g' {} \;
# sixteen backslashes, yeah.
ZIMBRA_HOME_WITH_BACKSLASHES=`echo $ZIMBRA_HOME | sed "s#/#\\\\\\\\\\\\\\\\/#g"`
# for most cases:
SUB1='s#/opt/zimbra#${:ZIMBRA_HOME}#g'
# perl scripts shebang:
SUB2='1{s|^#!/usr/bin/perl|#!${:PERL_BINARY}|}'
# zmamavisdctl and friends:
SUB3="s#\\\\/opt\\\\/zimbra#$ZIMBRA_HOME_WITH_BACKSLASHES#g"
GROUP_NAME=`id -gn`
USER_NAME=`id -un`
find . -name '.git' -prune -o -type f -exec sed -i "$SUB1;$SUB2" {} \;
sed -i "s|\$daemon_user *= *'zimbra';|\$daemon_user = '$USER_NAME';|" ZimbraServer/conf/amavisd.conf.in
sed -i "s|\$daemon_group *= *'zimbra';|\$daemon_group = '$GROUP_NAME';|" ZimbraServer/conf/amavisd.conf.in
# replace all remaining occurrences of /opt/zimbra
find . -name '.git' -prune -o -type f -exec sed -i "$SUB1;$SUB2;$SUB3" {} \;
# replace occurrences of zimbra users in config files
# do not match the beginning of lines because escaping $ is easy to get wrong
sed -i "s|daemon_user *= *'zimbra';|daemon_user = '$USER_NAME';|" ZimbraServer/conf/amavisd.conf.in
sed -i "s|daemon_group *= *'zimbra';|daemon_group = '$GROUP_NAME';|" ZimbraServer/conf/amavisd.conf.in
sed -i "s|UserID *zimbra:zimbra|UserID $USER_NAME:$GROUP_NAME|" ZimbraServer/conf/opendkim.conf.in
sed -i "s|User zimbra|User $USER_NAME|" ZimbraServer/conf/clamd.conf.in
sed -i "s|Trust zimbra|Trust $USER_NAME|" ZimbraServer/conf/dspam.conf.in
sed -i "s|DatabaseOwner zimbra|DatabaseOwner $USER_NAME|" ZimbraServer/conf/freshclam.conf.in
[zimbra-build]
......
Markdown is supported
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