Skip to content

Commit

Permalink
roundcube: skip sauserprefs config when SA not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Dec 17, 2024
1 parent 6f37f51 commit 674dc28
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions provision/roundcube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,23 @@ configure_roundcube_plugins()
-e "/'password_vpopmaild_host'/s/localhost/vpopmail/" \
"$STAGE_MNT/usr/local/www/roundcube/plugins/password/config.inc.php"

tell_status "configure the SA UserPrefs plugin"
if [ ! -f "$STAGE_MNT/usr/local/www/roundcube/plugins/sauserprefs/config.inc.php" ]; then
cp "$STAGE_MNT/usr/local/www/roundcube/plugins/sauserprefs/config.inc.php.dist" \
"$STAGE_MNT/usr/local/www/roundcube/plugins/sauserprefs/config.inc.php"
fi
local _sapass
_sapass=$(grep user_scores_sql_password /data/spamassassin/etc/sql.cf | awk '{ print $2 }')
if [ -n "$_sapass" ]; then
sed -i.bak \
-e "/'sauserprefs_db_dsnw'/s|mysql://username:password@localhost/database|mysql://spamassassin:${_sapass}@mysql/spamassassin|" \
"$STAGE_MNT/usr/local/www/roundcube/plugins/sauserprefs/config.inc.php"
if [ -d "$ZFS_DATA_MNT/spamassassin/etc" ]; then

if [ ! -f "$STAGE_MNT/usr/local/www/roundcube/plugins/sauserprefs/config.inc.php" ] &&
[ -f "$STAGE_MNT/usr/local/www/roundcube/plugins/sauserprefs/config.inc.php.dist" ]; then
tell_status "installing default SA UserPrefs plugin config"
cp "$STAGE_MNT/usr/local/www/roundcube/plugins/sauserprefs/config.inc.php.dist" \
"$STAGE_MNT/usr/local/www/roundcube/plugins/sauserprefs/config.inc.php"
fi

local _sapass
_sapass=$(grep user_scores_sql_password "$ZFS_DATA_MNT/spamassassin/etc/sql.cf" | awk '{ print $2 }')
if [ -n "$_sapass" ]; then
tell_status "configure the SA UserPrefs plugin"
sed -i.bak \
-e "/'sauserprefs_db_dsnw'/s|mysql://username:password@localhost/database|mysql://spamassassin:${_sapass}@mysql/spamassassin|" \
"$STAGE_MNT/usr/local/www/roundcube/plugins/sauserprefs/config.inc.php"
fi
fi
}

Expand Down

0 comments on commit 674dc28

Please sign in to comment.