Add script 'install_perl_modules_mailserver.sh'.
This commit is contained in:
parent
03b820b8b8
commit
c648e9e849
75
install_perl_modules_mailserver.sh
Executable file
75
install_perl_modules_mailserver.sh
Executable file
@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
_src_base_dir="$(realpath $(dirname $0))"
|
||||
|
||||
log_file="$(mktemp)"
|
||||
|
||||
|
||||
# -------------
|
||||
# - Functions
|
||||
# -------------
|
||||
|
||||
clean_up() {
|
||||
|
||||
# Perform program exit housekeeping
|
||||
rm -f "$log_file"
|
||||
exit $1
|
||||
}
|
||||
|
||||
echononl(){
|
||||
echo X\\c > /tmp/shprompt$$
|
||||
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
|
||||
echo "$*\\c" 1>&2
|
||||
else
|
||||
echo -e -n "$*" 1>&2
|
||||
fi
|
||||
rm /tmp/shprompt$$
|
||||
}
|
||||
|
||||
error(){
|
||||
echo ""
|
||||
echo -e "\t[ \033[31m\033[1mFehler\033[m ]: $*"
|
||||
echo ""
|
||||
}
|
||||
|
||||
echo_ok() {
|
||||
echo -e "\033[75G[ \033[32mok\033[m ]"
|
||||
## echo -e " [ ok ]"
|
||||
}
|
||||
echo_failed(){
|
||||
echo -e "\033[75G[ \033[1;31mfailed\033[m ]"
|
||||
## echo -e " [ failed ]"
|
||||
}
|
||||
|
||||
|
||||
echo ""
|
||||
echononl "\tInstall database related CPAN Modules"
|
||||
_failed=false
|
||||
> $log_file
|
||||
_needed_cpan_modules="
|
||||
CPAN
|
||||
Mail::Sender
|
||||
DBI
|
||||
DBD::mysql
|
||||
DBD::Pg
|
||||
IO::Socket::UNIX
|
||||
Digest::SHA1
|
||||
Digest::SHA2
|
||||
Digest::SHA256
|
||||
Encode::Detect
|
||||
Net::Patricia"
|
||||
for _module in $_needed_cpan_modules ; do
|
||||
cpanm -q --skip-installed $_module >> "$log_file" 2>&1
|
||||
if [[ "$?" -ne 0 ]] ; then
|
||||
_failed=true
|
||||
fi
|
||||
done
|
||||
if $_failed ; then
|
||||
echo_failed
|
||||
error "$(cat $log_file)"
|
||||
else
|
||||
echo_ok
|
||||
fi
|
||||
|
||||
echo ""
|
||||
clean_up 0
|
Loading…
Reference in New Issue
Block a user