mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-06-08 19:00:55 +00:00
strict mode fixes, added trap so we get some sort of exit when applications have non 0 exit codes
This commit is contained in:
parent
0d4565e71d
commit
d25aa6804f
@ -4,7 +4,7 @@ if [ -z "`tools/mail.py user`" ]; then
|
|||||||
# aren't any yet, it'll be empty.
|
# aren't any yet, it'll be empty.
|
||||||
|
|
||||||
# If we didn't ask for an email address at the start, do so now.
|
# If we didn't ask for an email address at the start, do so now.
|
||||||
if [ -z "$EMAIL_ADDR" ]; then
|
if [ -z "${EMAIL_ADDR:-}" ]; then
|
||||||
# In an interactive shell, ask the user for an email address.
|
# In an interactive shell, ask the user for an email address.
|
||||||
if [ -z "${NONINTERACTIVE:-}" ]; then
|
if [ -z "${NONINTERACTIVE:-}" ]; then
|
||||||
input_box "Mail Account" \
|
input_box "Mail Account" \
|
||||||
@ -47,7 +47,7 @@ if [ -z "`tools/mail.py user`" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Create the user's mail account. This will ask for a password if none was given above.
|
# Create the user's mail account. This will ask for a password if none was given above.
|
||||||
tools/mail.py user add $EMAIL_ADDR $EMAIL_PW
|
tools/mail.py user add $EMAIL_ADDR ${EMAIL_PW:-}
|
||||||
|
|
||||||
# Make it an admin.
|
# Make it an admin.
|
||||||
hide_output tools/mail.py user make-admin $EMAIL_ADDR
|
hide_output tools/mail.py user make-admin $EMAIL_ADDR
|
||||||
|
@ -44,7 +44,7 @@ tools/editconf.py /etc/munin/munin-node.conf -s \
|
|||||||
log_level=1
|
log_level=1
|
||||||
|
|
||||||
# Update the activated plugins through munin's autoconfiguration.
|
# Update the activated plugins through munin's autoconfiguration.
|
||||||
munin-node-configure --shell --remove-also 2>/dev/null | sh
|
munin-node-configure --shell --remove-also 2>/dev/null | sh || /bin/true
|
||||||
|
|
||||||
# Deactivate monitoring of NTP peers. Not sure why anyone would want to monitor a NTP peer. The addresses seem to change
|
# Deactivate monitoring of NTP peers. Not sure why anyone would want to monitor a NTP peer. The addresses seem to change
|
||||||
# (which is taken care of my munin-node-configure, but only when we re-run it.)
|
# (which is taken care of my munin-node-configure, but only when we re-run it.)
|
||||||
|
@ -57,7 +57,7 @@ InstallNextcloud() {
|
|||||||
# Make sure permissions are correct or the upgrade step won't run.
|
# Make sure permissions are correct or the upgrade step won't run.
|
||||||
# $STORAGE_ROOT/owncloud may not yet exist, so use -f to suppress
|
# $STORAGE_ROOT/owncloud may not yet exist, so use -f to suppress
|
||||||
# that error.
|
# that error.
|
||||||
chown -f -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud
|
chown -f -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud || /bin/true
|
||||||
|
|
||||||
# If this isn't a new installation, immediately run the upgrade script.
|
# If this isn't a new installation, immediately run the upgrade script.
|
||||||
# Then check for success (0=ok and 3=no upgrade needed, both are success).
|
# Then check for success (0=ok and 3=no upgrade needed, both are success).
|
||||||
|
@ -92,7 +92,7 @@ if [ -z "${PUBLIC_IP:-}" ]; then
|
|||||||
|
|
||||||
# On the first run, if we got an answer from the Internet then don't
|
# On the first run, if we got an answer from the Internet then don't
|
||||||
# ask the user.
|
# ask the user.
|
||||||
if [[ -z "$DEFAULT_PUBLIC_IP" && ! -z "$GUESSED_IP" ]]; then
|
if [[ -z "${DEFAULT_PUBLIC_IP:-}" && ! -z "$GUESSED_IP" ]]; then
|
||||||
PUBLIC_IP=$GUESSED_IP
|
PUBLIC_IP=$GUESSED_IP
|
||||||
|
|
||||||
# Otherwise on the first run at least provide a default.
|
# Otherwise on the first run at least provide a default.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# This is the entry point for configuring the system.
|
# This is the entry point for configuring the system.
|
||||||
#####################################################
|
#####################################################
|
||||||
|
trap 'rc=$?; echo "$0: Error on line $LINENO running $BASH_COMMAND which had the following exit code $rc" 1>&2' ERR
|
||||||
source setup/functions.sh # load our functions
|
source setup/functions.sh # load our functions
|
||||||
|
|
||||||
# Check system setup: Are we running as root on Ubuntu 18.04 on a
|
# Check system setup: Are we running as root on Ubuntu 18.04 on a
|
||||||
|
Loading…
Reference in New Issue
Block a user