Commit 432ce64f authored by w4t's avatar w4t

wtserver 0.02

parent a4f9be0b
This diff is collapsed.
......@@ -9,7 +9,7 @@ InstallAditionalRepos() {
echo -n -e "$IDENTATION_LVL_0 ${BWhite} Start Adding additional repositories ${NC} \n"
echo -n -e "$IDENTATION_LVL_1 ${BBlack}Update Packages Before we start ${NC} ... "
package_update
apt_update
echo -e " [ ${green}DONE${NC} ]"
#Check for apt-transport-https
......@@ -17,7 +17,7 @@ InstallAditionalRepos() {
echo -n -e "$IDENTATION_LVL_1 ${BBlack}APT HTTPS Method${NC}: ${green}Already Installed${NC}\n"
else
echo -n -e "$IDENTATION_LVL_1 ${BBlack}APT HTTPS Method${NC}: ${red}NOT FOUND${NC} - try to install it ... "
package_install apt-transport-https
apt_install apt-transport-https
echo -e " [ ${green}DONE${NC} ]"
fi
......@@ -94,7 +94,7 @@ Pin-Priority: 400
echo -e " [ ${green}DONE${NC} ]"
echo -n -e "$IDENTATION_LVL_1 ${BBlack}Update Packages Before at the final${NC} ... "
package_update
apt_update
echo -e " [ ${green}DONE${NC} ]"
MeasureTimeDuration $START_TIME
......
......@@ -9,7 +9,7 @@ InstallAntiVirus() {
if [ "$CFG_ANTISPAM" == "amavisd" ]; then
echo -n -e "$IDENTATION_LVL_1 Installing Antispam utilities (Amavisd-new), Spam filtering (SpamAssassin) and Greylisting (Postgrey) (This take some time. Don't abort it!)...."
package_install amavisd-new spamassassin postgrey
apt_install amavisd-new spamassassin postgrey
echo "use strict;" > /etc/amavis/conf.d/05-node_id
echo "chomp(\$myhostname = \`hostname --fqdn\`);" >> /etc/amavis/conf.d/05-node_id
echo "\$myhostname = \"$CFG_HOSTNAME_FQDN\";" >> /etc/amavis/conf.d/05-node_id
......@@ -24,16 +24,16 @@ InstallAntiVirus() {
echo -e " [ ${green}DONE${NC} ] "
elif [ "$CFG_ANTISPAM" == "rspamd" ]; then
echo -n -e "$IDENTATION_LVL_1 Installing Antispam utilities (Rspamd) (This take some time. Don't abort it!)..."
package_install redis-server lsb-release
apt_install redis-server lsb-release
if [[ "$(which named)" == "" ]]; then
package_install unbound
apt_install unbound
fi
CODENAME=`lsb_release -c -s`
curl https://rspamd.com/apt-stable/gpg.key | apt-key add -
echo "deb [arch=amd64] http://rspamd.com/apt-stable/ $CODENAME main" > /etc/apt/sources.list.d/rspamd.list
echo "deb-src [arch=amd64] http://rspamd.com/apt-stable/ $CODENAME main" >> /etc/apt/sources.list.d/rspamd.list
package_update
package_install rspamd
apt_update
apt_install rspamd
echo 'servers = "127.0.0.1";' > /etc/rspamd/local.d/redis.conf
echo "nrows = 2500;" > /etc/rspamd/local.d/history_redis.conf
echo "compress = true;" >> /etc/rspamd/local.d/history_redis.conf
......@@ -46,7 +46,7 @@ InstallAntiVirus() {
fi
echo -n -e "$IDENTATION_LVL_1 Installing AntiVirus utilities (ClamAV) (This take some time. Don't abort it!)..."
package_install clamav clamav-daemon unzip bzip2 arj nomarch lzop cabextract p7zip p7zip-full lrzip apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libclamunrar9 libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl libdbd-mysql-perl unrar-free unp lz4 liblz4-tool rpm2cpio tnef unp
apt_install clamav clamav-daemon unzip bzip2 arj nomarch lzop cabextract p7zip p7zip-full lrzip apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libclamunrar9 libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl libdbd-mysql-perl unrar-free unp lz4 liblz4-tool rpm2cpio tnef unp
echo -e " [ ${green}DONE${NC} ] "
echo -n -e "$IDENTATION_LVL_1 Configure AntiVirus ... "
......
......@@ -7,7 +7,7 @@ InstallBasePhp() {
echo -e "$IDENTATION_LVL_0 ${BWhite}Installing basic PHP modules for ISPConfig${NC}"
echo -n -e "$IDENTATION_LVL_1 Installing required components (PHP 8.2)... "
package_install php8.2-fpm php8.2-cli php8.2-mysql php8.2-mcrypt php8.2-mbstring
apt_install php8.2-fpm php8.2-cli php8.2-mysql php8.2-mcrypt php8.2-mbstring
echo -e "[${green}DONE${NC}]"
MeasureTimeDuration $START_TIME
......
......@@ -9,7 +9,7 @@ InstallBind() {
echo -n -e "$IDENTATION_LVL_1 Installing Bind9 and Haveged... "
# If your server is a virtual machine, it is highly recommended to install the haveged daemon
# to increase entropy for DNSSEC signing. It is also safe to install haveged on non-virtual servers.
if ! package_install bind9 dnsutils haveged; then
if ! apt_install bind9 dnsutils haveged; then
echo -e "[${red}FAILED${NC}]"
echo -e "$IDENTATION_LVL_2 ${red}Failed to install packages. Check the log file for more details.${NC}"
exit 1
......
......@@ -7,7 +7,7 @@ InstallFail2ban() {
echo -e "$IDENTATION_LVL_0 ${BWhite}Installing Fail2Ban and Rootkit detection (rkhunter)${NC}"
echo -n -e "$IDENTATION_LVL_1 Installing required components... "
package_install fail2ban rkhunter
apt_install fail2ban rkhunter
echo -e "[${green}DONE${NC}]"
# Configure Fail2Ban based on the selected MTA
......@@ -172,7 +172,7 @@ EOF
# Install and configure UFW firewall
echo -n -e "$IDENTATION_LVL_1 Installing Firewall (UFW)... "
package_install ufw
apt_install ufw
echo -e "[${green}DONE${NC}]"
# Measure and display the time taken for the installation
......
......@@ -17,7 +17,7 @@ InstallFTP() {
echo -e "[${green}DONE${NC}]"
echo -e "$IDENTATION_LVL_1 Installing PureFTPd... "
package_install pure-ftpd-common pure-ftpd-mysql
apt_install pure-ftpd-common pure-ftpd-mysql
sed -i 's/ftp/\#ftp/' /etc/inetd.conf >>"$PROGRAMS_INSTALL_LOG_FILES" 2>&1
echo -e " [${green}DONE${NC}]"
......
......@@ -55,7 +55,7 @@ InstallGitlabCE() {
#sudo sed -i 's/http:\/\/lt\./http:\/\//g' /etc/apt/sources.list.d/passenger.list
#hide_output apt-get update
#deleted etc/nginx!!!!! backup!!!!!
#apt-get purge nginx nginx-full nginx-light nginx-naxsi nginx-common
#apt_purge_remove nginx nginx-full nginx-light nginx-naxsi nginx-common
#apt_install nginx-extras passenger
#sed -i "s|^\(http {\).*$|\1\\ninclude \/etc\/nginx\/passenger.conf;|" /etc/nginx/nginx.conf
......
......@@ -6,7 +6,7 @@ InstallJailkit() {
local START_TIME=$SECONDS
echo -n -e "$IDENTATION_LVL_0 ${BWhite}Installing JailKit... "
package_install jailkit
apt_install jailkit
echo -e "[${green}DONE${NC}]"
MeasureTimeDuration $START_TIME
......
......@@ -10,12 +10,12 @@ InstallLetsEncrypt() {
if [ $CFG_CERTBOT_VERSION == "certbot" ]; then
if [ $CFG_WEBSERVER == "apache" ]; then
echo -n -e "$IDENTATION_LVL_1 Installing certbot for Apache... "
package_install certbot python3-certbot-apache
apt_install certbot python3-certbot-apache
certbot --apache >>$PROGRAMS_INSTALL_LOG_FILES 2>&1
echo -e "[${green}DONE${NC}]"
elif [ $CFG_WEBSERVER == "nginx" ]; then
echo -n -e "$IDENTATION_LVL_1 Installing certbot for Nginx... "
package_install certbot python3-certbot-nginx
apt_install certbot python3-certbot-nginx
echo -e "[${green}DONE${NC}]"
fi
......
......@@ -9,7 +9,7 @@ InstallMetronome() {
# Install required packages
echo -e "$IDENTATION_LVL_1 ${BWhite}Installing dependencies...${NC}"
package_install git lua5.1 liblua5.1-0-dev lua-filesystem libidn11-dev libssl-dev lua-zlib lua-expat lua-event lua-bitop lua-socket lua-sec luarocks
apt_install git lua5.1 liblua5.1-0-dev lua-filesystem libidn11-dev libssl-dev lua-zlib lua-expat lua-event lua-bitop lua-socket lua-sec luarocks
if [ $? -ne 0 ]; then
echo -e "$IDENTATION_LVL_1 ${red}Failed to install dependencies. Aborting.${NC}"
return 1
......
......@@ -16,7 +16,7 @@ InstallMTA() {
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_2 Installing Courier and dependecies... "
package_install courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql courier-maildrop opendkim opendkim-tools
apt_install courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql courier-maildrop opendkim opendkim-tools
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_2 Config saslauthd... "
......@@ -47,7 +47,7 @@ InstallMTA() {
"dovecot")
echo -n -e "$IDENTATION_LVL_1 Installing POP3/IMAP Mail server ${red}Dovecot ${NC} and Mail signing (OpenDKIM)..."
echo -n -e "$IDENTATION_LVL_2 Installing Dovecot and dependecies... "
package_install dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-lmtpd dovecot-managesieved dovecot-antispam opendkim opendkim-tools
apt_install dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-lmtpd dovecot-managesieved dovecot-antispam opendkim opendkim-tools
# The `default_process_limit` is 100, which constrains the total number
# of active IMAP connections (at, say, 5 open connections per user that
......
......@@ -37,7 +37,7 @@ InstallSQLServer() {
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Updating package list... "
package_update
apt_update
echo -e "[${green}DONE${NC}]"
echo "mysql-community-server mysql-community-server/root-pass password $CFG_MYSQL_ROOT_PWD" | debconf-set-selections
......@@ -63,7 +63,7 @@ InstallSQLServer() {
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Updating package list... "
package_update
apt_update
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 SSetting MySQL root password... "
......@@ -79,7 +79,7 @@ InstallSQLServer() {
if [ $SHOULD_INSTALL_MYSQL == true ]; then
echo -n -e "$IDENTATION_LVL_1 Installing MySQL Server & Client... "
package_install mysql-client mysql-server
apt_install mysql-client mysql-server
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Configuring MySQL... "
......@@ -154,14 +154,14 @@ default-authentication-plugin=mysql_native_password
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Installing MariaDB Server & Client... "
package_install software-properties-common dirmngr apt-transport-https
apt_install software-properties-common dirmngr apt-transport-https
apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
add-apt-repository 'deb [arch=amd64] http://mariadb.mirrors.ovh.net/MariaDB/repo/11.8.1/debian bookworm main' >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
package_update
package_install mariadb-client mariadb-server
yes | add-apt-repository 'deb [arch=amd64] http://mariadb.mirrors.ovh.net/MariaDB/repo/11.8.1/debian bookworm main' >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
apt_update
apt_install mariadb-client mariadb-server
#Galera cluster
#package_install mariadb-backup galera-4
#apt_install mariadb-backup galera-4
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Configuring MariaDB... "
......@@ -182,7 +182,7 @@ default-authentication-plugin=mysql_native_password
#EOF
echo -n -e "$IDENTATION_LVL_1 Securing MariaDB installation... "
package_install expect
apt_install expect
SECURE_MYSQL=$(expect -c "
set timeout 10
spawn mysql_secure_installation
......@@ -201,7 +201,7 @@ default-authentication-plugin=mysql_native_password
expect eof
")
echo "$SECURE_MYSQL" > /dev/null 2>&1
package_purge_remove expect
apt_purge_remove expect
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Increasing file limits for MariaDB... "
......@@ -236,7 +236,7 @@ default-authentication-plugin=mysql_native_password
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Installing dbconfig-common and fixing RoundCube... "
package_install dbconfig-common dbconfig-mysql
apt_install dbconfig-common dbconfig-mysql
#There is currently a problem with the Debian dbconfig-common system which prevents the installation of RoundCube later, fix it by running this command:
sed -i -r 's/_dbc_nodb="yes" dbc_mysql_exec/_dbc_nodb="yes"; dbc_mysql_exec/g' /usr/share/dbconfig-common/internal/mysql
systemctl daemon-reload >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
......
......@@ -58,7 +58,7 @@ InstallNextcloud() {
echo -n -e "$IDENTATION_LVL_1 Installing required packages... "
# Install required PHP packages
package_install php8.2 php8.2-fpm php8.2-cli php8.2-sqlite php8.2-gd php8.2-imap php8.2-curl php-pear curl \
apt_install php8.2 php8.2-fpm php8.2-cli php8.2-sqlite php8.2-gd php8.2-imap php8.2-curl php-pear curl \
php8.2-dev memcached php-memcached php8.2-xml php8.2-mbstring php8.2-zip php8.2-apcu \
php8.2-fpm php8.2-mysql php8.2-xsl php8.2-gmp php8.2-bcmath php8.2-cgi php-gettext libxml2-dev \
php8.2-json php8.2-intl php8.2-imagick php8.2-common php8.2-opcache php8.2-readline php8.2
......
......@@ -11,7 +11,7 @@ InstallPostfix() {
if [ -f /etc/init.d/sendmail ]; then
service sendmail stop >>$PROGRAMS_INSTALL_LOG_FILES 2>&1
update-rc.d -f sendmail remove >>$PROGRAMS_INSTALL_LOG_FILES 2>&1
package_remove sendmail
apt_remove sendmail
fi
echo -e "[${green}DONE${NC}]"
......@@ -21,7 +21,7 @@ InstallPostfix() {
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Install SMTP Mail server (Postfix)... "
package_install postfix postfix-mysql postfix-doc postfix-pcre ca-certificates
apt_install postfix postfix-mysql postfix-doc postfix-pcre ca-certificates
echo -e "[${green}DONE${NC}] "
echo -n -e "$IDENTATION_LVL_1 Configure SMTP Mail server (Postfix)... "
......
......@@ -8,7 +8,7 @@ InstallQuota() {
echo -e "$IDENTATION_LVL_0 ${BWhite}Installing Disk Quota${NC}"
# Install necessary packages
if ! package_install quota quotatool >>$PROGRAMS_INSTALL_LOG_FILES 2>&1; then
if ! apt_install quota quotatool >>$PROGRAMS_INSTALL_LOG_FILES 2>&1; then
echo -e "$IDENTATION_LVL_1 ${red}Failed to install Quota packages. Check the log file for details.${NC}"
return 1
fi
......
......@@ -36,15 +36,15 @@ InstallWeblate() {
echo -e "[${green}DONE${NC}]\n"
echo -n -e "$IDENTATION_LVL_1 Installing packages..."
package_install libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev libyaml-dev libcairo-dev gir1.2-pango-1.0 libgirepository1.0-dev libacl1-dev libssl-dev build-essential python3-gdbm python3-dev python3-pip python3-virtualenv virtualenv git >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
apt_install libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev libyaml-dev libcairo-dev gir1.2-pango-1.0 libgirepository1.0-dev libacl1-dev libssl-dev build-essential python3-gdbm python3-dev python3-pip python3-virtualenv virtualenv git >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
# pycairo setup is a bit flaky, workarounds:
# https://github.com/pygobject/pycairo/issues/60: sudo apt install pkg-config
# https://github.com/pygobject/pycairo/issues/39: sudo apt install python-dev libcairo2-dev libjpeg-dev libgif-dev
package_install pkg-config python-dev libcairo2-dev libjpeg-dev libgif-dev >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
apt_install pkg-config python-dev libcairo2-dev libjpeg-dev libgif-dev
package_install sudo uwsgi uwsgi-plugin-python3 nginx openssh-client ca-certificates curl \
apt_install sudo uwsgi uwsgi-plugin-python3 nginx openssh-client ca-certificates curl \
gir1.2-pango-1.0 \
libxmlsec1-openssl \
libjpeg62-turbo \
......@@ -156,7 +156,7 @@ InstallWeblate() {
echo -e "[${green}DONE${NC}]\n"
echo -n -e "$IDENTATION_LVL_1 Installing redis server..."
package_install redis-server >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
apt_install redis-server
# They do not enable continuous liveness pings back to your supervisor.
sed -i "s/supervised no/supervised systemd/" /etc/redis/redis.conf
......@@ -200,7 +200,7 @@ InstallWeblate() {
service redis restart >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
package_install postgresql postgresql-contrib >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
apt_install postgresql postgresql-contrib
# If PostgreSQL was not installed before, set the master password
#sudo -u postgres psql postgres -c "\password postgres"
......
......@@ -36,16 +36,16 @@ InstallWeblate() {
echo -e "[${green}DONE${NC}]\n"
echo -n -e "$IDENTATION_LVL_1 Installing packages..."
package_install libxml2-dev libxslt1-dev libfreetype6-dev libjpeg-dev zlib1g-dev libyaml-dev libcairo2-dev gir1.2-pango-1.0 libgirepository1.0-dev libacl1-dev libssl-dev build-essential python3-gdbm python3-dev python3-pip python3-virtualenv virtualenv git >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
apt_install libxml2-dev libxslt1-dev libfreetype6-dev libjpeg-dev zlib1g-dev libyaml-dev libcairo2-dev gir1.2-pango-1.0 libgirepository1.0-dev libacl1-dev libssl-dev build-essential python3-gdbm python3-dev python3-pip python3-virtualenv virtualenv git >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
# pycairo setup is a bit flaky, workarounds:
# https://github.com/pygobject/pycairo/issues/60: sudo apt install pkg-config
# https://github.com/pygobject/pycairo/issues/39: sudo apt install python-dev libcairo2-dev libjpeg-dev libgif-dev
#package_install pkg-config python-dev libcairo2-dev libjpeg-dev libgif-dev >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
package_install pkg-config libgif-dev >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
#apt_install pkg-config python-dev libcairo2-dev libjpeg-dev libgif-dev >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
apt_install pkg-config libgif-dev >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
package_install sudo uwsgi uwsgi-plugin-python3 nginx openssh-client ca-certificates curl \
apt_install sudo uwsgi uwsgi-plugin-python3 nginx openssh-client ca-certificates curl \
gir1.2-pango-1.0 \
libxmlsec1-openssl \
libjpeg62-turbo \
......@@ -155,7 +155,7 @@ InstallWeblate() {
echo -e "[${green}DONE${NC}]\n"
echo -n -e "$IDENTATION_LVL_1 Installing redis server..."
package_install redis-server >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
apt_install redis-server >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
# They do not enable continuous liveness pings back to your supervisor.
sed -i "s/supervised no/supervised systemd/" /etc/redis/redis.conf
......@@ -199,7 +199,7 @@ InstallWeblate() {
service redis restart >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
package_install postgresql postgresql-contrib >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
apt_install postgresql postgresql-contrib >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
# If PostgreSQL was not installed before, set the master password
#sudo -u postgres psql postgres -c "\password postgres"
......
......@@ -101,7 +101,7 @@ InstallRoundcubeStable() {
# Install Roundcube packages
echo -e "$IDENTATION_LVL_2 Installing Roundcube packages... "
package_install roundcube-core roundcube roundcube-mysql roundcube-plugins
apt_install roundcube-core roundcube roundcube-mysql roundcube-plugins
echo -e "[${green}DONE${NC}]"
# Configure Roundcube on WebServer
......@@ -131,7 +131,7 @@ InstallRoundcubeLatest() {
# Install required PHP packages
echo -e "$IDENTATION_LVL_2 Installing required PHP packages... "
package_install -t php8.2 php8.2-gd php8.2-mysql php8.2-curl php8.2-zip php8.2-ldap php8.2-mbstring php8.2-imagick php8.2-intl php8.2-xml php8.2-dom php8.2-xmlreader php8.2-xmlwriter php8.2-gettext php8.2-json php8.2-gd php8.2-bcmath php8.2-cgi php8.2-gmp php8.2-common php8.2-fpm php-pear unzip wget curl javascript-common libjs-jquery-mousewheel libjs-jquery libmagic1 tinymce
apt_install -t php8.2 php8.2-gd php8.2-mysql php8.2-curl php8.2-zip php8.2-ldap php8.2-mbstring php8.2-imagick php8.2-intl php8.2-xml php8.2-dom php8.2-xmlreader php8.2-xmlwriter php8.2-gettext php8.2-json php8.2-gd php8.2-bcmath php8.2-cgi php8.2-gmp php8.2-common php8.2-fpm php-pear unzip wget curl javascript-common libjs-jquery-mousewheel libjs-jquery libmagic1 tinymce
echo -e "[${green}DONE${NC}]"
echo -e "$IDENTATION_LVL_2 Installing required PHP pear packages... "
......@@ -142,7 +142,7 @@ InstallRoundcubeLatest() {
pear install Net_IDNA2
echo -e "[${green}DONE${NC}]"
apt-get purge -qq -y roundcube*
apt_purge_remove roundcube*
needs_update=0
if [ ! -f /usr/local/lib/roundcubemail/version ]; then
......
......@@ -101,7 +101,7 @@ InstallWebServer() {
curl -sSL https://packages.sury.org/nginx-mainline/README.txt | sudo bash -x >>$PROGRAMS_INSTALL_LOG_FILES 2>&1
package_update
apt_update
#apt_install nginx-core nginx nginx-common nginx-module-geoip nginx-module-image-filter nginx-module-njs nginx-module-perl nginx-module-xslt
apt_install nginx-full nginx-module-geoip nginx-module-image-filter
......
......@@ -7,7 +7,7 @@ InstallWebStats() {
echo -e "$IDENTATION_LVL_0 ${BWhite}Installing Web Statistics Tools${NC}"
echo -n -e "$IDENTATION_LVL_1 Installing Required Components... "
if package_install vlogger geoip-database libclass-dbi-mysql-perl libtimedate-perl; then
if apt_install vlogger geoip-database libclass-dbi-mysql-perl libtimedate-perl; then
echo -e "[${green}DONE${NC}]"
else
echo -e "[${red}FAILED${NC}]"
......@@ -17,7 +17,7 @@ InstallWebStats() {
if [ "$CFG_WEBSTATS" == "yes" ]; then
echo -n -e "$IDENTATION_LVL_1 Installing AWFFull... "
if package_install awffull; then
if apt_install awffull; then
echo -e "[${green}DONE${NC}]"
else
echo -e "[${red}FAILED${NC}]"
......@@ -33,7 +33,7 @@ InstallWebStats() {
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Installing AWStats... "
if package_install awstats; then
if apt_install awstats; then
echo -e "[${green}DONE${NC}]"
else
echo -e "[${red}FAILED${NC}]"
......@@ -55,7 +55,7 @@ InstallWebStats() {
if wget -O - https://deb.goaccess.io/gnugpg.key | gpg --dearmor | tee /usr/share/keyrings/goaccess.gpg >>$PROGRAMS_INSTALL_LOG_FILES 2>&1 && \
echo "deb [signed-by=/usr/share/keyrings/goaccess.gpg arch=$(dpkg --print-architecture)] https://deb.goaccess.io/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/goaccess.list && \
hide_output apt-get update && \
package_install goaccess; then
apt_install goaccess; then
echo -e "[${green}DONE${NC}]"
else
echo -e "[${red}FAILED${NC}]"
......
......@@ -3,13 +3,21 @@
# Check Installed Linux Version
#---------------------------------------------------------------------
LOG_SPACER=" "
LOG_SPACER_SIGNS="======="
LOG_SPACER_SIGNS_END="===================================="
function log_message() {
echo -e "$LOG_SPACER $LOG_SPACER_SIGNS $1 $LOG_SPACER_SIGNS" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
}
# Adapted from: https://github.com/mail-in-a-box/mailinabox/blob/master/setup/functions.sh#L1
function hide_output {
# This function hides the output of a command unless the command fails
# and returns a non-zero exit code.
# Get a temporary file.
OUTPUT=$(tempfile)
# Get a temporary file
OUTPUT=$(mktemp)
# Execute command, redirecting stderr/stdout to the temporary file.
$@ &> $OUTPUT
......@@ -17,16 +25,22 @@ function hide_output {
# If the command failed, show the output that was captured in the temporary file.
E=$?
if [ $E != 0 ]; then
# Something failed.
# Something failed
echo
echo FAILED: $@
echo -----------------------------------------
cat $OUTPUT
echo -----------------------------------------
# The error output is also written to the log file
log_message "ERROR: $@"
cat $OUTPUT >> $LOG_FILE
log_message "ERROR END"
# Remove temporary file
rm -f $OUTPUT
exit $E
fi
# Remove temporary file.
# Remove temporary file
rm -f $OUTPUT
}
......@@ -44,6 +58,23 @@ function apt_get_quiet {
DEBIAN_FRONTEND=noninteractive hide_output apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" "$@"
}
# Update Package(s)
function apt_update {
log_message "UPDATE PACKAGES START"
apt-get update >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
log_message "UPDATE PACKAGES COMPLETE"
echo -e "$LOG_SPACER $LOG_SPACER_SIGNS_END \n" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
}
# Upgrade(s)
function apt_upgrade {
log_message "UPGRADE PACKAGES START"
apt-get -yqq upgrade >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
log_message "UPGRADE PACKAGES COMPLETE"
echo -e "$LOG_SPACER $LOG_SPACER_SIGNS_END \n" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
}
# Install Package(s)
function apt_install {
# Install a bunch of packages. We used to report which packages were already
# installed and which needed installing, before just running an 'apt-get
......@@ -51,12 +82,41 @@ function apt_install {
# and doesn't affect what we actually do, except in the messages, so let's
# not do that anymore.
PACKAGES=$@
log_message "INSTALL PACKAGES START"
log_message "Installing: $PACKAGES"
apt_get_quiet install $PACKAGES
#hide_output apt-get -y install "$@"
log_message "INSTALL PACKAGES COMPLETE"
echo -e "$LOG_SPACER $LOG_SPACER_SIGNS_END \n" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
}
# Remove Package(s)
function apt_remove {
hide_output apt-get -y remove "$@"
PACKAGES=$@
log_message "REMOVE PACKAGES START"
log_message "Removing: $PACKAGES"
apt-get -yqq remove "$@" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
log_message "REMOVE PACKAGES COMPLETE"
echo -e "$LOG_SPACER $LOG_SPACER_SIGNS_END \n" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
}
# Uninstall Package(s)
function apt_uninstall {
PACKAGES=$@
log_message "UNINSTALL PACKAGES START"
log_message "Uninstalling: $PACKAGES"
apt-get -yqq purge "$@" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
log_message "UNINSTALL PACKAGES COMPLETE"
echo -e "$LOG_SPACER $LOG_SPACER_SIGNS_END \n" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
}
# Remove Package(s)
function apt_purge_remove {
PACKAGES=$@
log_message "REMOVE AND PURGE PACKAGES START"
log_message "Removing and purging: $PACKAGES"
apt-get -yqq remove --purge "$@" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
log_message "REMOVE AND PURGE PACKAGES COMPLETE"
echo -e "$LOG_SPACER $LOG_SPACER_SIGNS_END \n" >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
}
function apt_add_repository_to_unattended_upgrades {
......@@ -68,6 +128,14 @@ function apt_add_repository_to_unattended_upgrades {
fi
}
function restart_service {
hide_output service $1 restart
}
function stop_service {
hide_output service $1 stop
}
function get_default_hostname {
# Guess the machine's hostname. It should be a fully qualified
# domain name suitable for DNS. None of these calls may provide
......@@ -151,14 +219,6 @@ function ufw_allow {
fi
}
function restart_service {
hide_output service $1 restart
}
function stop_service {
hide_output service $1 stop
}
## Dialog Functions ##
function message_box {
dialog --title "$1" --msgbox "$2" 0 0
......
......@@ -48,12 +48,12 @@ echo -e " - ${BWhite}SQLs:${NC} ${BBlack}tmp/sqls${NC} [ ${green}DONE${NC}
echo -e " - ${BWhite}Downloads:${NC} ${BBlack}tmp/downloads${NC} [ ${green}DONE${NC} ]"
echo -n -e "$IDENTATION_LVL_0 ${BWhite}Setup Logging Files${NC}"
exec > >(tee -i tmp/logs/ispconfig_setup.log)
exec > >(tee -i tmp/logs/wt_server_setup_programs.log)
exec 2>&1
PROGRAMS_INSTALL_DOWNLOAD=$PWD/tmp/downloads
PROGRAMS_INSTALL_SQLS=$PWD/tmp/sqls
PROGRAMS_INSTALL_LOG_FILES=$PWD/tmp/logs/ispconfig_setup_programs.log
PROGRAMS_INSTALL_LOG_FILES=$PWD/tmp/logs/wt_server_setup_programs.log
touch $PROGRAMS_INSTALL_LOG_FILES
echo -e "[ ${green}DONE${NC} ]"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment