#!/usr/bin/perl
# cpanel - autofixer2/fix-exim-mail-providers        Copyright 2017 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;

BEGIN { unshift @INC, "/usr/local/cpanel"; }

use Cpanel::FileUtils::TouchFile ();

exit script() unless caller;

sub script {
    my $touchfile = '/var/cpanel/version/fix-exim-mail-providers';
    return 0 if -e $touchfile;
    return 0 unless -x '/usr/local/cpanel/scripts/manage_greylisting';
    system(qw{/usr/local/cpanel/scripts/manage_greylisting --init --update_common_mail_providers});
    system(qw{/usr/local/cpanel/scripts/restartsrv_exim});
    Cpanel::FileUtils::TouchFile::touchfile($touchfile);
    return 0;
}
