xref: /OK3568_Linux_fs/device/rockchip/common/scripts/check-yocto.sh (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/bash -e
2
3SCRIPTS_DIR="${SCRIPTS_DIR:-$(dirname "$(realpath "$0")")}"
4
5if ! ping google.com -c 1 -W 1 &>/dev/null; then
6	echo -e "\e[35m"
7	echo "Your network is not able to access google.com"
8	echo "Please setup a VPN to bypass the GFW."
9	echo -e "\e[0m"
10	exit 1
11fi
12
13if ! which zstd >/dev/null 2>&1; then
14	echo -e "\e[35m"
15	echo "Your zstd is missing"
16	echo "Please install it:"
17	echo "sudo apt-get install zstd"
18	echo -e "\e[0m"
19	exit 1
20fi
21
22PYTHON3_MIN_VER=$(python3 --version | cut -d'.' -f2)
23if [ "${PYTHON3_MIN_VER:-0}" -lt 6 ]; then
24	echo -e "\e[35m"
25	echo "Your python3 is too old for yocto: $(python3 --version)"
26	echo "Please update it:"
27	"$SCRIPTS_DIR/install-python3.sh"
28	echo -e "\e[0m"
29	exit 1
30fi
31
32# The yocto's e2fsprogs doesn't support new features like
33# metadata_csum_seed and orphan_file
34if grep -wq metadata_csum_seed /etc/mke2fs.conf; then
35	echo -e "\e[35m"
36	echo "Your mke2fs is too new: $(mke2fs -V 2>&1 | head -n 1)"
37	echo "Please downgrade it:"
38	"$SCRIPTS_DIR/install-e2fsprogs.sh"
39	echo -e "\e[0m"
40	exit 1
41fi
42