postconf -ev "${MAPFILE[@]}"
}
e() { printf "%s\n" "$*"; }
+pi() { # package install
+ local s f
+ if dpkg -s -- "$@" &> /dev/null; then
+ return 0;
+ fi;
+ while fuser /var/lib/dpkg/lock &>/dev/null; do sleep 1; done
+ f=/var/cache/apt/pkgcache.bin;
+ if [[ ! -r $f ]] || (( $(( $(date +%s) - $(stat -c %Y $f ) )) > 60*60*12 )); then
+ apt-get update
+ fi
+ apt-get -y install --purge --auto-remove "$@"
+}
postmaster=$u
mxhost=mail.iankelling.org
postfix postfix/root_address string $postmaster
EOF
if dpkg -s postfix &>/dev/null; then
+ while fuser /var/lib/dpkg/lock &>/dev/null; do sleep 1; done
dpkg-reconfigure -u -fnoninteractive postfix
else
- apt-get -y install --purge --auto-remove postfix
+ pi postfix
fi
else
source /a/bin/distro-functions/src/package-manager-abstractions
else # begin exim. has debian specific stuff for now
- if ! dpkg -s openvpn &>/dev/null; then
- apt-get -y install --purge --auto-remove openvpn
- fi
+ pi openvpn
if [[ -e /p/c/filesystem ]]; then
# allow failure of these commands when our internet is down, they are likely not needed,
# sieve has the benefit of being supported in postfix and
# proprietary/weird environments, so there is more examples on the
# internet. I was torn about whether to do this or not, meh.
- apt-get -y install --purge --auto-remove \
- dovecot-core dovecot-imapd dovecot-sieve dovecot-lmtpd
+ pi dovecot-core dovecot-imapd dovecot-sieve dovecot-lmtpd
# if we changed 90-sieve.conf and removed the active part of the
# sieve option, we wouldn\'t need this, but I\'d rather not modify a
# gotta remove this, otherwise the set-selections are completely
# ignored. It woulda been nice if this was documented somewhere!
rm -f /etc/exim4/update-exim4.conf.conf
+ while fuser /var/lib/dpkg/lock &>/dev/null; do sleep 1; done
dpkg-reconfigure -u -fnoninteractive exim4-config
fi
fi
# light version of exim does not have sasl auth support.
- apt-get -y install --purge --auto-remove exim4-daemon-heavy spamassassin
+ pi exim4-daemon-heavy spamassassin