You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bedrock-git/bedrock-linux-master-99.99....

73 lines
2.7 KiB
Bash

#!/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}' </bedrock/etc/bedrock-release)"
newest_version=$(awk -F= '/^VERSION=/{print$2}' Makefile | sed 's/[a-z].*$//')-git-$(git log | grep -c "^commit")
echo Current Version: "${current_version}"
echo Newest Version: "${newest_version}"
if ver_cmp_first_newer_alpha ${current_version} ${newest_version}; then
echo "Up to date with the latest commit, nothing to do."
exit
else
echo "Building Bedrock Linux version ${newest_version}"
fi
# Start the build process
make SKIPSIGN=true -j $(nproc) VERSION="${newest_version}"
./bedrock-linux-${newest_version}-$(uname -m).sh --update
else
echo "Bedrock Linux is not installed!"
return
fi