From 6fc3cd7bd46b18107037151863110e1c437ea198 Mon Sep 17 00:00:00 2001 From: tangzz98 Date: Tue, 15 Nov 2022 21:08:39 -0500 Subject: [PATCH] Add --gitee option --- install_macos.sh | 14 +++++++++++++- install_ubuntu.sh | 11 +++++++---- touch_env.sh | 17 +++++++++++++++-- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/install_macos.sh b/install_macos.sh index cf4b8c53..4db05aa8 100755 --- a/install_macos.sh +++ b/install_macos.sh @@ -41,4 +41,16 @@ if ! [ -x "$(command -v scons)" ]; then $RTT_PYTHON -m pip install scons fi -./touch_env.sh +if ! [ -x "$(command -v arm-none-eabi-gcc)" ]; then + echo "Installing GNU Arm Embedded Toolchain." + brew install gnu-arm-embedded +fi + +export RTT_EXEC_PATH=/usr/bin # set the default tool chain path +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 $@ diff --git a/install_ubuntu.sh b/install_ubuntu.sh index 80f8fbaa..2962e7ee 100755 --- a/install_ubuntu.sh +++ b/install_ubuntu.sh @@ -21,10 +21,13 @@ $RTT_PYTHON -m pip list > /dev/null || { sudo apt update sudo apt upgrade -y -sudo apt install gcc git libncurses5-dev scons gcc-arm-none-eabi binutils-arm-none-eabi qemu qemu-system-arm -y +sudo apt install gcc git libncurses5-dev scons gcc-arm-none-eabi binutils-arm-none-eabi gdb-multiarch qemu qemu-system-arm -y export RTT_EXEC_PATH=/usr/bin # set the default tool chain path - -wget https://raw.githubusercontent.com/RT-Thread/env/master/touch_env.sh -O touch_env.sh +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 +wget $url -O touch_env.sh chmod 777 touch_env.sh -./touch_env.sh +./touch_env.sh $@ diff --git a/touch_env.sh b/touch_env.sh index 01b243ba..17333dd8 100755 --- a/touch_env.sh +++ b/touch_env.sh @@ -3,6 +3,15 @@ DEFAULT_RTT_PACKAGE_URL=https://github.com/RT-Thread/packages.git # you can change the package url by defining RTT_PACKAGE_URL, ex: # export RTT_PACKAGE_URL=https://github.com/Varanda-Labs/packages.git +RTT_URL=https://github.com/RT-Thread/rt-thread.git +ENV_URL=https://github.com/RT-Thread/env.git + +if [ $1 ] && [ $1 = --gitee ]; then + gitee=1 + DEFAULT_RTT_PACKAGE_URL=https://gitee.com/RT-Thread-Mirror/packages.git + RTT_URL=https://gitee.com/rtthread/rt-thread.git + ENV_URL=https://gitee.com/RT-Thread-Mirror/env.git +fi env_dir=$HOME/.env if ! [ -d $env_dir ]; then @@ -13,12 +22,16 @@ if ! [ -d $env_dir ]; then mkdir $env_dir/tools git clone $package_url $env_dir/packages/packages echo 'source "$PKGS_DIR/packages/Kconfig"' > $env_dir/packages/Kconfig - git clone https://github.com/RT-Thread/env.git $env_dir/tools/scripts + git clone $ENV_URL $env_dir/tools/scripts echo 'export PATH=$HOME/.env/tools/scripts:$PATH' > $env_dir/env.sh fi RTT_ROOT=$HOME/rt-thread # you can download rt-thread to another directory by changing RTT_ROOT if ! [ -d $RTT_ROOT ]; then - git clone https://github.com/RT-Thread/rt-thread.git $RTT_ROOT + git clone $RTT_URL $RTT_ROOT + if [ $gitee ]; then + cd $RTT_ROOT + git checkout master + fi fi