Make install script ready for debian trixie.

This commit is contained in:
2026-01-04 01:32:58 +01:00
parent 4f40e69cbe
commit 3d8e007396

View File

@@ -12,125 +12,6 @@ backup_date="$(date +%Y-%m-%d-%H%M)"
err_log="$(mktemp)"
_required_debian_packages="
libauthcas-perl
libclass-singleton-perl
libdatetime-timezone-perl
libdatetime-format-mail-perl
libdbd-csv-perl
libdbd-odbc-perl
libdbd-mysql-perl
libdbd-odbc-perl
libdbd-sybase-perl
libdbd-pg-perl
libdbd-sqlite3-perl
libfile-nfslock-perl
libutf8-all-perl
libmime-base64-perl
libmime-charset-perl
libcrypt-openssl-x509-perl
libcrypt-smime-perl
libdata-password-perl
libproc-processtable-perl
libdbi-perl
libdbi-test-perl
libarchive-zip-perl
libmailtools-perl
libmsgcat-perl
libmime-tools-perl
libio-stringy-perl
libnet-ldap-perl
libcgi-fast-perl
libintl-perl
libmime-charset-perl
libmime-encwords-perl
libtemplate-perl
libxml-libxml-perl
perl-modules
libcgi-pm-perl
libhtml-stripscripts-parser-perl
libhtml-tree-perl
libhtml-format-perl
mhonarc
libregexp-common-perl
ca-certificates
lsb-base
libdbd-mysql-perl
libfcgi-perl
libfile-copy-recursive-perl
libnet-netmask-perl
libterm-progressbar-perl
libmime-lite-html-perl
libunicode-linebreak-perl
libio-socket-ssl-perl
libsoap-lite-perl
libmail-sendmail-perl
libmail-dkim-perl
cpanminus
spawn-fcgi
"
_needed_cpan_modules="
CPAN
Archive::Zip
CGI
Class::Singleton
DBD::mysql
DBI
DateTime::Format::Mail
DateTime::TimeZone
Digest::MD5
Encode
File::Copy::Recursive
File::NFSLock
File::Path
HTML::FormatText
HTML::StripScripts::Parser
HTML::TreeBuilder
IO::File
IO::Scalar
LWP::UserAgent
List::Util::XS
Locale::Messages
MHonArc::UTF8
MIME::Base64
MIME::Charset
MIME::EncWords
MIME::Lite::HTML
MIME::Tools
Mail::Address
Net::CIDR
Net::DNS
Sys::Syslog
Template
Term::ProgressBar
Text::LineFold
Time::HiRes
URI::Escape
XML::LibXML
AuthCAS
CGI::Fast
Clone
Crypt::CipherSaber
Crypt::OpenSSL::X509
Crypt::SMIME
DBD::CSV
DBD::ODBC
DBD::Pg
DBD::SQLite
DBD::Sybase
Data::Password
Encode::Locale
FCGI
IO::Socket::SSL
Mail::DKIM::Verifier
Net::DNS
Net::LDAP
Net::SMTP
SOAP::Lite
"
## --- some functions
## ---
@@ -196,11 +77,163 @@ echo_skipped() {
echo_wait(){
echo -en "\033[75G[ \033[5m\033[1mwait\033[m ]"
}
detect_os_1 () {
if $(which lsb_release > /dev/null 2>&1) ; then
os_dist="$(lsb_release -i | awk '{print tolower($3)}')"
os_version="$(lsb_release -r | awk '{print tolower($2)}')"
os_codename="$(lsb_release -c | awk '{print tolower($2)}')"
if [[ "$os_dist" = "debian" ]]; then
if $(echo "$os_version" | grep -q '\.') ; then
os_version=$(echo "$os_version" | cut --delimiter='.' -f1)
fi
fi
elif [[ -e "/etc/os-release" ]]; then
. /etc/os-release
os_dist=$ID
os_version=${VERSION_ID}
fi
# remove whitespace from os_dist and os_version
os_dist="${os_dist// /}"
os_version="${os_version// /}"
}
## ---
## --- END: functions
trap clean_up SIGHUP SIGINT SIGTERM
_required_debian_packages="
build-essential
ca-certificates
cpanminus
libarchive-zip-perl
libauthcas-perl
libcgi-fast-perl
libcgi-pm-perl
libclass-singleton-perl
libcrypt-openssl-x509-perl
libcrypt-smime-perl
libdata-password-perl
libdatetime-format-mail-perl
libdatetime-timezone-perl
libdbd-csv-perl
libdbd-mysql-perl
libdbd-pg-perl
libdbd-sqlite3-perl
libdbd-sybase-perl
libdbi-perl
libdbi-test-perl
libfcgi-perl
libfile-copy-recursive-perl
libfile-nfslock-perl
libhtml-format-perl
libhtml-stripscripts-parser-perl
libhtml-tree-perl
libintl-perl
libio-socket-ssl-perl
libio-stringy-perl
libmail-dkim-perl
libmail-sendmail-perl
libmailtools-perl
libmime-base64-perl
libmime-charset-perl
libmime-encwords-perl
libmime-lite-html-perl
libmime-tools-perl
libmsgcat-perl
libnet-ldap-perl
libnet-netmask-perl
libproc-processtable-perl
libregexp-common-perl
libsoap-lite-perl
libtemplate-perl
libterm-progressbar-perl
libunicode-linebreak-perl
libutf8-all-perl
libxml-libxml-perl
lsb-base
mhonarc
perl-modules
spawn-fcgi
unixodbc
unixodbc-dev
"
if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 13 ]] ; then
_required_debian_packages="${_required_debian_packages}
libdbd-odbc-perl"
fi
_needed_cpan_modules="
CPAN
Archive::Zip
CGI
Class::Singleton
DBD::mysql
DBI
DateTime::Format::Mail
DateTime::TimeZone
Digest::MD5
Encode
File::Copy::Recursive
File::NFSLock
File::Path
HTML::FormatText
HTML::StripScripts::Parser
HTML::TreeBuilder
IO::File
IO::Scalar
LWP::UserAgent
List::Util::XS
Locale::Messages
MHonArc::UTF8
MIME::Base64
MIME::Charset
MIME::EncWords
MIME::Lite::HTML
MIME::Tools
Mail::Address
Net::CIDR
Net::DNS
Sys::Syslog
Template
Term::ProgressBar
Text::LineFold
Time::HiRes
URI::Escape
XML::LibXML
AuthCAS
CGI::Fast
Clone
Crypt::CipherSaber
Crypt::OpenSSL::X509
Crypt::SMIME
DBD::CSV
DBD::ODBC
DBD::Pg
DBD::SQLite
DBD::Sybase
Data::Password
Encode::Locale
FCGI
IO::Socket::SSL
Mail::DKIM::Verifier
Net::DNS
Net::LDAP
Net::SMTP
SOAP::Lite
"
# - Support systemd ?
# -
_systemd="$(which systemd)"
@@ -1793,6 +1826,186 @@ fi
echo ""
## - Install reqired debian packages
## -
declare -a required_debian_packages_arr
for _debian_pkg in $_required_debian_packages ; do
required_debian_packages_arr+=("$_debian_pkg")
done
> ${_logdir}/debian-install.log
echo ""
echo -e "\tInstalling required debian packages .."
for _debian_pkg in ${required_debian_packages_arr[@]} ; do
echononl "\t Installing $_debian_pkg .."
if ! dpkg -l $_debian_pkg 2> /dev/null | grep -e "^ii" > /dev/null 2>&1 ; then
echo "" >> $_log_file
echo "## - Installing Debian Package \"$_debian_pkg\" .." >> $_log_file
echo "## -" >> $_log_file
echo "## - See ${_logdir}/debian-install.log for details" >> $_log_file
echo "## -" >> $_log_file
echo "apt-get install -q -y $_debian_pkg >> ${_logdir}/debian-install.log 2>&1" >> $_log_file
echo "" >> ${_logdir}/debian-install.log
echo "## - Install $_debian_pkg" >> ${_logdir}/debian-install.log
apt-get install -q -y $_debian_pkg >> ${_logdir}/debian-install.log 2>&1
if [ "$?" = 0 ]; then
echo_ok
else
echo_failed
fatal "Installing debian package \"$_debian_pkg\" failed! \n
See '${_logdir}/debian-install.log' for further informations."
fi
else
echo_skipped
fi
done
## - Install required/optional perl modules
## -
declare -a cpan_modules_arr
for _module in $_needed_cpan_modules ; do
cpan_modules_arr+=("$_module")
done
> ${_logdir}/cp_modul-install.log
echo ""
echo -e "\tInstalling cpan modules .."
for _cpan_module in ${cpan_modules_arr[@]} ; do
echononl "\t Installing $_cpan_module .."
cpanm -q --skip-installed $_module > "${_logdir}/cp_modul-install.log" 2>&1
if [[ "$?" -ne 0 ]] ; then
echo_failed
error "$(cat "${_logdir}/cp_modul-install.log")"
else
echo_ok
fi
done
info "After Installation finished, check presens of required perl modules"
## - Generate some locales
##
echononl "\tConfigure locales used by the system (/etc/locale.gen)"
echo "" >> $_log_file
echo "## - Configure locales used by the system (/etc/locale.gen) ..." >> $_log_file
echo "## -" >> $_log_file
cat <<EOF >> $_log_file
cat <<END > /etc/locale.gen
bg_BG CP1251
cs_CZ ISO-8859-2
de_DE.UTF-8 UTF-8
de_DE ISO-8859-1
el_GR ISO-8859-7
en_US.UTF-8 UTF-8
en_US ISO-8859-1
es_ES ISO-8859-1
et_EE ISO-8859-1
eu_ES ISO-8859-1
fi_FI ISO-8859-1
fr_FR ISO-8859-1
hu_HU ISO-8859-2
it_IT ISO-8859-1
ja_JP.EUC-JP EUC-JP
nb_NO ISO-8859-1
nl_NL ISO-8859-1
oc_FR ISO-8859-1
pl_PL ISO-8859-2
pt_BR ISO-8859-1
pt_PT ISO-8859-1
ro_RO ISO-8859-2
ru_RU ISO-8859-5
sv_SE ISO-8859-1
tr_TR ISO-8859-9
zh_TW BIG5
zh_CN GB2312
END
EOF
cat <<EOF > /etc/locale.gen
bg_BG CP1251
cs_CZ ISO-8859-2
de_DE.UTF-8 UTF-8
de_DE ISO-8859-1
el_GR ISO-8859-7
en_US.UTF-8 UTF-8
en_US ISO-8859-1
es_ES ISO-8859-1
et_EE ISO-8859-1
eu_ES ISO-8859-1
fi_FI ISO-8859-1
fr_FR ISO-8859-1
hu_HU ISO-8859-2
it_IT ISO-8859-1
ja_JP.EUC-JP EUC-JP
nb_NO ISO-8859-1
nl_NL ISO-8859-1
oc_FR ISO-8859-1
pl_PL ISO-8859-2
pt_BR ISO-8859-1
pt_PT ISO-8859-1
ro_RO ISO-8859-2
ru_RU ISO-8859-5
sv_SE ISO-8859-1
tr_TR ISO-8859-9
zh_TW BIG5
zh_CN GB2312
EOF
if [ "$?" = 0 ]; then
echo_ok
else
echo_failed
error "Setting locales definition in file \"/etc/locale.gen\" failed!"
fi
echononl "\tGenerating locales from /etc/locale.gen"
echo "" >> $_log_file
echo "## - Generating locales from /etc/locale.gen .." >> $_log_file
echo "## -" >> $_log_file
echo "locale-gen" >> $_log_file
locale-gen >> $_log_file 2>&1
if [ "$?" = 0 ]; then
echo_ok
else
echo_failed
error "Generating locales from \"/etc/locale.gen\" failed! \n
See '${_logdir}/debian-install.log' for further informations."
fi
echononl "\tAdd Environment Variable \"PERL5LIB\" to /etc/profile .."
if ! grep PERL5LIB /etc/profile > /dev/null 2>&1 ; then
echo "" >> $_log_file
echo "## - Add Environment Variable \"PERL5LIB\" to /etc/profile .." >> $_log_file
echo "## -" >> $_log_file
echo "echo \"export PERL5LIB=/usr/share/mhonarc\" >> /etc/profile" >> $_log_file
echo "export PERL5LIB=/usr/share/mhonarc" >> /etc/profile 2>> $_log_file
if [ "$?" = 0 ]; then
echo_ok
else
echo_failed
error "Adding Environment Variable \"PERL5LIB\" to /etc/profile failed! \n
See '${_logdir}/debian-install.log' for further informations."
fi
else
echo_skipped
fi
## - Make PERL5LIB also present in that shell
## -
export PERL5LIB=/usr/share/mhonarc
echo ""
if ! $UPDATE_SYMPA ; then
echononl "\tAdding Group \"$SYMPA_GROUP\".."
@@ -1908,184 +2121,6 @@ if ! $UPDATE_SYMPA ; then
See '$_log_file' for further informations."
fi
## - Install reqired debian packages
## -
declare -a required_debian_packages_arr
for _debian_pkg in $_required_debian_packages ; do
required_debian_packages_arr+=("$_debian_pkg")
done
> ${_logdir}/debian-install.log
echo ""
echo -e "\tInstalling required debian packages .."
for _debian_pkg in ${required_debian_packages_arr[@]} ; do
echononl "\t Installing $_debian_pkg .."
if ! dpkg -l $_debian_pkg 2> /dev/null | grep -e "^ii" > /dev/null 2>&1 ; then
echo "" >> $_log_file
echo "## - Installing Debian Package \"$_debian_pkg\" .." >> $_log_file
echo "## -" >> $_log_file
echo "## - See ${_logdir}/debian-install.log for details" >> $_log_file
echo "## -" >> $_log_file
echo "apt-get install -q -y $_debian_pkg >> ${_logdir}/debian-install.log 2>&1" >> $_log_file
echo "" >> ${_logdir}/debian-install.log
echo "## - Install $_debian_pkg" >> ${_logdir}/debian-install.log
apt-get install -q -y $_debian_pkg >> ${_logdir}/debian-install.log 2>&1
if [ "$?" = 0 ]; then
echo_ok
else
echo_failed
fatal "Installing debian package \"$_debian_pkg\" failed! \n
See '${_logdir}/debian-install.log' for further informations."
fi
else
echo_skipped
fi
done
## - Install required/optional perl modules
## -
declare -a cpan_modules_arr
for _module in $_needed_cpan_modules ; do
cpan_modules_arr+=("$_module")
done
> ${_logdir}/cp_modul-install.log
echo ""
echo -e "\tInstalling cpan modules .."
for _cpan_module in ${cpan_modules_arr[@]} ; do
echononl "\t Installing $_cpan_module .."
cpanm -q --skip-installed $_module > "${_logdir}/cp_modul-install.log" 2>&1
if [[ "$?" -ne 0 ]] ; then
echo_failed
error "$(cat "${_logdir}/cp_modul-install.log")"
else
echo_ok
fi
done
info "After Installation finished, check presens of required perl modules"
## - Generate some locales
##
echononl "\tConfigure locales used by the system (/etc/locale.gen)"
echo "" >> $_log_file
echo "## - Configure locales used by the system (/etc/locale.gen) ..." >> $_log_file
echo "## -" >> $_log_file
cat <<EOF >> $_log_file
cat <<END > /etc/locale.gen
bg_BG CP1251
cs_CZ ISO-8859-2
de_DE.UTF-8 UTF-8
de_DE ISO-8859-1
el_GR ISO-8859-7
en_US.UTF-8 UTF-8
en_US ISO-8859-1
es_ES ISO-8859-1
et_EE ISO-8859-1
eu_ES ISO-8859-1
fi_FI ISO-8859-1
fr_FR ISO-8859-1
hu_HU ISO-8859-2
it_IT ISO-8859-1
ja_JP.EUC-JP EUC-JP
nb_NO ISO-8859-1
nl_NL ISO-8859-1
oc_FR ISO-8859-1
pl_PL ISO-8859-2
pt_BR ISO-8859-1
pt_PT ISO-8859-1
ro_RO ISO-8859-2
ru_RU ISO-8859-5
sv_SE ISO-8859-1
tr_TR ISO-8859-9
zh_TW BIG5
zh_CN GB2312
END
EOF
cat <<EOF > /etc/locale.gen
bg_BG CP1251
cs_CZ ISO-8859-2
de_DE.UTF-8 UTF-8
de_DE ISO-8859-1
el_GR ISO-8859-7
en_US.UTF-8 UTF-8
en_US ISO-8859-1
es_ES ISO-8859-1
et_EE ISO-8859-1
eu_ES ISO-8859-1
fi_FI ISO-8859-1
fr_FR ISO-8859-1
hu_HU ISO-8859-2
it_IT ISO-8859-1
ja_JP.EUC-JP EUC-JP
nb_NO ISO-8859-1
nl_NL ISO-8859-1
oc_FR ISO-8859-1
pl_PL ISO-8859-2
pt_BR ISO-8859-1
pt_PT ISO-8859-1
ro_RO ISO-8859-2
ru_RU ISO-8859-5
sv_SE ISO-8859-1
tr_TR ISO-8859-9
zh_TW BIG5
zh_CN GB2312
EOF
if [ "$?" = 0 ]; then
echo_ok
else
echo_failed
error "Setting locales definition in file \"/etc/locale.gen\" failed!"
fi
echononl "\tGenerating locales from /etc/locale.gen"
echo "" >> $_log_file
echo "## - Generating locales from /etc/locale.gen .." >> $_log_file
echo "## -" >> $_log_file
echo "locale-gen" >> $_log_file
locale-gen >> $_log_file 2>&1
if [ "$?" = 0 ]; then
echo_ok
else
echo_failed
error "Generating locales from \"/etc/locale.gen\" failed! \n
See '${_logdir}/debian-install.log' for further informations."
fi
echononl "\tAdd Environment Variable \"PERL5LIB\" to /etc/profile .."
if ! grep PERL5LIB /etc/profile > /dev/null 2>&1 ; then
echo "" >> $_log_file
echo "## - Add Environment Variable \"PERL5LIB\" to /etc/profile .." >> $_log_file
echo "## -" >> $_log_file
echo "echo \"export PERL5LIB=/usr/share/mhonarc\" >> /etc/profile" >> $_log_file
echo "export PERL5LIB=/usr/share/mhonarc" >> /etc/profile 2>> $_log_file
if [ "$?" = 0 ]; then
echo_ok
else
echo_failed
error "Adding Environment Variable \"PERL5LIB\" to /etc/profile failed! \n
See '${_logdir}/debian-install.log' for further informations."
fi
else
echo_skipped
fi
## - Make PERL5LIB also present in that shell
## -
export PERL5LIB=/usr/share/mhonarc
else
@@ -3871,6 +3906,53 @@ if $START_AT_BOOTTIME ; then
See '${_log_file}' for further informations."
fi
fi # if $SYSTEMD_SUPPORTED
if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 12 ]] ; then
echononl "\tGive special approval for postfix to write into path '/usr/local/sympa'.."
echo "" >> $_log_file
echo "## - Give special approval for postfix to write into path '/usr/local/sympa'.." >> $_log_file
echo "## -" >> $_log_file
_failed=false
if [[ ! -f /etc/systemd/system/postfix.service.d/override.conf ]]; then
echo "mkdir \"/etc/systemd/system/postfix.service.d\"" >> $_log_file 2>&1
mkdir "/etc/systemd/system/postfix.service.d" >> $_log_file 2>&1
if [[ $? -gt 0 ]] ; then
_failed=true
fi
fi
echo "cat <<'EOF' > /etc/systemd/system/postfix.service.d
[Service]
ReadWritePaths=/usr/local/sympa
EOF" >> $_log_file
cat <<'EOF' > /etc/systemd/system/postfix.service.d 2>> $_log_file
[Service]
ReadWritePaths=/usr/local/sympa
EOF
if [[ $? -gt 0 ]] ; then
_failed=true
fi
if ${_failed}; then
echo_failed
error "Adding 'ReadWritePaths=/usr/local/sympa' to '/etc/systemd/system/postfix.service.d/override.conf' failed!\n
See '${_log_file}' for further informations."
echononl " continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
fi
fi # if START_AT_BOOTTIME