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"
fi
NEW_VERSION="${REMAINING_ARGS[1]}"
+ ARTIFACT="nextcloud-${NEW_VERSION}.tar.bz2"
+ MD5_FILE="${ARTIFACT}.md5"
+ SHA256_FILE="${ARTIFACT}.sha256"
check_for_root
}
+#------------------------------------------------------------------------------
+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() {
umask 0022
get_old_version
+ download_release
}
main "$@"