Update 'bedrock-linux-99.99.99-x86_64.sh'

master
shark 5 years ago
parent 43b248f867
commit de28b4ec45

@ -1,45 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
. /bedrock/share/common-code . /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 if which brl > /dev/null 2>&1; then
echo $(brl version)
echo "Fetching latest commits from repository..." echo "Fetching latest commits from repository..."
if [ -d /bedrock/cache/bedrocklinux-userland ]; then if [ -d /bedrock/cache/bedrocklinux-userland ]; then
cd /bedrock/cache/bedrocklinux-userland cd /bedrock/cache/bedrocklinux-userland
@ -53,20 +16,25 @@ if which brl > /dev/null 2>&1; then
fi fi
current_version="$(awk '{print$3}' </bedrock/etc/bedrock-release)" 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") newest_version=$(awk -F= '/^VERSION=/{print$2}' Makefile | sed 's/[a-z].*$//')-git-$(git log | grep -c "^commit")
echo Current Version: "${current_version}" echo "Current Version: ${current_version}"
echo Newest Version: "${newest_version}" echo "Newest Version: ${newest_version}"
if ver_cmp_first_newer_alpha ${current_version} ${newest_version}; then
if ver_cmp_first_newer ${current_version} ${newest_version}; then
if [ ${#current_version} -le ${#newest_version} ]; then
echo "Building for the first time. Building Bedrock Linux version ${newest_version}"
else
echo "Up to date with the latest commit, nothing to do." echo "Up to date with the latest commit, nothing to do."
exit exit
fi
else else
echo "Building Bedrock Linux version ${newest_version}" echo "Building Bedrock Linux version ${newest_version}"
fi fi
# Start the build process # Start the build process
make clean
make SKIPSIGN=true -j $(nproc) VERSION="${newest_version}" make SKIPSIGN=true -j $(nproc) VERSION="${newest_version}"
./bedrock-linux-${newest_version}-$(uname -m).sh --update ./bedrock-linux-${newest_version}-$(uname -m).sh --update
# Maybe clean up here in the future
else else
echo "Bedrock Linux is not installed!" echo "Bedrock Linux is not installed!"
return return
fi fi

Loading…
Cancel
Save