From: Frank Brehm Date: Sat, 25 Apr 2020 15:47:57 +0000 (+0200) Subject: Continuing with bin/update-nextcloud X-Git-Tag: 0.1.2~3 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=7f6e0d40df628a57e486fe071c84fbbf6abb0976;p=pixelpark%2Fadmin-tools.git Continuing with bin/update-nextcloud --- diff --git a/bin/update-nextcloud b/bin/update-nextcloud index 667eba8..541ae94 100755 --- a/bin/update-nextcloud +++ b/bin/update-nextcloud @@ -14,6 +14,11 @@ NEW_VERSION="" OLD_VERSION="" BASEDIR=/var/www NEXTCLOUD_DIR_LINK="${BASEDIR}/nextcloud" +DOWNLOAD_DIR="/root/Downloads" +ARTIFACT="nextcloud-bla.tar.bz2" +MD5_FILE="${ARTIFACT}.md5" +SHA256_FILE="${ARTIFACT}.sha256" +DOWNLOAD_URL_BASE="https://download.nextcloud.com/server/releases" if [[ -f "${LIB_DIR}/functions.rc" ]] ; then . "${LIB_DIR}/functions.rc" @@ -91,6 +96,9 @@ get_options() { fi NEW_VERSION="${REMAINING_ARGS[1]}" + ARTIFACT="nextcloud-${NEW_VERSION}.tar.bz2" + MD5_FILE="${ARTIFACT}.md5" + SHA256_FILE="${ARTIFACT}.sha256" check_for_root @@ -125,6 +133,50 @@ get_old_version() { } +#------------------------------------------------------------------------------ +download_release() { + + cd "${DOWNLOAD_DIR}" + + local release_url="${DOWNLOAD_URL_BASE}/${ARTIFACT}" + local md5_url="${DOWNLOAD_URL_BASE}/${MD5_FILE}" + local sha256_url="${DOWNLOAD_URL_BASE}/${SHA256_FILE}" + + if [[ ! -f "${ARTIFACT}" ]] ; then + info "Downloading '${CYAN}${release_url}${NORMAL}' ..." + if [[ "${VERBOSE}" == "y" ]] ; then + wget "${release_url}" + else + wget -q "${release_url}" + fi + fi + + if [[ ! -f "${MD5_FILE}" ]] ; then + info "Downloading '${CYAN}${md5_url}${NORMAL}' ..." + if [[ "${VERBOSE}" == "y" ]] ; then + wget "${md5_url}" + else + wget -q "${md5_url}" + fi + fi + + if [[ ! -f "${SHA256_FILE}" ]] ; then + info "Downloading '${CYAN}${sha256_url}${NORMAL}' ..." + if [[ "${VERBOSE}" == "y" ]] ; then + wget "${sha256_url}" + else + wget -q "${sha256_url}" + fi + fi + + info "Checking MD5 consistence of ${ARTIFACT} ..." + md5sum -c "${MD5_FILE}" + + info "Checking SHA256 consistence of ${ARTIFACT} ..." + sha256sum -c "${SHA256_FILE}" + +} + #------------------------------------------------------------------------------ main() { @@ -132,6 +184,7 @@ main() { umask 0022 get_old_version + download_release } main "$@"