mirror of
https://github.com/waytotheweb/scripts.git
synced 2026-03-29 20:37:08 +00:00
Product Uninstall Scripts
This commit is contained in:
117
MailScanner/msuninstall.pl
Normal file
117
MailScanner/msuninstall.pl
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
#!/usr/local/cpanel/3rdparty/bin/perl
|
||||||
|
###############################################################################
|
||||||
|
# Copyright 2004-2020, Way to the Web Limited
|
||||||
|
# URL: http://www.configserver.com
|
||||||
|
# Email: sales@waytotheweb.com
|
||||||
|
###############################################################################
|
||||||
|
# start main
|
||||||
|
use strict;
|
||||||
|
use Path::Tiny;
|
||||||
|
use IPC::Open3;
|
||||||
|
use Fcntl qw(:DEFAULT :flock);
|
||||||
|
|
||||||
|
our ($installed, $option, $cpanel);
|
||||||
|
|
||||||
|
$installed = 0;
|
||||||
|
if (-d "/usr/mailscanner/") {$installed = 1}
|
||||||
|
|
||||||
|
$cpanel = 1;
|
||||||
|
unless (-e "/usr/local/cpanel/version") {$cpanel = 0}
|
||||||
|
|
||||||
|
print "Removing MailScanner...\n\n";
|
||||||
|
|
||||||
|
if ($cpanel) {
|
||||||
|
print "Updating Config and Restarting Exim...\n";
|
||||||
|
unlink ("/etc/antivirus.empty");
|
||||||
|
open (IN,"<", "/etc/exim.conf.localopts");
|
||||||
|
flock (IN, LOCK_SH);
|
||||||
|
my @localopts = <IN>;
|
||||||
|
close (IN);
|
||||||
|
chomp @localopts;
|
||||||
|
sysopen (OUT, "/etc/exim.conf.localopts", O_WRONLY | O_CREAT | O_TRUNC);
|
||||||
|
flock (OUT, LOCK_EX);
|
||||||
|
foreach my $line (@localopts) {
|
||||||
|
if ($line !~ /^systemfilter/) {print OUT "$line\n"}
|
||||||
|
}
|
||||||
|
print OUT "systemfilter=/etc/antivirus.exim\n";
|
||||||
|
close OUT;
|
||||||
|
|
||||||
|
unlink ("/etc/exim_outgoing.conf");
|
||||||
|
unlink ("/etc/exiscandisable");
|
||||||
|
|
||||||
|
open (IN, "<", "/etc/exim.conf.local");
|
||||||
|
flock (IN, LOCK_SH);
|
||||||
|
my @exim_conf_local = <IN>;
|
||||||
|
close (IN);
|
||||||
|
chomp @exim_conf_local;
|
||||||
|
sysopen (OUT, "/etc/exim.conf.local", O_WRONLY | O_CREAT | O_TRUNC);
|
||||||
|
flock (OUT, LOCK_EX);
|
||||||
|
foreach my $line (@exim_conf_local) {
|
||||||
|
if ($line =~ /message_logs = false/) {next}
|
||||||
|
if ($line =~ /queue_only_override = false/) {next}
|
||||||
|
if ($line =~ /\.include_if_exists \/usr\/msfe\/spambox\.conf/) {next}
|
||||||
|
print OUT "$line\n";
|
||||||
|
}
|
||||||
|
close (OUT);
|
||||||
|
|
||||||
|
foreach my $file ("/usr/local/cpanel/etc/exim/acls/ACL_MAIL_PRE_BLOCK/custom_begin_mail_pre", "/usr/local/cpanel/etc/exim/acls/ACL_MAIL_POST_BLOCK/custom_begin_mail_post") {
|
||||||
|
open (my $ACL, "<", $file);
|
||||||
|
flock ($ACL, LOCK_SH);
|
||||||
|
my @acl_config = <$ACL>;
|
||||||
|
close ($ACL);
|
||||||
|
chomp @acl_config;
|
||||||
|
sysopen (OUT, "$file", O_WRONLY | O_CREAT | O_TRUNC);
|
||||||
|
flock (OUT, LOCK_EX);
|
||||||
|
foreach my $line (@acl_config) {
|
||||||
|
if ($line =~ /\.include_if_exists \/usr\/msfe\/mailscannerq\.conf/) {next}
|
||||||
|
print OUT "$line\n";
|
||||||
|
}
|
||||||
|
close (OUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
system("/scripts/buildeximconf");
|
||||||
|
system("/scripts/restartsrv_exim");
|
||||||
|
print "Done\n";
|
||||||
|
|
||||||
|
open (IN,"<", "/etc/chkserv.d/chkservd.conf");
|
||||||
|
flock (IN, LOCK_SH);
|
||||||
|
my @chkservd = <IN>;
|
||||||
|
close (IN);
|
||||||
|
chomp @chkservd;
|
||||||
|
sysopen (OUT, "/etc/chkserv.d/chkservd.conf", O_WRONLY | O_CREAT | O_TRUNC);
|
||||||
|
flock (OUT, LOCK_EX);
|
||||||
|
foreach my $line (@chkservd) {
|
||||||
|
if ($line !~ /^mailscanner/) {print OUT "$line\n"}
|
||||||
|
}
|
||||||
|
close OUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
unlink ("/usr/msfe/mailscannerq");
|
||||||
|
|
||||||
|
print "Stopping MailScanner and cron jobs...\n";
|
||||||
|
system ("killall", "-9", "MailScanner");
|
||||||
|
unlink ("/etc/cron.daily/clean.quarantine.cron");
|
||||||
|
unlink ("/etc/cron.daily/clean.incoming.cron");
|
||||||
|
unlink ("/etc/cron.hourly/update_virus_scanners");
|
||||||
|
unlink ("/etc/chkserv.d/mailscanner");
|
||||||
|
unlink ("/var/run/chkservd/mailscanner");
|
||||||
|
unlink "/etc/mail/spamassassin/mailscanner.cf";
|
||||||
|
print "Done\n";
|
||||||
|
|
||||||
|
print "Removing MailScanner directories...\n";
|
||||||
|
if (-d "/usr/mailscanner/") {system ("/bin/rm -Rf /usr/mailscanner/")}
|
||||||
|
if (-d "/var/spool/MailScanner/") {system ("/bin/rm -Rf /var/spool/MailScanner/")}
|
||||||
|
if (-d "/var/spool/exim_incoming/") {
|
||||||
|
system ("/bin/cp -avf /var/spool/exim_incoming/input/* /var/spool/exim/input/");
|
||||||
|
system ("/bin/rm -Rf /var/spool/exim_incoming/");
|
||||||
|
}
|
||||||
|
if (-d "/var/spool/exim/mailscanner/") {
|
||||||
|
system ("/bin/cp -avf /var/spool/exim/mailscanner/input/* /var/spool/exim/input/");
|
||||||
|
system ("/bin/rm -Rf /var/spool/exim/mailscanner/");
|
||||||
|
}
|
||||||
|
if (-d "/var/spool/mqueue/") {system ("/bin/rm -Rf /var/spool/mqueue/")}
|
||||||
|
print "Done\n";
|
||||||
|
|
||||||
|
print "All Done\n";
|
||||||
|
|
||||||
|
exit;
|
||||||
50
MailScanner/uninstall.sh
Normal file
50
MailScanner/uninstall.sh
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
###############################################################################
|
||||||
|
# Copyright 2004-2020, Way to the Web Limited
|
||||||
|
# URL: http://www.configserver.com
|
||||||
|
# Email: sales@waytotheweb.com
|
||||||
|
###############################################################################
|
||||||
|
PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
|
||||||
|
if [ ! -e "msinstall.pl" ]; then
|
||||||
|
echo "You must be inside the msinstall directory to run this script"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "/usr/local/cpanel/version" ]; then
|
||||||
|
sed -i 's%/usr/bin/perl%/usr/local/cpanel/3rdparty/bin/perl%' msuninstall.pl
|
||||||
|
else
|
||||||
|
sed -i 's%/usr/local/cpanel/3rdparty/bin/perl%/usr/bin/perl%' msuninstall.pl
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "/usr/msfe/uninstall.msfe.sh" ]; then
|
||||||
|
sh /usr/msfe/uninstall.msfe.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -Rfv /usr/msfe
|
||||||
|
rm -f /etc/cron.daily/mailscanner_daily.cron
|
||||||
|
|
||||||
|
if test `cat /proc/1/comm` = "systemd"
|
||||||
|
then
|
||||||
|
systemctl disable MailScanner.service
|
||||||
|
systemctl stop MailScanner.service
|
||||||
|
|
||||||
|
rm -f /usr/lib/systemd/system/MailScanner.service
|
||||||
|
systemctl daemon-reload
|
||||||
|
else
|
||||||
|
service MailScanner stop
|
||||||
|
chkconfig MailScanner off
|
||||||
|
chkconfig MailScanner --del
|
||||||
|
rm -f /etc/init.d/MailScanner
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "/usr/local/cpanel/version" ]; then
|
||||||
|
rm -f /etc/chkservd.d/mailscanner
|
||||||
|
rm -f /var/run/chkservd/mailscanner
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod +x msuninstall.pl
|
||||||
|
./msuninstall.pl 3
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "All done."
|
||||||
26
cmc/cmc_uninstall.sh
Normal file
26
cmc/cmc_uninstall.sh
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
###############################################################################
|
||||||
|
# Copyright 2006-2017, Way to the Web Limited
|
||||||
|
# URL: http://www.configserver.com
|
||||||
|
# Email: sales@waytotheweb.com
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if [ -e "/usr/local/cpanel/bin/unregister_appconfig" ]; then
|
||||||
|
cd /
|
||||||
|
/usr/local/cpanel/bin/unregister_appconfig cmc
|
||||||
|
else
|
||||||
|
if [ ! -e "/var/cpanel/apps/cmc.conf" ]; then
|
||||||
|
/bin/rm -fv /var/cpanel/apps/cmc.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/addon_cmc.cgi
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/cmcversion.txt
|
||||||
|
/bin/rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/cmc
|
||||||
|
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cmc.cgi
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cmcversion.txt
|
||||||
|
/bin/rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cmc
|
||||||
|
|
||||||
|
echo "ConfigServer Mod Security has been uninstalled."
|
||||||
|
exit
|
||||||
21
cmm/cmm_uninstall.sh
Normal file
21
cmm/cmm_uninstall.sh
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -e "/usr/local/cpanel/bin/unregister_appconfig" ]; then
|
||||||
|
cd /
|
||||||
|
/usr/local/cpanel/bin/unregister_appconfig cmm
|
||||||
|
else
|
||||||
|
if [ ! -e "/var/cpanel/apps/cmm.conf" ]; then
|
||||||
|
/bin/rm -fv /var/cpanel/apps/cmm.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/addon_cmm.cgi
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/cmmversion.txt
|
||||||
|
/bin/rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/cmm
|
||||||
|
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cmm.cgi
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cmmversion.txt
|
||||||
|
/bin/rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cmm
|
||||||
|
|
||||||
|
echo "ConfigServer Mail Manage has been uninstalled."
|
||||||
|
exit
|
||||||
43
cmq/cmq_uninstall.sh
Normal file
43
cmq/cmq_uninstall.sh
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
###############################################################################
|
||||||
|
# Copyright 2009-2019, Way to the Web Limited
|
||||||
|
# URL: http://www.configserver.com
|
||||||
|
# Email: sales@waytotheweb.com
|
||||||
|
###############################################################################
|
||||||
|
PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
|
||||||
|
if [ -e "/usr/local/cpanel/version" ]; then
|
||||||
|
|
||||||
|
echo "Running cmq cPanel uninstaller"
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [ -e "/usr/local/cpanel/bin/unregister_appconfig" ]; then
|
||||||
|
cd /
|
||||||
|
/usr/local/cpanel/bin/unregister_appconfig cmq
|
||||||
|
else
|
||||||
|
if [ ! -e "/var/cpanel/apps/cmq.conf" ]; then
|
||||||
|
/bin/rm -fv /var/cpanel/apps/cmq.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/addon_cmq.cgi
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/cmqversion.txt
|
||||||
|
/bin/rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/cmq
|
||||||
|
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cmq.cgi
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cmqversion.txt
|
||||||
|
/bin/rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cmq
|
||||||
|
|
||||||
|
elif [ -e "/usr/local/directadmin/directadmin" ]; then
|
||||||
|
|
||||||
|
echo "Running cmq DirectAdmin uninstaller"
|
||||||
|
echo
|
||||||
|
|
||||||
|
/bin/rm -Rfv /usr/local/directadmin/plugins/cmq
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/rm -Rfv /etc/cmq
|
||||||
|
|
||||||
|
echo "ConfigServer Mail Queues has been uninstalled."
|
||||||
|
exit
|
||||||
21
cse/uninstall.sh
Normal file
21
cse/uninstall.sh
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -e "/usr/local/cpanel/bin/unregister_appconfig" ]; then
|
||||||
|
cd /
|
||||||
|
/usr/local/cpanel/bin/unregister_appconfig cse
|
||||||
|
else
|
||||||
|
if [ ! -e "/var/cpanel/apps/cse.conf" ]; then
|
||||||
|
/bin/rm -fv /var/cpanel/apps/cse.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/addon_cse.cgi
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/cseversion.txt
|
||||||
|
/bin/rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/cse
|
||||||
|
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cse.cgi
|
||||||
|
/bin/rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cseversion.txt
|
||||||
|
/bin/rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/configserver/cse
|
||||||
|
|
||||||
|
echo "ConfigServer Explorer has been uninstalled."
|
||||||
|
exit
|
||||||
Reference in New Issue
Block a user