From d60b386bcaa55ad343411484ed4e19ad8950cb91 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 23 Aug 2016 17:05:15 -0700 Subject: [PATCH] Use cloudron.conf file to determine if this is an update The installer determines if it an update based on existence of box dir. It then calls the nginx splash setup code. The splash setup code relies on the data directory being setup. Otherwise, it barfs in data/nginx. This results in a case where restarting cloudron-installer when it is unpacking the box code results in an error about being unable to write admin.conf (since the data dir gets setup only in box setup.sh). So, use cloudron.conf to determine if box was setup and running at some point (this is already used in the js code) --- installer/src/scripts/installer.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/src/scripts/installer.sh b/installer/src/scripts/installer.sh index afc9504c1..d4a4a1db8 100755 --- a/installer/src/scripts/installer.sh +++ b/installer/src/scripts/installer.sh @@ -4,12 +4,13 @@ set -eu -o pipefail readonly BOX_SRC_DIR=/home/yellowtent/box readonly DATA_DIR=/home/yellowtent/data +readonly CLOUDRON_CONF=/home/yellowtent/configs/cloudron.conf readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly json="${script_dir}/../../node_modules/.bin/json" readonly curl="curl --fail --connect-timeout 20 --retry 10 --retry-delay 2 --max-time 300" -readonly is_update=$([[ -d "${BOX_SRC_DIR}" ]] && echo "yes" || echo "no") +readonly is_update=$([[ -f "${CLOUDRON_CONF}" ]] && echo "yes" || echo "no") # create a provision file for testing. %q escapes args. %q is reused as much as necessary to satisfy $@ (echo -e "#!/bin/bash\n"; printf "%q " "${script_dir}/installer.sh" "$@") > /home/yellowtent/provision.sh