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)
This commit is contained in:
Girish Ramakrishnan
2016-08-23 17:05:15 -07:00
parent b7869a4fdd
commit d60b386bca

View File

@@ -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