-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_rpi.sh
executable file
·94 lines (74 loc) · 2.42 KB
/
install_rpi.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
77
78
79
80
81
82
83
84
85
86
87
# clone repos
BRAIN_FOLDER="brain"
FACE_FOLDER="face"
# echo Deleting previous folder
# rm -rf $BRAIN_FOLDER $FACE_FOLDER
echo "Fetching repos from git"
if [ -d "$BRAIN_FOLDER" ]; then
echo "A folder named $BRAIN_FOLDER already exists"
echo "Do you wish to remove it? (y/n)"
read -r -p "" yn
case $yn in
[Yy]* ) echo "removing it..";
rm -rf $BRAIN_FOLDER;
git clone https://github.com/sebastien-lb/alfred-brain.git $BRAIN_FOLDER;
break;;
[Nn]* ) echo "Not removing it, exiting script"; exit;;
* ) echo "Please answer yes or no."; exit;;
esac
else
git clone https://github.com/sebastien-lb/alfred-brain.git $BRAIN_FOLDER
fi
if [ -d "$FACE_FOLDER" ]; then
echo "A folder named $FACE_FOLDER already exists"
echo "Do you wish to remove it? (y/n)"
read -r -p "" yn
case $yn in
[Yy]* ) echo "removing it..";
rm -rf $FACE_FOLDER;
git clone https://github.com/sebastien-lb/alfred-face.git $FACE_FOLDER;
break;;
[Nn]* ) echo "Not removing it, exiting script"; exit;;
* ) echo "Please answer yes or no."; exit;;
esac
else
git clone https://github.com/sebastien-lb/alfred-face.git $FACE_FOLDER
fi
# git clone https://github.com/sebastien-lb/alfred-brain.git $BRAIN_FOLDER
# git clone https://github.com/sebastien-lb/alfred-face.git $FACE_FOLDER
# installing deps
if node --version >/dev/null 2>&1 ; then
echo "nodejs found"
echo "version: $(node --version)"
else
echo "nodejs not found, installing it"
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt install -y nodejs
echo "version: $(node --version)"
fi
if python3 --version >/dev/null 2>&1 ; then
echo "python3 found"
echo "python3: $(python3 --version)"
else
echo "python3 not found, installing it"
sudo apt-get install -y python3
echo "python3: $(python3 --version)"
fi
install_deps() {
echo "installing repo deps"
cd $FACE_FOLDER
npm install
cd ../$BRAIN_FOLDER
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
deactivate
cd ..
}
echo "Do you want to install projet dependencies? (y/n)"
read -r -p "" yn
case $yn in
[Yy]* ) echo "installing..."; install_deps; break;;
[Nn]* ) echo "Not installing deps"; exit;;
* ) echo "Please answer yes or no."; exit;;
esac