1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
imapsync/INSTALL.d/prerequisites_imapsync

191 lines
3.2 KiB
Plaintext
Raw Normal View History

2015-05-28 19:04:57 +02:00
#!/bin/sh
2017-09-23 23:54:48 +02:00
# $Id: prerequisites_imapsync,v 1.21 2017/08/31 02:12:36 gilles Exp gilles $
2015-05-28 19:04:57 +02:00
MODULES_MANDATORY='
Authen::NTLM
2017-09-23 23:54:48 +02:00
Class::Load
2015-05-28 19:04:57 +02:00
Compress::Zlib
2017-09-23 23:54:48 +02:00
Crypt::OpenSSL::RSA
2015-05-28 19:04:57 +02:00
Data::Dumper
Data::Uniqid
Digest::HMAC
2017-09-23 23:54:48 +02:00
Digest::HMAC_MD5
2015-05-28 19:04:57 +02:00
Digest::MD5
2017-09-23 23:54:48 +02:00
Dist::CheckConflicts
Encode::Byte
2015-05-28 19:04:57 +02:00
File::Copy::Recursive
IO::Socket::INET
IO::Socket::INET6
IO::Socket::SSL
IO::Tee
2017-09-23 23:54:48 +02:00
JSON
2016-09-19 17:17:24 +02:00
JSON::WebToken
2017-09-23 23:54:48 +02:00
JSON::WebToken::Crypt::RSA
HTML::Entities
LWP::UserAgent
2015-05-28 19:04:57 +02:00
Mail::IMAPClient
2017-09-23 23:54:48 +02:00
Module::Implementation
Module::Runtime
Module::ScanDeps
Net::Ping
Net::SSLeay
Package::Stash
Package::Stash::XS
PAR::Packer
2015-05-28 19:04:57 +02:00
Parse::RecDescent
2017-09-23 23:54:48 +02:00
Pod::Usage
2016-09-19 17:17:24 +02:00
Readonly
2017-09-23 23:54:48 +02:00
Sys::MemInfo
2015-05-28 19:04:57 +02:00
Term::ReadKey
2017-09-23 23:54:48 +02:00
Test::Fatal
Test::Mock::Guard
2016-09-19 17:17:24 +02:00
Test::MockObject
2015-05-28 19:04:57 +02:00
Test::More
Test::Pod
2017-09-23 23:54:48 +02:00
Test::Requires
Try::Tiny
2015-05-28 19:04:57 +02:00
Unicode::String
URI::Escape
'
test_perl() {
# First we need perl
if perl -v > /dev/null 2>&1 ; then
perl_version=`perl -e 'printf "%vd\n", $^V;'`
echo Ok: Found Perl $perl_version
return 0
else
echo Failure: Perl is not here. You have to install Perl first.
return 1
fi
}
2017-09-23 23:54:48 +02:00
test_make() {
# Second we need make to build some Perl modules
if make -v > /dev/null 2>&1 ; then
make_version=`make -v |head -1`
echo Ok: Found make $make_version
return 0
else
echo Failure: make is not here. You have to install the make command.
return 1
fi
}
2015-05-28 19:04:57 +02:00
test_module() {
test -n $1 || return
M_tested=$1
shift
if perl -m"$M_tested" -e '' >/dev/null 2>&1 ; then
echo "Ok: Found Perl module $M_tested"
else
echo "Failure: Not found Perl module $M_tested $@"
LIST_TO_INSTALL="$LIST_TO_INSTALL $M_tested"
fi
2016-09-19 17:17:24 +02:00
return
2015-05-28 19:04:57 +02:00
}
test_mandatory_modules() {
for M in $MODULES_MANDATORY
do
test_module $M
done
}
search_modules_any() {
test -n "$*" || {
echo "All needed modules are already installed"
return
}
2015-08-04 03:44:40 +02:00
apt-file -h > /dev/null 2>&1 && {
2015-05-28 19:04:57 +02:00
search_modules_apt "$@"
return
}
yum -h > /dev/null 2>&1 && {
search_modules_yum "$@"
return
}
# no yum, no apt-get
{
2016-09-19 17:17:24 +02:00
search_modules_cpanm "$@"
2015-05-28 19:04:57 +02:00
return
}
}
2016-09-19 17:17:24 +02:00
search_modules_cpanm() {
2015-05-28 19:04:57 +02:00
cat <<EOD
2016-09-19 17:17:24 +02:00
Here is a cpanm command to install missing Perl modules:
cpanm "$@"
2015-05-28 19:04:57 +02:00
EOD
}
search_modules_yum() {
echo
echo Searching rpm packages names
for M in "$@" ; do
echo "==== Searching rpm package name for $M"
F=`echo $M|tr -s ":" "/"`.pm
2017-09-23 23:54:48 +02:00
echo yum -q whatprovides "*/$F"
2015-05-28 19:04:57 +02:00
echo
yum -q whatprovides "*/$F"
echo
done
}
search_modules_apt() {
echo
echo Searching deb packages names
for M in "$@" ; do
echo "==== Searching deb package name for $M"
F=`echo $M|tr -s ":" "/"`.pm
#echo apt-file search /$F
echo
apt-file search /$F
2015-08-04 03:44:40 +02:00
#apt-cache search "$M"
2015-05-28 19:04:57 +02:00
echo
done
}
list_to_install() {
2016-09-19 17:17:24 +02:00
test -n "$LIST_TO_INSTALL" || return 0
2015-05-28 19:04:57 +02:00
echo
echo 'What you have to do before using imapsync:'
for M in $LIST_TO_INSTALL ; do
echo "Install Perl module $M"
done
2016-09-19 17:17:24 +02:00
# return false/bad if some modules are missing.
return 1
2015-05-28 19:04:57 +02:00
}
test_unix() {
echo '$SHELL says ' $SHELL
echo '$0 gives ' $0
echo -n "ps -ef gives " ; ps -ef | grep $$ | grep -v grep| grep -v 'ps -ef'
sw_vers > /dev/null 2>&1 && sw_vers # Darwin
lsb_release -dirc > /dev/null 2>&1 && lsb_release -dirc # Linux
uname -a
}
test_unix
#exit
test_perl || exit
2017-09-23 23:54:48 +02:00
test_make || exit
2015-05-28 19:04:57 +02:00
test_mandatory_modules
list_to_install
2016-09-19 17:17:24 +02:00
EXIT=$?
# Help the user to install missing modules
2015-05-28 19:04:57 +02:00
search_modules_any $LIST_TO_INSTALL
2016-09-19 17:17:24 +02:00
exit $EXIT