install_roundcube.sh: support sieve scripts as autoresponder.

This commit is contained in:
Christoph 2022-06-22 15:42:45 +02:00
parent c121bc187e
commit 48ca1e52a4

View File

@ -229,6 +229,40 @@ echo ""
echo -e "\033[32m--\033[m"
echo ""
VACATION_PLUGIN=false
VACATION_SIEVE=false
_OK=false
echo ""
echo "With which method should an E-Mail Responder be realized??"
echo ""
echo " [1] Plugin 'vacation'"
echo " [2] With a sive script using managesieve plugin"
echo ""
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && ( [[ $_IN -eq 1 ]] || [[ $_IN -eq 2 ]] ) ; then
if [[ $_IN -eq 1 ]] ; then
VACATION_PLUGIN=true
VACATION_SIEVE=false
else
VACATION_PLUGIN=false
VACATION_SIEVE=true
fi
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
echo ""
echo -e "\033[32m--\033[m"
echo ""
# - Default values
# -
@ -511,11 +545,18 @@ if [[ "$DB_TYPE" = "mysql" ]]; then
echo -e "\tMySQL Credentials (root access)......: $MYSQL_CREDENTIALS"
fi
echo ""
echo -e "\tHostname for Vacation Messages.......: $AUTOREPLY_HOSTNAME"
if $VACATION_PLUGIN ; then
echo -e "\tUse 'vacation'-plugin................: $VACATION_PLUGIN"
echo -e "\tHostname for Vacation Messages.......: $AUTOREPLY_HOSTNAME"
fi
if $VACATION_SIEVE ; then
echo -e "\tUse sieve script as autoresponder....: $VACATION_SIEVE"
fi
echo ""
echo -e "\tName of Junk Folder..................: $SPAM_FOLDER_NAME"
echo ""
echo ""
echo ""
echo -e "\tInclude 'acl' plugin?..................: $INCLUDE_ACL_PLUGIN"
echo ""
@ -2268,7 +2309,11 @@ fi
#fi
_key="managesieve_vacation"
_val="2"
if $VACATION_SIEVE ; then
_val="2"
else
_val="0"
fi
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin}/config.inc.php > $log_file 2>&1
@ -2471,174 +2516,175 @@ echo -e "\tNothing more to do here. Plugin '$_plugin' will be added to array plu
# - vacation
# -
_plugin="vacation"
add_plugin_arr+=("$_plugin")
if $VACATION_PLUGIN ; then
_plugin="vacation"
add_plugin_arr+=("$_plugin")
_config_file="${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin}/config.inc.php"
_backup_file="${_config_file}.$backup_date"
_config_file="${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin}/config.inc.php"
_backup_file="${_config_file}.$backup_date"
echo -e "\n\t\033[32mPlugin '$_plugin'\033[m"
echononl "\tDownload Pluging '$_plugin'.."
wget -O ${WEBSITE_BASEDIR}/rc-vacation-master.zip \
echo -e "\n\t\033[32mPlugin '$_plugin'\033[m"
echononl "\tDownload Pluging '$_plugin'.."
wget -O ${WEBSITE_BASEDIR}/rc-vacation-master.zip \
https://github.com/bhuisgen/rc-vacation/archive/master.zip > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
echononl "\tUnpack archiv into Plugin Folder"
unzip -d ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/ \
echononl "\tUnpack archiv into Plugin Folder"
unzip -d ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/ \
${WEBSITE_BASEDIR}/rc-vacation-master.zip > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
echononl "\tCeate Symlink '$_plugin' in plugin folder.."
ln -s rc-vacation-master \
echononl "\tCeate Symlink '$_plugin' in plugin folder.."
ln -s rc-vacation-master \
${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin} > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
echononl "\tCopy default config file to 'config.inc.php'.."
cp -a ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin}/config.inc.php.dist \
echononl "\tCopy default config file to 'config.inc.php'.."
cp -a ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin}/config.inc.php.dist \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_gui_vacationdate"
_val="TRUE"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
_key="vacation_gui_vacationdate"
_val="TRUE"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_subject_default"
_val="'Re: \\\$SUBJECT'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
_key="vacation_subject_default"
_val="'Re: \\\$SUBJECT'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_gui_vacationforwarder"
_val="$VAC_GUI_FORWARDER"
echononl "\tchange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
_key="vacation_gui_vacationforwarder"
_val="$VAC_GUI_FORWARDER"
echononl "\tchange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_dateformat"
_val="'Y-m-d'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
_key="vacation_dateformat"
_val="'Y-m-d'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_jquery_calendar"
_val="TRUE"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
_key="vacation_jquery_calendar"
_val="TRUE"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_jquery_dateformat"
_val="'yy-m-d'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
_key="vacation_jquery_dateformat"
_val="'yy-m-d'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_forwarder_multiple"
_val="'FALSE'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
_key="vacation_forwarder_multiple"
_val="'FALSE'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_forwarder_separator"
_val="','"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
_key="vacation_forwarder_separator"
_val="','"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_driver"
_val="'sql'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
_key="vacation_driver"
_val="'sql'"
echononl "\tChange '$_key' to $_val"
perl -i -n -p -e "s#(^\s*\\\$(rcmail_)?config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \
$_config_file > $log_file 2>&1
if [[ $? -eq 0 ]] ; then
if [[ $? -eq 0 ]] ; then
echo_ok
else
else
echo_failed
error "$(cat $log_file)"
fi
fi
_key="vacation_sql_dsn"
_val="'${POSTFIX_DB_TYPE}://${POSTFIX_DB_USER}:${POSTFIX_DB_PASSWD}@${POSTFIX_DB_HOST}/${POSTFIX_DB_NAME}'"
echononl "\tChange '$_key' to $_val"
_key="vacation_sql_dsn"
_val="'${POSTFIX_DB_TYPE}://${POSTFIX_DB_USER}:${POSTFIX_DB_PASSWD}@${POSTFIX_DB_HOST}/${POSTFIX_DB_NAME}'"
echononl "\tChange '$_key' to $_val"
failed=false
mv $_config_file $_backup_file > $log_file 2>&1
if [[ $? -ne 0 ]]; then
failed=false
mv $_config_file $_backup_file > $log_file 2>&1
if [[ $? -ne 0 ]]; then
_failed=true
fi
_found=false
_found_comment=false
while IFS='' read -r _line || [[ -n $_line ]] ; do
fi
_found=false
_found_comment=false
while IFS='' read -r _line || [[ -n $_line ]] ; do
if echo "$_line" | grep -i -E "^\s*\\\$(rcmail_)?config\['$_key'\]\s*=\s*'[^']*'\s*;" > /dev/null 2>&1 ; then
echo '//!'"$_line" >> $_config_file
echo "\$config['$_key'] = $_val;" >> $_config_file
@ -2673,27 +2719,27 @@ while IFS='' read -r _line || [[ -n $_line ]] ; do
echo "$_line" >> $_config_file
done < "$_backup_file"
if [[ $? -ne 0 ]]; then
done < "$_backup_file"
if [[ $? -ne 0 ]]; then
_failed=true
fi
if $_failed ; then
fi
if $_failed ; then
echo_failed
else
else
echo_ok
fi
fi
failed=false
mv $_config_file $_backup_file > $log_file 2>&1
if [[ $? -ne 0 ]]; then
failed=false
mv $_config_file $_backup_file > $log_file 2>&1
if [[ $? -ne 0 ]]; then
_failed=true
fi
_key="vacation_sql_read"
echononl "\tChange '$_key'.."
_found=false
_found_comment=false
while IFS='' read -r _line || [[ -n $_line ]] ; do
fi
_key="vacation_sql_read"
echononl "\tChange '$_key'.."
_found=false
_found_comment=false
while IFS='' read -r _line || [[ -n $_line ]] ; do
if echo "$_line" | grep -i -E "^\s*\\\$(rcmail_)?config\['$_key'\]\s*=\s*array\s*\([^\)]*\)\s*;" > /dev/null 2>&1 ; then
echo '//!'"$_line" >> $_config_file
echo "\$config['$_key'] = array($;" >> $_config_file
@ -2752,26 +2798,26 @@ EOF
fi
echo "$_line" >> $_config_file
done < "$_backup_file"
if [[ $? -ne 0 ]]; then
done < "$_backup_file"
if [[ $? -ne 0 ]]; then
_failed=true
fi
if $_failed ; then
fi
if $_failed ; then
echo_failed
else
else
echo_ok
fi
fi
failed=false
mv $_config_file $_backup_file > $log_file 2>&1
if [[ $? -ne 0 ]]; then
failed=false
mv $_config_file $_backup_file > $log_file 2>&1
if [[ $? -ne 0 ]]; then
_failed=true
fi
_key="vacation_sql_write"
echononl "\tChange '$_key'.."
_found=false
_found_comment=false
while IFS='' read -r _line || [[ -n $_line ]] ; do
fi
_key="vacation_sql_write"
echononl "\tChange '$_key'.."
_found=false
_found_comment=false
while IFS='' read -r _line || [[ -n $_line ]] ; do
if echo "$_line" | grep -i -E "^\s*\\\$(rcmail_)?config\['$_key'\]\s*=\s*array\s*\([^\)]*\)\s*;" > /dev/null 2>&1 ; then
echo '//!'"$_line" >> $_config_file
echo "\$config['$_key'] = array($;" >> $_config_file
@ -2916,17 +2962,17 @@ EOF
fi
echo "$_line" >> $_config_file
done < "$_backup_file"
if [[ $? -ne 0 ]]; then
done < "$_backup_file"
if [[ $? -ne 0 ]]; then
_failed=true
fi
if $_failed ; then
fi
if $_failed ; then
echo_failed
else
else
echo_ok
fi
fi
if [[ "$POSTFIX_DB_TYPE" = 'pgsql' ]] ; then
if [[ "$POSTFIX_DB_TYPE" = 'pgsql' ]] ; then
echononl "\tCreate postfix language plpgsql"
_pgpsql_exists=$(su - postgres -c "psql -t -c \"SELECT EXISTS ( SELECT 1 FROM pg_language WHERE lanname = 'plpgsql');\"")
if [[ "$_pgpsql_exists" =~ t ]]; then
@ -3261,7 +3307,7 @@ EOF
echo_ok
fi
fi
else
else
echononl "\tCreate function 'FORWARDERS_OUT'"
echo_skipped
@ -3270,9 +3316,11 @@ else
warn "Create functions 'FORWARDERS_OUT' and 'FORWARDERS_IN' not yet implemented"
fi
fi
echo -e "\tNothing more to do here. Plugin '$_plugin' will be added to array plugins later.."
echo -e "\tNothing more to do here. Plugin '$_plugin' will be added to array plugins later.."
fi # if $VACATION_PLUGIN
# - zipdownload