silence all of the installing/already installed package messages on installation

Querying dpkg for each package is slow, and we have way too much output on installation because of it.
This commit is contained in:
Joshua Tauberer 2015-08-19 15:58:35 -04:00
parent 79317ed67e
commit 73fbcd7fa3
14 changed files with 20 additions and 29 deletions

View file

@ -10,6 +10,7 @@ source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars source /etc/mailinabox.conf # load global vars
# Install DKIM... # Install DKIM...
echo Installing OpenDKIM/OpenDMARC...
apt_install opendkim opendkim-tools opendmarc apt_install opendkim opendkim-tools opendmarc
# Make sure configuration directories exist. # Make sure configuration directories exist.

View file

@ -15,7 +15,7 @@ source /etc/mailinabox.conf # load global vars
# * nsd: The non-recursive nameserver that publishes our DNS records. # * nsd: The non-recursive nameserver that publishes our DNS records.
# * ldnsutils: Helper utilities for signing DNSSEC zones. # * ldnsutils: Helper utilities for signing DNSSEC zones.
# * openssh-client: Provides ssh-keyscan which we use to create SSHFP records. # * openssh-client: Provides ssh-keyscan which we use to create SSHFP records.
echo "Installing nsd (DNS server)..."
apt_install nsd ldnsutils openssh-client apt_install nsd ldnsutils openssh-client
# Prepare nsd's configuration. # Prepare nsd's configuration.

View file

@ -39,32 +39,12 @@ function apt_get_quiet {
} }
function apt_install { function apt_install {
# Report any packages already installed. # Install a bunch of packages. We used to report which packages were already
# installed and which needed installing, before just running an 'apt-get
# install' for all of the packages. Calling `dpkg` on each package is slow,
# and doesn't affect what we actually do, except in the messages, so let's
# not do that anymore.
PACKAGES=$@ PACKAGES=$@
TO_INSTALL=""
ALREADY_INSTALLED=""
for pkg in $PACKAGES; do
if dpkg -s $pkg 2>/dev/null | grep "^Status: install ok installed" > /dev/null; then
if [[ ! -z "$ALREADY_INSTALLED" ]]; then ALREADY_INSTALLED="$ALREADY_INSTALLED, "; fi
ALREADY_INSTALLED="$ALREADY_INSTALLED$pkg (`dpkg -s $pkg | grep ^Version: | sed -e 's/.*: //'`)"
else
TO_INSTALL="$TO_INSTALL""$pkg "
fi
done
# List the packages already installed.
if [[ ! -z "$ALREADY_INSTALLED" ]]; then
echo already installed: $ALREADY_INSTALLED
fi
# List the packages about to be installed.
if [[ ! -z "$TO_INSTALL" ]]; then
echo installing $TO_INSTALL...
fi
# We still include the whole original package list in the apt-get command in
# case it wants to upgrade anything, I guess? Maybe we can remove it. Doesn't normally make
# a difference.
apt_get_quiet install $PACKAGES apt_get_quiet install $PACKAGES
} }

View file

@ -23,6 +23,7 @@ source /etc/mailinabox.conf # load global vars
# but dovecot-lucene is packaged by *us* in the Mail-in-a-Box PPA, # but dovecot-lucene is packaged by *us* in the Mail-in-a-Box PPA,
# not by Ubuntu. # not by Ubuntu.
echo "Installing Dovecot (IMAP server)..."
apt_install \ apt_install \
dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-sqlite sqlite3 \ dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-sqlite sqlite3 \
dovecot-sieve dovecot-managesieved dovecot-lucene dovecot-sieve dovecot-managesieved dovecot-lucene

View file

@ -49,6 +49,7 @@ source /etc/mailinabox.conf # load global vars
# > infrastructure and every commercial vendor of dnswl.org data (eg through # > infrastructure and every commercial vendor of dnswl.org data (eg through
# > anti-spam solutions) must register with dnswl.org and purchase a subscription. # > anti-spam solutions) must register with dnswl.org and purchase a subscription.
echo "Installing Postfix (SMTP server)..."
apt_install postfix postfix-pcre postgrey ca-certificates apt_install postfix postfix-pcre postgrey ca-certificates
# ### Basic Settings # ### Basic Settings

View file

@ -2,6 +2,8 @@
source setup/functions.sh source setup/functions.sh
echo "Installing Mail-in-a-Box system management daemon..."
# build-essential libssl-dev libffi-dev python3-dev: Required to pip install cryptography. # build-essential libssl-dev libffi-dev python3-dev: Required to pip install cryptography.
apt_install python3-flask links duplicity libyaml-dev python3-dnspython python3-dateutil \ apt_install python3-flask links duplicity libyaml-dev python3-dnspython python3-dateutil \
build-essential libssl-dev libffi-dev python3-dev python-pip build-essential libssl-dev libffi-dev python3-dev python-pip

View file

@ -6,6 +6,7 @@ source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars source /etc/mailinabox.conf # load global vars
# install Munin # install Munin
echo "Installing Munin (system monitoring)..."
apt_install munin munin-node apt_install munin munin-node
# edit config # edit config

View file

@ -7,6 +7,8 @@ source /etc/mailinabox.conf # load global vars
# ### Installing ownCloud # ### Installing ownCloud
echo "Installing ownCloud (contacts/calendar)..."
apt_install \ apt_install \
dbconfig-common \ dbconfig-common \
php5-cli php5-sqlite php5-gd php5-imap php5-curl php-pear php-apc curl libapr1 libtool libcurl4-openssl-dev php-xml-parser \ php5-cli php5-sqlite php5-gd php5-imap php5-curl php-pear php-apc curl libapr1 libtool libcurl4-openssl-dev php-xml-parser \
@ -35,7 +37,6 @@ if [ ! -d /usr/local/lib/owncloud/ ] \
|| ! grep -q $owncloud_ver /usr/local/lib/owncloud/version.php; then || ! grep -q $owncloud_ver /usr/local/lib/owncloud/version.php; then
# Download and verify # Download and verify
echo "installing ownCloud..."
wget_verify https://download.owncloud.org/community/owncloud-$owncloud_ver.zip $owncloud_hash /tmp/owncloud.zip wget_verify https://download.owncloud.org/community/owncloud-$owncloud_ver.zip $owncloud_hash /tmp/owncloud.zip
# Clear out the existing ownCloud. # Clear out the existing ownCloud.

View file

@ -16,6 +16,7 @@ source setup/functions.sh # load our functions
# ---------------------------------------- # ----------------------------------------
# Install packages. # Install packages.
echo "Installing SpamAssassin..."
apt_install spampd razor pyzor dovecot-antispam apt_install spampd razor pyzor dovecot-antispam
# Allow spamassassin to download new rules. # Allow spamassassin to download new rules.

View file

@ -19,6 +19,7 @@
source setup/functions.sh # load our functions source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars source /etc/mailinabox.conf # load global vars
echo "Creating initial SSL certificate and perfect forward secrecy Diffie-Hellman parameters..."
apt_install openssl apt_install openssl
mkdir -p $STORAGE_ROOT/ssl mkdir -p $STORAGE_ROOT/ssl

View file

@ -51,6 +51,7 @@ apt_get_quiet upgrade
# * coreutils: includes `nproc` tool to report number of processors, mktemp # * coreutils: includes `nproc` tool to report number of processors, mktemp
# * bc: allows us to do math to compute sane defaults # * bc: allows us to do math to compute sane defaults
echo Installing system packages...
apt_install python3 python3-dev python3-pip \ apt_install python3 python3-dev python3-pip \
netcat-openbsd wget curl git sudo coreutils bc \ netcat-openbsd wget curl git sudo coreutils bc \
haveged unattended-upgrades cron ntp fail2ban haveged unattended-upgrades cron ntp fail2ban

View file

@ -17,6 +17,7 @@ fi
# #
# Turn off nginx's default website. # Turn off nginx's default website.
echo "Installing Nginx (web server)..."
apt_install nginx php5-fpm apt_install nginx php5-fpm
rm -f /etc/nginx/sites-enabled/default rm -f /etc/nginx/sites-enabled/default

View file

@ -19,6 +19,7 @@ source /etc/mailinabox.conf # load global vars
# and then we'll manually install roundcube from source. # and then we'll manually install roundcube from source.
# These dependencies are from `apt-cache showpkg roundcube-core`. # These dependencies are from `apt-cache showpkg roundcube-core`.
echo "Installing Roundcube (webmail)..."
apt_install \ apt_install \
dbconfig-common \ 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-mail-mimedecode php-crypt-gpg php5-gd php5-pspell \ 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-mail-mimedecode php-crypt-gpg php5-gd php5-pspell \
@ -47,7 +48,6 @@ elif [[ "$UPDATE_KEY" != `cat /usr/local/lib/roundcubemail/version` ]]; then
fi fi
if [ $needs_update == 1 ]; then if [ $needs_update == 1 ]; then
# install roundcube # install roundcube
echo installing Roundcube webmail $VERSION...
wget_verify \ wget_verify \
https://mailinabox.email/mirror/roundcubemail-$VERSION.tar.gz \ https://mailinabox.email/mirror/roundcubemail-$VERSION.tar.gz \
$HASH \ $HASH \

View file

@ -15,6 +15,7 @@ source /etc/mailinabox.conf # load global vars
# Prereqs. # Prereqs.
echo "Installing Z-Push (Exchange/ActiveSync server)..."
apt_install \ apt_install \
php-soap php5-imap libawl-php php5-xsl php-soap php5-imap libawl-php php5-xsl
@ -30,7 +31,6 @@ elif [[ $TARGETHASH != `cat /usr/local/lib/z-push/version` ]]; then
needs_update=1 #NODOC needs_update=1 #NODOC
fi fi
if [ $needs_update == 1 ]; then if [ $needs_update == 1 ]; then
echo installing z-push \(fmbiete fork\)...
git_clone https://github.com/fmbiete/Z-Push-contrib $TARGETHASH '' /usr/local/lib/z-push git_clone https://github.com/fmbiete/Z-Push-contrib $TARGETHASH '' /usr/local/lib/z-push
rm -f /usr/sbin/z-push-{admin,top} rm -f /usr/sbin/z-push-{admin,top}
ln -s /usr/local/lib/z-push/z-push-admin.php /usr/sbin/z-push-admin ln -s /usr/local/lib/z-push/z-push-admin.php /usr/sbin/z-push-admin