GPG verify releases

Part of #189
This commit is contained in:
Girish Ramakrishnan
2018-08-01 15:38:40 -07:00
parent 5bd7cd6749
commit 621d00a5c6
5 changed files with 167 additions and 66 deletions

View File

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