mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-12-22 07:17:05 +00:00
make a bash function to use everywhere we apt-get-install (DEBIAN_FRONTEND=noninteractive apt-get -qq -y
)
ensures the output is quiet
This commit is contained in:
parent
80bf60715e
commit
66269f910f
@ -4,8 +4,10 @@
|
||||
# After this, you'll still need to run dns_update.sh to get the DKIM
|
||||
# signature in the DNS zones.
|
||||
|
||||
source scripts/functions.sh # load our functions
|
||||
|
||||
# Install DKIM
|
||||
apt-get install -q -y opendkim opendkim-tools
|
||||
apt_install opendkim opendkim-tools
|
||||
|
||||
# Make sure configuration directories exist.
|
||||
mkdir -p /etc/opendkim;
|
||||
|
@ -7,6 +7,8 @@
|
||||
#
|
||||
# This script will turn on DNS for $PUBLIC_HOSTNAME.
|
||||
|
||||
source scripts/functions.sh # load our functions
|
||||
|
||||
# Install nsd, our DNS server software.
|
||||
|
||||
# ...but first, we have to create the user because the
|
||||
@ -20,7 +22,7 @@ fi
|
||||
|
||||
# Okay now install the package.
|
||||
|
||||
apt-get -qq -y install nsd
|
||||
apt_install nsd
|
||||
|
||||
# Prepare nsd's configuration.
|
||||
|
||||
|
21
scripts/functions.sh
Normal file
21
scripts/functions.sh
Normal file
@ -0,0 +1,21 @@
|
||||
function apt_install {
|
||||
# Report any packages already installed.
|
||||
PACKAGES=$@
|
||||
TO_INSTALL=""
|
||||
for pkg in $PACKAGES; do
|
||||
if dpkg -s $pkg 2>/dev/null | grep "^Status: install ok installed" > /dev/null; then
|
||||
echo $pkg is already installed \(`dpkg -s $pkg | grep ^Version: | sed -e "s/.*: //"`\)
|
||||
else
|
||||
TO_INSTALL="$TO_INSTALL""$pkg "
|
||||
fi
|
||||
done
|
||||
|
||||
# List the packages about to be installed.
|
||||
if [[ ! -z "$TO_INSTALL" ]]; then
|
||||
echo installing $TO_INSTALL...
|
||||
fi
|
||||
|
||||
# 'DEBIAN_FRONTEND=noninteractive' is to prevent dbconfig-common from asking you questions.
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -qq -y install $PACKAGES > /dev/null;
|
||||
}
|
||||
|
@ -12,9 +12,10 @@
|
||||
|
||||
# Install packages.
|
||||
|
||||
source scripts/functions.sh # load our functions
|
||||
source /etc/mailinabox.conf # load global vars
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -q -y install \
|
||||
apt_install \
|
||||
postfix postgrey \
|
||||
dovecot-core dovecot-imapd dovecot-lmtpd dovecot-sqlite sqlite3 \
|
||||
openssl
|
||||
|
@ -9,8 +9,10 @@
|
||||
# plugin. The tools/mail.py tool creates the necessary sieve script for each mail
|
||||
# user when the mail user is created.
|
||||
|
||||
source scripts/functions.sh # load our functions
|
||||
|
||||
# Install packages.
|
||||
apt-get -q -y install spampd razor pyzor dovecot-sieve dovecot-antispam
|
||||
apt_install spampd razor pyzor dovecot-sieve dovecot-antispam
|
||||
|
||||
# Allow spamassassin to download new rules.
|
||||
tools/editconf.py /etc/default/spamassassin \
|
||||
|
@ -1,10 +1,12 @@
|
||||
source scripts/functions.sh # load our functions
|
||||
|
||||
# Base system configuration.
|
||||
|
||||
apt-get -q -q update
|
||||
apt-get -q -y upgrade
|
||||
|
||||
# Install openssh-server to ensure that the end result is consistent across all Mail-in-a-Boxes.
|
||||
apt-get -q -y install openssh-server
|
||||
apt_install openssh-server
|
||||
|
||||
# Check that SSH login with password is disabled. Stop if it's enabled.
|
||||
if grep -q "^PasswordAuthentication yes" /etc/ssh/sshd_config \
|
||||
@ -18,7 +20,7 @@ if grep -q "^PasswordAuthentication yes" /etc/ssh/sshd_config \
|
||||
exit
|
||||
fi
|
||||
|
||||
apt-get -q -y install python3
|
||||
apt_install python3
|
||||
|
||||
# Turn on basic services:
|
||||
#
|
||||
@ -28,11 +30,11 @@ apt-get -q -y install python3
|
||||
#
|
||||
# These services don't need further configuration and are started immediately after installation.
|
||||
|
||||
apt-get -q -y install ntp fail2ban
|
||||
apt_install ntp fail2ban
|
||||
|
||||
# Turn on the firewall. First allow incoming SSH, then turn on the firewall.
|
||||
# Other ports will be opened at the point where we set up those services.
|
||||
apt-get -q -y install ufw;
|
||||
apt_install ufw
|
||||
ufw allow ssh;
|
||||
ufw --force enable;
|
||||
|
||||
|
@ -1,12 +1,14 @@
|
||||
# HTTP: Turn on a web server serving static files
|
||||
#################################################
|
||||
|
||||
source scripts/functions.sh # load our functions
|
||||
|
||||
# Remove Apache before installing Nginx. Apache may leave
|
||||
# some unwanted configuration files around (e.g. a ufw
|
||||
# application config), so purge the packages.
|
||||
apt-get purge -q -y apache2 apache2.2-common
|
||||
|
||||
apt-get install -q -y nginx php5-cgi
|
||||
apt_install nginx php5-cgi
|
||||
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Webmail: Using roundcube
|
||||
##########################
|
||||
|
||||
source scripts/functions.sh # load our functions
|
||||
source /etc/mailinabox.conf # load global vars
|
||||
|
||||
# Ubuntu's roundcube-core has a dependency on Apache & MySQL, which we don't want, so we can't
|
||||
@ -8,10 +9,9 @@ source /etc/mailinabox.conf # load global vars
|
||||
# dependencies of roundcube that we know we need, and then we'll manually install debs for the
|
||||
# roundcube version we want from Debian.
|
||||
#
|
||||
# 'DEBIAN_FRONTEND=noninteractive' is to prevent dbconfig-common from asking you questions.
|
||||
# The dependencies are from 'apt-cache showpkg roundcube-core'.
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -q -q -y install \
|
||||
apt_install \
|
||||
dbconfig-common \
|
||||
php5 php5-sqlite php5-mcrypt php5-intl php5-json php5-common php-auth php-net-smtp php-net-socket php-net-sieve php-mail-mime php-crypt-gpg php5-gd php5-pspell \
|
||||
tinymce libjs-jquery libjs-jquery-mousewheel libmagic1
|
||||
|
Loading…
Reference in New Issue
Block a user