forked from RT-Thread/env
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_macos.sh
executable file
·76 lines (61 loc) · 1.75 KB
/
install_macos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
RTT_PYTHON=python
for p_cmd in python3 python; do
$p_cmd --version >/dev/null 2>&1 || continue
RTT_PYTHON=$p_cmd
break
done
$RTT_PYTHON --version 2 >/dev/null || {
echo "Python not installed. Please install Python before running the installation script."
exit 1
}
if ! [ -x "$(command -v brew)" ]; then
echo "Installing Homebrew."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew update
brew upgrade
if ! [ -x "$(command -v git)" ]; then
echo "Installing git."
brew install git
fi
brew list ncurses >/dev/null || {
echo "Installing ncurses."
brew install ncurses
}
$RTT_PYTHON -m pip list >/dev/null || {
echo "Installing pip."
$RTT_PYTHON -m ensurepip --upgrade
}
if ! [ -x "$(command -v scons)" ]; then
echo "Installing scons."
$RTT_PYTHON -m pip install scons
fi
if ! [ -x "$(command -v tqdm)" ]; then
echo "Installing tqdm."
$RTT_PYTHON -m pip install tqdm
fi
if ! [ -x "$(command -v kconfiglib)" ]; then
echo "Installing kconfiglib."
$RTT_PYTHON -m pip install kconfiglib
fi
if ! [ -x "$(command -v pyocd)" ]; then
echo "Installing pyocd."
$RTT_PYTHON -m pip install -U pyocd
fi
if ! [[ $($RTT_PYTHON -m pip list | grep requests) ]]; then
echo "Installing requests."
$RTT_PYTHON -m pip install requests
fi
if ! [ -x "$(command -v arm-none-eabi-gcc)" ]; then
echo "Installing GNU Arm Embedded Toolchain."
brew install gnu-arm-embedded
fi
url=https://raw.githubusercontent.com/RT-Thread/env/master/touch_env.sh
if [ $1 ] && [ $1 = --gitee ]; then
url=https://gitee.com/RT-Thread-Mirror/env/raw/master/touch_env.sh
fi
curl $url -o touch_env.sh
chmod 777 touch_env.sh
./touch_env.sh $@
rm touch_env.sh