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,121 +1826,6 @@ fi
echo ""
if ! $UPDATE_SYMPA ; then
echononl "\tAdding Group \"$SYMPA_GROUP\".."
if ! grep $SYMPA_GROUP /etc/group > /dev/null ; then
echo "" >> $_log_file
echo "## - Adding Group \"$SYMPA_GROUP\".." >> $_log_file
echo "## -" >> $_log_file
echo "addgroup --gid $SYMPA_GID $SYMPA_GROUP" >> $_log_file
addgroup --gid $SYMPA_GID $SYMPA_GROUP >> $_log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Adding group '$SYMPA_GROUP' failed! \n
See '$_log_file' for further informations."
fi
else
echo_skipped
fi
echononl "\tAdding User \"$SYMPA_USER\".."
if ! grep $SYMPA_USER /etc/passwd > /dev/null ; then
echo "" >> $_log_file
echo "## - Adding User \"$SYMPA_USER\".." >> $_log_file
echo "## -" >> $_log_file
echo "adduser --uid $SYMPA_UID --gid $SYMPA_GID --home $SYMPA_BASE_PATH --disabled-password \\" >> $_log_file
echo " --gecos \"Sympa mailing list manager\" $SYMPA_USER" >> $_log_file
adduser --uid $SYMPA_UID --gid $SYMPA_GID --home $SYMPA_BASE_PATH --disabled-password \
--gecos "Sympa mailing list manager" $SYMPA_USER >> $_log_file
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Adding user '$SYMPA_USER' failed! \n
See '$_log_file' for further informations."
fi
else
echo_skipped
fi
echo ""
## - Sympa alias file
## -
if [ -n "$SYMPA_ALIAS_FILE" ]; then
_dir=`dirname $SYMPA_ALIAS_FILE`
_create_dir=true
echononl "\tCreate directory \"$_dir\".."
echo "" >> $_log_file
echo "## - Create directory \"$_dir\" (contains sympa alias file).." >> $_log_file
echo "## -" >> $_log_file
if [ ! -d "$_dir" ]; then
echo "mkdir -p $_dir" $_log_file
mkdir -p $_dir >> $_log_file
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Creation of dir \"$_dir\" failed! \n
See '$_log_file' for further informations."
_create_dir=false
fi
else
echo_skipped
echo "## - \"$_dir\" alredy exists" >> $_log_file
echo "## -" >> $_log_file
fi
echononl "\tCreate alias file \"$SYMPA_ALIAS_FILE\".."
echo "" >> $_log_file
echo "## - Create alias file \"$SYMPA_ALIAS_FILE\".." >> $_log_file
echo "## -" >> $_log_file
if [ ! -f "$SYMPA_ALIAS_FILE" ]; then
echo "touch $SYMPA_ALIAS_FILE" >> $_log_file
touch $SYMPA_ALIAS_FILE >> $_log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Creation of alias file \"$SYMPA_ALIAS_FILE\" failed! \n
See '$_log_file' for further informations."
fi
else
echo_skipped
echo "## - Alias file \"$SYMPA_ALIAS_FILE\" alredy exists" >> $_log_file
echo "## -" >> $_log_file
fi
fi
echononl "\tChange group for \"$SYMPA_ALIAS_FILE\".."
echo "" >> $_log_file
echo "## - Change group for \"$SYMPA_ALIAS_FILE\".." >> $_log_file
echo "## -" >> $_log_file
echo "chgrp $SYMPA_GROUP $SYMPA_ALIAS_FILE" >> $_log_file
chgrp $SYMPA_GROUP $SYMPA_ALIAS_FILE >> $_log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Cannot set ownerchip ($SYMPA_USER:$SYMPA_GROUP) to \"$SYMPA_ALIAS_FILE\"! \n
See '$_log_file' for further informations."
fi
echononl "\tSet permissions on \"$SYMPA_ALIAS_FILE\".."
echo "" >> $_log_file
echo "## - Set permissions on \"$SYMPA_ALIAS_FILE\".." >> $_log_file
echo "## -" >> $_log_file
echo "chmod 664 $SYMPA_ALIAS_FILE" >> $_log_file
chmod 664 $SYMPA_ALIAS_FILE >> $_log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Cannot set ownerchip ($SYMPA_USER:$SYMPA_GROUP) to \"$SYMPA_ALIAS_FILE\"! \n
See '$_log_file' for further informations."
fi
## - Install reqired debian packages
## -
@@ -2086,6 +2004,123 @@ EOF
## -
export PERL5LIB=/usr/share/mhonarc
echo ""
if ! $UPDATE_SYMPA ; then
echononl "\tAdding Group \"$SYMPA_GROUP\".."
if ! grep $SYMPA_GROUP /etc/group > /dev/null ; then
echo "" >> $_log_file
echo "## - Adding Group \"$SYMPA_GROUP\".." >> $_log_file
echo "## -" >> $_log_file
echo "addgroup --gid $SYMPA_GID $SYMPA_GROUP" >> $_log_file
addgroup --gid $SYMPA_GID $SYMPA_GROUP >> $_log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Adding group '$SYMPA_GROUP' failed! \n
See '$_log_file' for further informations."
fi
else
echo_skipped
fi
echononl "\tAdding User \"$SYMPA_USER\".."
if ! grep $SYMPA_USER /etc/passwd > /dev/null ; then
echo "" >> $_log_file
echo "## - Adding User \"$SYMPA_USER\".." >> $_log_file
echo "## -" >> $_log_file
echo "adduser --uid $SYMPA_UID --gid $SYMPA_GID --home $SYMPA_BASE_PATH --disabled-password \\" >> $_log_file
echo " --gecos \"Sympa mailing list manager\" $SYMPA_USER" >> $_log_file
adduser --uid $SYMPA_UID --gid $SYMPA_GID --home $SYMPA_BASE_PATH --disabled-password \
--gecos "Sympa mailing list manager" $SYMPA_USER >> $_log_file
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Adding user '$SYMPA_USER' failed! \n
See '$_log_file' for further informations."
fi
else
echo_skipped
fi
echo ""
## - Sympa alias file
## -
if [ -n "$SYMPA_ALIAS_FILE" ]; then
_dir=`dirname $SYMPA_ALIAS_FILE`
_create_dir=true
echononl "\tCreate directory \"$_dir\".."
echo "" >> $_log_file
echo "## - Create directory \"$_dir\" (contains sympa alias file).." >> $_log_file
echo "## -" >> $_log_file
if [ ! -d "$_dir" ]; then
echo "mkdir -p $_dir" $_log_file
mkdir -p $_dir >> $_log_file
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Creation of dir \"$_dir\" failed! \n
See '$_log_file' for further informations."
_create_dir=false
fi
else
echo_skipped
echo "## - \"$_dir\" alredy exists" >> $_log_file
echo "## -" >> $_log_file
fi
echononl "\tCreate alias file \"$SYMPA_ALIAS_FILE\".."
echo "" >> $_log_file
echo "## - Create alias file \"$SYMPA_ALIAS_FILE\".." >> $_log_file
echo "## -" >> $_log_file
if [ ! -f "$SYMPA_ALIAS_FILE" ]; then
echo "touch $SYMPA_ALIAS_FILE" >> $_log_file
touch $SYMPA_ALIAS_FILE >> $_log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Creation of alias file \"$SYMPA_ALIAS_FILE\" failed! \n
See '$_log_file' for further informations."
fi
else
echo_skipped
echo "## - Alias file \"$SYMPA_ALIAS_FILE\" alredy exists" >> $_log_file
echo "## -" >> $_log_file
fi
fi
echononl "\tChange group for \"$SYMPA_ALIAS_FILE\".."
echo "" >> $_log_file
echo "## - Change group for \"$SYMPA_ALIAS_FILE\".." >> $_log_file
echo "## -" >> $_log_file
echo "chgrp $SYMPA_GROUP $SYMPA_ALIAS_FILE" >> $_log_file
chgrp $SYMPA_GROUP $SYMPA_ALIAS_FILE >> $_log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Cannot set ownerchip ($SYMPA_USER:$SYMPA_GROUP) to \"$SYMPA_ALIAS_FILE\"! \n
See '$_log_file' for further informations."
fi
echononl "\tSet permissions on \"$SYMPA_ALIAS_FILE\".."
echo "" >> $_log_file
echo "## - Set permissions on \"$SYMPA_ALIAS_FILE\".." >> $_log_file
echo "## -" >> $_log_file
echo "chmod 664 $SYMPA_ALIAS_FILE" >> $_log_file
chmod 664 $SYMPA_ALIAS_FILE >> $_log_file 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error "Cannot set ownerchip ($SYMPA_USER:$SYMPA_GROUP) to \"$SYMPA_ALIAS_FILE\"! \n
See '$_log_file' for further informations."
fi
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