diff options
author | rinpatch <rinpatch@sdf.org> | 2020-12-20 09:59:53 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-12-20 09:59:53 +0000 |
commit | d501e55ec7fbb31d3baef548f9f773648c13896e (patch) | |
tree | 60641cdaba6d9733fa5b7e13dc880605740734e0 | |
parent | afc68a052c384adffc7040df9e1faeb2ffacf6e4 (diff) | |
parent | 5c75bfc58657e656e19c09670aad44bf6ff6d3dc (diff) | |
download | pleroma-d501e55ec7fbb31d3baef548f9f773648c13896e.tar.gz |
Merge branch 'bugfix/mastofe-install-script' into 'develop'
download-mastofe-build.sh: Proper exit when artifact is missing
Closes #2329
See merge request pleroma/pleroma!3191
-rwxr-xr-x | installation/download-mastofe-build.sh | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/installation/download-mastofe-build.sh b/installation/download-mastofe-build.sh index ee9e1c217..b8a021ef3 100755 --- a/installation/download-mastofe-build.sh +++ b/installation/download-mastofe-build.sh @@ -9,29 +9,32 @@ static_dir="instance/static" # project_branch="pleroma" # static_dir="priv/static" -if [[ ! -d "${static_dir}" ]] +if [ ! -d "${static_dir}" ] then echo "Error: ${static_dir} directory is missing, are you sure you are running this script at the root of pleroma’s repository?" exit 1 fi -last_modified="$(curl -s -I 'https://git.pleroma.social/api/v4/projects/'${project_id}'/jobs/artifacts/'${project_branch}'/download?job=build' | grep '^Last-Modified:' | cut -d: -f2-)" +last_modified="$(curl --fail -s -I 'https://git.pleroma.social/api/v4/projects/'${project_id}'/jobs/artifacts/'${project_branch}'/download?job=build' | grep '^Last-Modified:' | cut -d: -f2-)" echo "branch:${project_branch}" echo "Last-Modified:${last_modified}" artifact="mastofe.zip" -if [[ -e mastofe.timestamp ]] && [[ "${last_modified}" != "" ]] +if [ "${last_modified}x" = "x" ] then - if [[ "$(cat mastofe.timestamp)" == "${last_modified}" ]] - then - echo "MastoFE is up-to-date, exiting…" - exit 0 - fi + echo "ERROR: Couldn't get the modification date of the latest build archive, maybe it expired, exiting..." + exit 1 +fi + +if [ -e mastofe.timestamp ] && [ "$(cat mastofe.timestamp)" = "${last_modified}" ] +then + echo "MastoFE is up-to-date, exiting..." + exit 0 fi -curl -c - "https://git.pleroma.social/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=build" -o "${artifact}" || exit +curl --fail -c - "https://git.pleroma.social/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=build" -o "${artifact}" || exit # TODO: Update the emoji as well rm -fr "${static_dir}/sw.js" "${static_dir}/packs" || exit |