From 794a52d042a3d6f6de89f94675fbb0d716a5a911 Mon Sep 17 00:00:00 2001 From: H8H Date: Sun, 1 Feb 2015 19:10:23 +0100 Subject: [PATCH] Highest priority: the pre set STORAGE_ROOT/USER, midmost priority: the config settings, lowest priority: the default one. --- setup/start.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/setup/start.sh b/setup/start.sh index 022600d3..e61b058c 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -93,8 +93,13 @@ fi # # If the config file exists: # Apply the existing configuration options for STORAGE_USER/ROOT -STORAGE_USER=$([[ -z "$DEFAULT_STORAGE_USER" ]] && echo "user-data" || echo "$DEFAULT_STORAGE_USER") -STORAGE_ROOT=$([[ -z "$DEFAULT_STORAGE_ROOT" ]] && echo "/home/$STORAGE_USER" || echo "$DEFAULT_STORAGE_ROOT") +if [ -z "$STORAGE_USER" ]; then + STORAGE_USER=$([[ -z "$DEFAULT_STORAGE_USER" ]] && echo "user-data" || echo "$DEFAULT_STORAGE_USER") +fi + +if [ -z "$STORAGE_ROOT" ]; then + STORAGE_ROOT=$([[ -z "$DEFAULT_STORAGE_ROOT" ]] && echo "/home/$STORAGE_USER" || echo "$DEFAULT_STORAGE_ROOT") +fi # Create the STORAGE_USER if it not exists if [ ! $(id -u $STORAGE_USER >/dev/null 2>&1;) ]; then @@ -104,10 +109,10 @@ fi # Create the STORAGE_ROOT if it not exists if [ ! -d $STORAGE_ROOT ]; then mkdir -p $STORAGE_ROOT + echo $(setup/migrate.py --current) > $STORAGE_ROOT/mailinabox.version + chown $STORAGE_USER.$STORAGE_USER $STORAGE_ROOT/mailinabox.version fi -echo $(setup/migrate.py --current) > $STORAGE_ROOT/mailinabox.version -chown $STORAGE_USER.$STORAGE_USER $STORAGE_ROOT/mailinabox.version # Save the global options in /etc/mailinabox.conf so that standalone # tools know where to look for data.