-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Draft] env installation script for linux/macos
- Loading branch information
1 parent
6494848
commit c060a8e
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/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 gcc)" ]; then | ||
echo "Installing gcc." | ||
sudo apt install gcc | ||
fi | ||
|
||
if ! [ -x "$(command -v git)" ]; then | ||
echo "Installing git." | ||
sudo apt install git | ||
fi | ||
|
||
if [ $(dpkg-query -W -f='${Status}' libncurses5-dev 2>/dev/null | grep -c "ok installed") -eq 0 ]; then | ||
echo "Installing ncurses." | ||
sudo apt install libncurses5-dev | ||
fi | ||
|
||
$RTT_PYTHON -m pip list > /dev/null || { | ||
echo "Installing pip." | ||
sudo apt install python3-pip | ||
} | ||
|
||
if ! [ -x "$(command -v scons)" ]; then | ||
echo "Installing scons." | ||
sudo apt install scons | ||
fi | ||
|
||
./touch_env.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/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 | ||
|
||
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 | ||
|
||
./touch_env.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
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 | ||
|
||
env_dir=$HOME/.env | ||
if ! [ -d $env_dir ]; then | ||
echo 1 | ||
package_url=${RTT_PACKAGE_URL:-$DEFAULT_RTT_PACKAGE_URL} | ||
mkdir $env_dir | ||
mkdir $env_dir/local_pkgs | ||
mkdir $env_dir/packages | ||
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 | ||
echo 'export PATH=$HOME/.env/tools/scripts:$PATH' > $env_dir/env.sh | ||
fi |