@@ -9,7 +9,6 @@ fi
|
||||
|
||||
readonly UPDATER_SERVICE="cloudron-updater"
|
||||
readonly DATA_FILE="/root/cloudron-update-data.json"
|
||||
readonly curl="curl --fail --connect-timeout 20 --retry 10 --retry-delay 2 --max-time 300"
|
||||
|
||||
if [[ $# == 1 && "$1" == "--check" ]]; then
|
||||
echo "OK"
|
||||
@@ -17,30 +16,16 @@ if [[ $# == 1 && "$1" == "--check" ]]; then
|
||||
fi
|
||||
|
||||
if [[ $# != 2 ]]; then
|
||||
echo "sourceTarballUrl and data arguments required"
|
||||
echo "sourceDir and data arguments required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly sourceTarballUrl="${1}"
|
||||
readonly source_dir="${1}"
|
||||
readonly data="${2}"
|
||||
|
||||
echo "Updating Cloudron with ${sourceTarballUrl}"
|
||||
echo "Updating Cloudron with ${source_dir}"
|
||||
|
||||
# TODO: pre-download tarball
|
||||
box_src_tmp_dir=$(mktemp -dt box-src-XXXXXX)
|
||||
readonly installer_path="${box_src_tmp_dir}/scripts/installer.sh"
|
||||
echo "Downloading box code from ${sourceTarballUrl} to ${box_src_tmp_dir}"
|
||||
|
||||
for try in `seq 1 10`; do
|
||||
if $curl -L "${sourceTarballUrl}" | tar -zxf - -C "${box_src_tmp_dir}"; then break; fi
|
||||
echo "Failed to download source tarball, trying again"
|
||||
sleep 5
|
||||
done
|
||||
|
||||
if [[ ${try} -eq 10 ]]; then
|
||||
echo "Release tarball download failed"
|
||||
exit 3
|
||||
fi
|
||||
readonly installer_path="${source_dir}/scripts/installer.sh"
|
||||
|
||||
echo "=> reset service ${UPDATER_SERVICE} status in case it failed"
|
||||
if systemctl reset-failed "${UPDATER_SERVICE}"; then
|
||||
|
||||
Reference in New Issue
Block a user