forked from ulx3s/ulx3s-toolchain
-
Notifications
You must be signed in to change notification settings - Fork 1
/
set_riscv_path.sh
executable file
·28 lines (24 loc) · 998 Bytes
/
set_riscv_path.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
#!/bin/bash
#"***************************************************************************************************"
# common initialization: set RISCV path both for current shell, as well in ~/.bashrc as needed
#"***************************************************************************************************"
# perform some version control checks on this file
./gitcheck.sh $0
# initialize some environment variables and perform some sanity checks
. ./init.sh
# we don't want tee to capture exit codes
set -o pipefail
# add to path
if [ "$(cat ~/.bashrc | grep $THIS_RISCV_PATH)" == "" ]; then
echo 'export PATH=$PATH:'$THIS_RISCV_PATH >> ~/.bashrc
echo "~/.bashrc updated with this line:"
echo 'PATH=$PATH:'$THIS_RISCV_PATH
else
echo "Found $THIS_RISCV_PATH in ~/.bashrc - path not changed."
fi
if [ "$(echo $PATH | grep $THIS_RISCV_PATH)" == "" ]; then
export PATH=$PATH:$THIS_RISCV_PATH
echo "Updated current path: $PATH"
else
echo "Path already correct. PATH=$PATH"
fi