|
|
|
#!/bedrock/libexec/busybox sh
|
|
|
|
|
|
|
|
. /bedrock/share/common-code
|
|
|
|
echo "Fetching latest commits from repository..."
|
|
|
|
if [ -d /bedrock/cache/bedrocklinux-userland ]; then
|
|
|
|
#less_lethal_rm_rf /bedrock/cache/bedrocklinux-userland
|
|
|
|
cd /bedrock/cache/bedrocklinux-userland
|
|
|
|
make clean
|
|
|
|
git pull
|
|
|
|
else
|
|
|
|
mkdir -p /bedrock/cache
|
|
|
|
cd /bedrock/cache
|
|
|
|
git clone https://github.com/bedrocklinux/bedrocklinux-userland
|
|
|
|
cd bedrocklinux-userland
|
|
|
|
fi
|
|
|
|
current_version="$(awk '{print$3}' </bedrock/etc/bedrock-release)"
|
|
|
|
newest_version="$(awk -F= '/^BEDROCK_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 "${newest_version}" "${current_version}"; then
|
|
|
|
echo "Building Bedrock Linux version ${newest_version}"
|
|
|
|
else
|
|
|
|
if [ ${#current_version} -lt ${#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."
|
|
|
|
exit_success
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if brl which rsync 2>&1 > /dev/null; then
|
|
|
|
make SKIPSIGN=true -j $(nproc) BEDROCK_VERSION="${newest_version}"
|
|
|
|
/bedrock/libexec/busybox sh "bedrock-linux-${newest_version}-$(uname -m).sh" --force-update
|
|
|
|
echo "Syncing to disk..."
|
|
|
|
sync
|
|
|
|
#echo "If there were no errors up to this point, then everything has gone smoothly. Ignore any following errors!"
|
|
|
|
echo "Done!"
|
|
|
|
exit_success
|
|
|
|
else
|
|
|
|
abort "rsync must be installed!"
|
|
|
|
fi
|