From 24953ab91207f3da1d36050e8da86d1311e69141 Mon Sep 17 00:00:00 2001 From: EliterScripts Date: Tue, 9 Apr 2019 22:56:52 -0700 Subject: [PATCH] fixed MIAB agreement config from writing --- setup/functions.sh | 22 ++++++++-------------- setup/questions.sh | 8 ++++++-- setup/start.sh | 3 +++ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/setup/functions.sh b/setup/functions.sh index bc4abb8d..400ab2eb 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -269,20 +269,14 @@ function set_config_agreed { set_storage_user; set_storage_root; - if [ -z "${I_AGREE_MAILINABOX:-}" ]; then - if [ ! -d $STORAGE_ROOT ]; then - return 1 - fi - if [ ! -f $STORAGE_ROOT/settings.yaml ]; then - return 1 - fi - local current_directory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - local yaml_agreed=$(python set "${current_directory}"/checkagree.py "${STORAGE_ROOT}/settings.yaml") - if [ "$yaml_agreed" -eq "true"]; then - return 0 - fi - return 1 - else + if [ ! -d $STORAGE_ROOT ]; then + mkdir -p $STORAGE_ROOT + fi + + local current_directory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + local yaml_agreed=$(python set "${current_directory}"/checkagree.py "${STORAGE_ROOT}/settings.yaml") + if [ "$yaml_agreed" == "true"]; then return 0 fi + return 1 } \ No newline at end of file diff --git a/setup/questions.sh b/setup/questions.sh index 8053e89b..c72f40dd 100644 --- a/setup/questions.sh +++ b/setup/questions.sh @@ -43,11 +43,11 @@ if [ -z "${NONINTERACTIVE:-}" ]; then fi fi - I_AGREE_MAILINABOX=$(/bin/true) + I_AGREE_MAILINABOX="$(/bin/true)" else if [ $(check_config_agreed; echo $?) -eq "0" ]; then - I_AGREE_MAILINABOX=$(/bin/true) + I_AGREE_MAILINABOX="$(/bin/true)" fi #This is so a user can programmatically agree to our legal notice @@ -241,3 +241,7 @@ if [ -f /usr/bin/git ] && [ -d .git ]; then echo "Mail-in-a-Box Version: " $(git describe) fi echo + +function get_I_AGREE_MAILINABOX(){ + echo "$I_AGREE_MAILINABOX" +} \ No newline at end of file diff --git a/setup/start.sh b/setup/start.sh index 3794363a..09337453 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -57,6 +57,9 @@ chmod +x /usr/local/bin/mailinabox # STORAGE_ROOT. source setup/questions.sh + +I_AGREE_MAILINABOX=$(check_config_agreed; echo $?) + if [ -z "${I_AGREE_MAILINABOX:-}" ]; then echo "ERROR: You must agree to Mail-in-a-Box's Legal Notice. You can either:" echo "run this in interactive mode; or"