-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
46 lines (37 loc) · 970 Bytes
/
setup
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
#!bin/sh
BW='\033[1;37m' # Bold white
NC='\033[0m' # No colour
EXPORT_COMMENT="# Add unsw term to path"
EXPORT_COMMAND="export PATH=\$PATH:$(pwd)"
bold_echo() {
echo "${BW}$1${NC}"
}
# Setup up requirements and script execute permissions
bold_echo "Setting up virtual environment"
python3 -m venv env
source env/bin/activate
bold_echo "Installing requirements"
pip3 install -r requirements.txt
bold_echo "Adding execute permissions for script"
chmod +x unsw_term
# Add directory to path
bold_echo "Adding to path"
if ! [[ $PATH =~ $PWD ]] ;
then
export PATH=$PATH:${pwd}
fi
shells=(~/.bashrc ~/.zshrc)
for shell in ${shells[@]};
do
if ! grep -xq "$EXPORT_COMMAND" "$shell" ;
then
bold_echo "Adding export path to ${shell}"
echo $EXPORT_COMMENT >> $shell
echo $EXPORT_COMMAND >> $shell
echo >> $shell
fi
done
bold_echo "Complete!"
# Unset variables
unset BW NC EXPORT_COMMAND EXPORT_COMMENT
unset -f bold_echo