#!/usr/bin/env bash . /bedrock/share/common-code ver_cmp_first_newer_alpha() { # 0.7.0beta1 # ^ ^ ^^ ^^ # | | || |\ tag_ver # | | |\--+- tag # | | \----- patch # | \------- minor # \--------- major left_major="$(echo "${1}" | awk -F'[^0-9][^0-9]*' '{print$1}')" left_minor="$(echo "${1}" | awk -F'[^0-9][^0-9]*' '{print$2}')" left_patch="$(echo "${1}" | awk -F'[^0-9][^0-9]*' '{print$3}')" left_tag="$(echo "${1}" | awk -F'[0-9][0-9]*' '{print$4}')" left_tag_ver="$(echo "${1}" | awk -F'[^0-9][^0-9]*' '{print$4}')" right_major="$(echo "${2}" | awk -F'[^0-9][^0-9]*' '{print$1}')" right_minor="$(echo "${2}" | awk -F'[^0-9][^0-9]*' '{print$2}')" right_patch="$(echo "${2}" | awk -F'[^0-9][^0-9]*' '{print$3}')" right_tag="$(echo "${2}" | awk -F'[0-9][0-9]*' '{print$4}')" right_tag_ver="$(echo "${2}" | awk -F'[^0-9][^0-9]*' '{print$4}')" [ "${left_major}" -gt "${right_major}" ] && return 0 [ "${left_major}" -lt "${right_major}" ] && return 1 [ "${left_minor}" -gt "${right_minor}" ] && return 0 [ "${left_minor}" -lt "${right_minor}" ] && return 1 [ "${left_patch}" -gt "${right_patch}" ] && return 0 [ "${left_patch}" -lt "${right_patch}" ] && return 1 [ -z "${left_tag}" ] && [ -n "${right_tag}" ] && return 1 [ -n "${left_tag}" ] && [ -z "${right_tag}" ] && return 0 [ -z "${left_tag}" ] && [ -z "${right_tag}" ] && return 1 [ "${left_tag}" \> "${right_tag}" ] && return 0 [ "${left_tag}" \< "${right_tag}" ] && return 1 [ "${left_tag_ver}" -gt "${right_tag_ver}" ] && return 0 [ "${left_tag_ver}" -lt "${right_tag_ver}" ] && return 1 return 1 } if which brl > /dev/null 2>&1; then echo $(brl version) echo "Fetching latest commits from repository..." if [ -d /bedrock/cache/bedrocklinux-userland ]; then cd /bedrock/cache/bedrocklinux-userland git pull -q else mkdir -p /bedrock/cache cd /bedrock/cache git clone https://github.com/bedrocklinux/bedrocklinux-userland cd bedrocklinux-userland git checkout 0.7beta -q fi current_version="$(awk '{print$3}'