mirror of
https://github.com/MailScanner/v5.git
synced 2024-09-20 07:16:10 +08:00
install.sh update (#653)
* install for nix initial * cleanup dupes * NIX cpan method relying on PATH env
This commit is contained in:
parent
d079001c15
commit
a208040f47
17
nix/INSTALL
17
nix/INSTALL
|
@ -11,16 +11,19 @@
|
|||
#
|
||||
# Support: http://lists.mailscanner.info/mailman/listinfo/mailscanner
|
||||
#
|
||||
# Updated: 2 Nov 2019
|
||||
# Updated: 24 Feb 2023
|
||||
# MailScanner Team <https://www.mailscanner.info>
|
||||
#
|
||||
|
||||
|
||||
The install for NIX* is very straightforward. It simply copies the files into place. From
|
||||
there you will need to create the links to get MailScanner to start at boot.
|
||||
there you will need to create the links to get MailScanner to start at boot, etc.
|
||||
|
||||
Requirements: perl, perldoc, curl, cpan, and network access if you want to install missing Perl modules
|
||||
via CPAN.
|
||||
Requirements: perl, perldoc, curl, wget, cpan, sudo, tar, essential perl build tools such as
|
||||
make, and network access, if you want to install modules from CPAN.
|
||||
|
||||
If you are using RHEL derivatives, Debian derivatives (including Ubuntu), or openSUSE
|
||||
derivatives, use the appropriate package and not this method from tarball for a greater
|
||||
chance of success.
|
||||
|
||||
Important files to note:
|
||||
|
||||
|
@ -38,8 +41,10 @@ The main configuration file for MailScanner's engine. You will also need to cust
|
|||
/usr/lib/MailScanner/init/ms-init
|
||||
|
||||
This is the initialization script for MailScanner. This is the script you would symlink to control
|
||||
MailScanner using start/stop/restart/reload/kill.
|
||||
MailScanner using start/stop/restart/reload/kill on sysv init-based systems
|
||||
|
||||
/usr/lib/MailScanner/systemd/ms-*
|
||||
These are the systemd unit files that can be used on systemd systems
|
||||
|
||||
/usr/sbin/ms-perl-check
|
||||
|
||||
|
|
158
nix/install.sh
158
nix/install.sh
|
@ -3,7 +3,7 @@
|
|||
# MailScanner installation script for NIX* based systems
|
||||
#
|
||||
#
|
||||
# Updated: 2 Nov 2019
|
||||
# Updated: Feb 24 2023
|
||||
# MailScanner Team <https://www.mailscanner.info>
|
||||
|
||||
# clear the screen. yay!
|
||||
|
@ -28,9 +28,18 @@ fi
|
|||
|
||||
clear
|
||||
echo;
|
||||
echo "WRANING: backup your custom MailScanner files before proceeding. They will be overwritten!";
|
||||
echo "WARNING: backup your custom MailScanner files before proceeding. They will be overwritten!";
|
||||
echo;
|
||||
echo "These items should be installed before proceeding: perl, perldoc, curl, cpan";
|
||||
echo "These items should be installed before proceeding: perl, perldoc, curl, wget, cpan, sudo,"
|
||||
echo "tar, and essential perl build tools such as make.";
|
||||
echo;
|
||||
echo "If you are using RHEL derivatives, Debian derivatives (including Ubuntu), or openSUSE"
|
||||
echo "derivatives, use the appropriate package and not this method from tarball for a greater"
|
||||
echo "chance of success."
|
||||
echo;
|
||||
echo "To install SpamAssassin 4.0, an unprivileged user 'sabuild' will be needed and granted";
|
||||
echo "temporary sudo privileges. This is necessary to obtain a successful build. sudo privileges";
|
||||
echo "will be removed after install, and you can optionally remove the 'sabuild' user at any time";
|
||||
echo;
|
||||
echo "Press <return> to continue or CTRL+C to quit.";
|
||||
echo;
|
||||
|
@ -43,7 +52,11 @@ echo "Do you want to install missing perl modules via CPAN?"; echo;
|
|||
echo "I can attempt to install Perl modules via CPAN. Missing modules will likely ";
|
||||
echo "cause MailScanner to malfunction.";
|
||||
echo;
|
||||
echo "WARNING: You must have perl, perldoc, curl, cpan installed for this to work!";
|
||||
echo "WARNING: You must have perl, perldoc, curl, wget, cpan, sudo,"
|
||||
echo "tar, and essential perl build tools such as make for this to work!"
|
||||
echo;
|
||||
echo "You must have a working cpan configuration for root (defaults) and"
|
||||
echo "an sabuild user (sudo) for this to work!"
|
||||
echo;
|
||||
echo "Recommended: Y (yes)"; echo;
|
||||
read -r -p "Install missing Perl modules via CPAN? [n/Y] : " response
|
||||
|
@ -60,7 +73,6 @@ else
|
|||
CPANOPTION=0
|
||||
fi
|
||||
|
||||
|
||||
# the array of perl modules needed
|
||||
ARMOD=();
|
||||
ARMOD+=('Archive::Tar'); ARMOD+=('Archive::Zip'); ARMOD+=('bignum');
|
||||
|
@ -85,28 +97,77 @@ ARMOD+=('Pod::Simple'); ARMOD+=('POSIX'); ARMOD+=('Scalar::Util');
|
|||
ARMOD+=('Socket'); ARMOD+=('Storable'); ARMOD+=('Test::Harness');
|
||||
ARMOD+=('Test::Pod'); ARMOD+=('Test::Simple'); ARMOD+=('Time::HiRes');
|
||||
ARMOD+=('Time::localtime'); ARMOD+=('Sys::Hostname::Long'); ARMOD+=('Sys::SigAction');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env');
|
||||
ARMOD+=('Mail::SpamAssassin');
|
||||
|
||||
# not required but nice to have
|
||||
ARMOD+=('bignum');
|
||||
ARMOD+=('Data::Dump'); ARMOD+=('DB_File'); ARMOD+=('DBD::SQLite');
|
||||
ARMOD+=('DBI'); ARMOD+=('Digest'); ARMOD+=('Encode::Detect');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env'); ARMOD+=('LWP::UserAgent');
|
||||
ARMOD+=('Data::Dump'); ARMOD+=('DB_File'); ARMOD+=('Digest');
|
||||
ARMOD+=('Encode::Detect'); ARMOD+=('IO::Wrap'); ARMOD+=('CPAN');
|
||||
ARMOD+=('Error'); ARMOD+=('ExtUtils::CBuilder'); ARMOD+=('ExtUtils::ParseXS');
|
||||
ARMOD+=('Getopt::Long'); ARMOD+=('Inline'); ARMOD+=('IO::String');
|
||||
ARMOD+=('Inline'); ARMOD+=('IO::String'); ARMOD+=('Net::DNS::Resolver::Programmable');
|
||||
ARMOD+=('IO::Zlib'); ARMOD+=('IP::Country'); ARMOD+=('Mail::SPF');
|
||||
ARMOD+=('Mail::SPF::Query'); ARMOD+=('Module::Build'); ARMOD+=('Net::CIDR::Lite');
|
||||
ARMOD+=('Net::DNS'); ARMOD+=('Net::LDAP'); ARMOD+=('Net::DNS::Resolver::Programmable');
|
||||
ARMOD+=('NetAddr::IP'); ARMOD+=('Parse::RecDescent'); ARMOD+=('Test::Harness');
|
||||
ARMOD+=('NetAddr::IP'); ARMOD+=('Parse::RecDescent'); ARMOD+=('WWW::RobotRules');
|
||||
ARMOD+=('Test::Manifest'); ARMOD+=('Text::Balanced'); ARMOD+=('URI');
|
||||
ARMOD+=('version'); ARMOD+=('IO::Compress::Bzip2'); ARMOD+=('Sendmail::PMilter');
|
||||
ARMOD+=('Razor2::Client::Agent'); ARMOD+=('File::ShareDir::Install'); ARMOD+=('Mail::DKIM');
|
||||
ARMOD+=('Math::Int64'); ARMOD+=('IP::Country::DB_File'); ARMOD+=('namespace::autoclean');
|
||||
ARMOD+=('Data::IEEE754'); ARMOD+=('Data::Printer'); ARMOD+=('Data::Validate::IP');
|
||||
ARMOD+=('List::AllUtils'); ARMOD+=('List::SomeUtils'); ARMOD+=('Net::DNS::Nameserver');
|
||||
ARMOD+=('List::UtilsBy'); ARMOD+=('MaxMind::DB::Metadata'); ARMOD+=('MaxMind::DB::Reader');
|
||||
ARMOD+=('Module::Runtime'); ARMOD+=('Moo'); ARMOD+=('MooX::StrictConstructor');
|
||||
ARMOD+=('Role::Tiny'); ARMOD+=('strictures'); ARMOD+=('DBD::mysql');
|
||||
ARMOD+=('Sub::Quote'); ARMOD+=('Math::Int128'); ARMOD+=('Net::Works::Network');
|
||||
ARMOD+=('MaxMind::DB::Reader::XS'); ARMOD+=('Geo::IP'); ARMOD+=('GeoIP2::Database::Reader');
|
||||
ARMOD+=('HTTP::Date'); ARMOD+=('LWP::Protocol::https'); ARMOD+=('Net::LDAP');
|
||||
ARMOD+=('Net::LibIDN'); ARMOD+=('Net::LibIDN2'); ARMOD+=('Test::Perl::Critic');
|
||||
ARMOD+=('Devel::Cycle'); ARMOD+=('Perl::Critic::Policy'); ARMOD+=('Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict');
|
||||
ARMOD+=('TimeDate'); ARMOD+=('YAML'); ARMOD+=('Perl::Critic::Policy::Perlsecret');
|
||||
ARMOD+=('Path::Class'); ARMOD+=('Test::Fatal'); ARMOD+=('Test::Number::Delta');
|
||||
ARMOD+=('Data::Dumper::Concise'); ARMOD+=('DateTime'); ARMOD+=('Test::Warnings');
|
||||
ARMOD+=('autodie'); ARMOD+=('Test::Requires'); ARMOD+=('Test::Tester');
|
||||
ARMOD+=('Clone::PP'); ARMOD+=('File::HomeDir'); ARMOD+=('Sort::Naturally');
|
||||
ARMOD+=('JSON::MaybeXS'); ARMOD+=('Test::LeakTrace'); ARMOD+=('Throwable');
|
||||
ARMOD+=('Alien::Build'); ARMOD+=('Alien::Libxml2'); ARMOD+=('Alien::Build::Plugin::Download::GitLab');
|
||||
ARMOD+=('BSD::Resource'); ARMOD+=('DBIx::Simple'); ARMOD+=('Email::Abstract');
|
||||
ARMOD+=('Email::Address::XS'); ARMOD+=('Email::Date::Format'); ARMOD+=('Email::MessageID');
|
||||
ARMOD+=('Email::MIME'); ARMOD+=('Email::MIME::ContentType'); ARMOD+=('Email::MIME::Encodings');
|
||||
ARMOD+=('Email::Sender'); ARMOD+=('Email::Simple'); ARMOD+=('FFI::CheckLib');
|
||||
ARMOD+=('File::chdir'); ARMOD+=('IO::Socket::INET6'); ARMOD+=('Mail::DMARC');
|
||||
ARMOD+=('MIME::Types'); ARMOD+=('MooX::Types::MooseLike'); ARMOD+=('Net::IDN::Encode');
|
||||
ARMOD+=('Net::IMAP::Simple'); ARMOD+=('Net::Patricia'); ARMOD+=('Net::SMTPS');
|
||||
ARMOD+=('Regexp::Common'); ARMOD+=('Test::Exception'); ARMOD+=('Test::Output');
|
||||
ARMOD+=('Test::Regexp'); ARMOD+=('XML::LibXML'); ARMOD+=('XML::NamespaceSupport');
|
||||
ARMOD+=('XML::SAX'); ARMOD+=('XML::SAX::Base'); ARMOD+=('MailTools');
|
||||
ARMOD+=('Business::ISBN'); ARMOD+=('Config::YAML'); ARMOD+=('Test::Pod::Coverage');
|
||||
ARMOD+=('Business::ISBN::Data'); ARMOD+=('HTML::TokeParser::Simple'); ARMOD+=('Test::Deep');
|
||||
ARMOD+=('Algorithm::Diff'); ARMOD+=('B::Keywords'); ARMOD+=('Capture::Tiny');
|
||||
ARMOD+=('Config::Tiny'); ARMOD+=('Devel::Hide'); ARMOD+=('File::Copy::Recursive');
|
||||
ARMOD+=('Hook::LexWrap'); ARMOD+=('Importer'); ARMOD+=('Lingua::EN::Inflect');
|
||||
ARMOD+=('MIME::Charset'); ARMOD+=('Module::Pluggable'); ARMOD+=('Mozilla::CA');
|
||||
ARMOD+=('PPI'); ARMOD+=('PPIx::QuoteLike'); ARMOD+=('PPIx::Regexp');
|
||||
ARMOD+=('PPIx::Utilities'); ARMOD+=('Perl::Critic'); ARMOD+=('Perl::Tidy');
|
||||
ARMOD+=('Pod::Spell'); ARMOD+=('Readonly::XS'); ARMOD+=('Scope::Guard');
|
||||
ARMOD+=('String::Format'); ARMOD+=('Sub::Info'); ARMOD+=('Sub::Uplevel');
|
||||
ARMOD+=('Task::Weaken'); ARMOD+=('Term::Size::Any'); ARMOD+=('Term::Size::Perl');
|
||||
ARMOD+=('Term::Table'); ARMOD+=('Test::File'); ARMOD+=('Test::File::ShareDir');
|
||||
ARMOD+=('Test::NoWarnings'); ARMOD+=('Test::Object'); ARMOD+=('Test::SubCalls');
|
||||
ARMOD+=('Test2::Suite'); ARMOD+=('Text::Diff'); ARMOD+=('Text::Unidecode');
|
||||
ARMOD+=('Unicode::LineBreak'); ARMOD+=('Getopt::Long::Descriptive'); ARMOD+=('Net::CIDR::Set');
|
||||
ARMOD+=('Authen::SASL'); ARMOD+=('B::COW'); ARMOD+=('Class::Tiny');
|
||||
ARMOD+=('Clone'); ARMOD+=('Encode'); ARMOD+=('Encode::Locale');
|
||||
ARMOD+=('ExtUtils::Config'); ARMOD+=('ExtUtils::Helpers'); ARMOD+=('ExtUtils::InstallPaths');
|
||||
ARMOD+=('File::Listing'); ARMOD+=('File::Slurper'); ARMOD+=('HTTP::Cookies');
|
||||
ARMOD+=('HTTP::Daemon'); ARMOD+=('HTTP::Message'); ARMOD+=('HTTP::Negotiate');
|
||||
ARMOD+=('IO::Compress::Brotli'); ARMOD+=('IO::HTML'); ARMOD+=('IO::Socket::SSL');
|
||||
ARMOD+=('LWP::MediaTypes'); ARMOD+=('Module::Build::Tiny'); ARMOD+=('Net::HTTP');
|
||||
ARMOD+=('Net::SSLeay'); ARMOD+=('PerlIO::utf8_strict'); ARMOD+=('Readonly');
|
||||
ARMOD+=('Socket6'); ARMOD+=('Test::FailWarnings'); ARMOD+=('Test::Needs');
|
||||
ARMOD+=('Test::RequiresInternet'); ARMOD+=('Time::Local');
|
||||
|
||||
# additional spamassassin plugins
|
||||
ARMOD+=('Mail::SpamAssassin::Plugin::Rule2XSBody');
|
||||
ARMOD+=('Mail::SpamAssassin::Plugin::DCC');
|
||||
ARMOD+=('Mail::SpamAssassin::Plugin::Pyzor');
|
||||
ARMOD+=('Mail::SpamAssassin');
|
||||
ARMOD+=('Mail::ClamAV');
|
||||
# spamassassin and plugins
|
||||
SAMOD=();
|
||||
SAMOD+=('Mail::SpamAssassin');
|
||||
SAMOD+=('Mail::SpamAssassin::Plugin::Rule2XSBody');
|
||||
SAMOD+=('Mail::SpamAssassin::Plugin::DCC');
|
||||
SAMOD+=('Mail::SpamAssassin::Plugin::Pyzor');
|
||||
|
||||
# 32 or 64 bit
|
||||
MACHINE_TYPE=`uname -m`
|
||||
|
@ -139,18 +200,12 @@ if [ $CPANOPTION == 1 ]; then
|
|||
echo "CPAN config missing. Creating one ..."; echo;
|
||||
mkdir -p /root/.cpan/CPAN
|
||||
cd /root/.cpan/CPAN
|
||||
"$CURL" -O https://s3.amazonaws.com/msv5/CPAN/MyConfig.pm
|
||||
$CURL -LO https://mirrors.efa-project.org/msv5/CPAN/NIX/root/MyConfig.pm
|
||||
cd "$THISCURRPMDIR"
|
||||
timewait 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# fix the stupid line in /etc/freshclam.conf that disables freshclam
|
||||
COUT='#Example';
|
||||
if [ -f '/etc/freshclam.conf' ]; then
|
||||
perl -pi -e 's/Example/'$COUT'/;' /etc/freshclam.conf
|
||||
fi
|
||||
|
||||
# once messed with freshclam here but this script doesn't install it so removed
|
||||
|
||||
# now check for missing perl modules and install them via cpan
|
||||
# if the user elected to do so
|
||||
|
@ -177,6 +232,51 @@ done
|
|||
# make sure in starting directory
|
||||
cd "$THISCURRPMDIR"
|
||||
|
||||
# Set up for sudo build (SA 4.0+)
|
||||
# Since the NIX flavor is unknown, user has to create sabuild and generate
|
||||
# cpan config to use sudo
|
||||
if [ $CPANOPTION -eq 1 ]; then
|
||||
groupadd sabuild
|
||||
useradd -m -s /sbin/nologin -g sabuild sabuild &>/dev/null
|
||||
id -u sabuild &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ ! -f '/home/sabuild/.cpan/CPAN/MyConfig.pm' ]; then
|
||||
echo;
|
||||
echo "CPAN config missing. Creating one ..."; echo;
|
||||
mkdir -p /home/sabuild/.cpan/CPAN
|
||||
cd /home/sabuild/.cpan/CPAN
|
||||
$CURL -LO https://mirrors.efa-project.org/msv5/CPAN/NIX/sabuild/MyConfig.pm
|
||||
chown -R sabuild:sabuild /home/sabuild/.cpan
|
||||
cd "$THISCURRPMDIR"
|
||||
fi
|
||||
|
||||
echo "sabuild ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sabuild
|
||||
|
||||
for i in "${SAMOD[@]}"
|
||||
do
|
||||
perldoc -l $i >/dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
clear
|
||||
echo "$i is missing or needs updated. Installing via CPAN ..."; echo;
|
||||
timewait 1
|
||||
su - sabuild -s /bin/bash -c "echo \"\\\n\" | perl -MCPAN -e \"CPAN::Shell->force(qw(install $i ));\""
|
||||
else
|
||||
echo "$i => OK";
|
||||
fi
|
||||
done
|
||||
|
||||
# Cleanup, just revoke sudo privs
|
||||
rm -f /etc/sudoers.d/sabuild
|
||||
else
|
||||
echo "Unable to detect sabuild user, cannot install spamassassin"
|
||||
echo;
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure in starting directory
|
||||
cd "$THISCURRPMDIR"
|
||||
|
||||
clear
|
||||
echo;
|
||||
echo "Installing the MailScanner files ... ";
|
||||
|
|
Loading…
Reference in a new issue