-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
186 lines (158 loc) · 7.54 KB
/
Makefile
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
all: miniforge
# all can be either "vanilla" or "miniforge"
# === AP creation ===
step0.temp:
cd ~/portiloop-software && bash create_ap.sh
touch step0.temp
# === miniforge pipeline ===
step1.temp: step0.temp
echo "--- PORTILOOP V2 INSTALLATION (Miniforge version) ---"
sudo apt-get update
sudo apt-get install -y python3-matplotlib python3-scipy python3-dev libasound2-dev
touch step1.temp
step2.temp: step1.temp
echo "Installing Miniforge..."
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh
bash Miniforge3-Linux-aarch64.sh -b
rm Miniforge3-Linux-aarch64.sh
touch step2.temp
step3.temp: step2.temp
echo "Creating portiloop virtual environment..."
~/miniforge3/bin/conda create -n portiloop python=3.7 -y
touch step3.temp
step4.temp: step3.temp
echo "Installing latest pycoral and tflite-runtime..."
wget https://github.com/google-coral/pycoral/releases/download/v2.0.0/pycoral-2.0.0-cp37-cp37m-linux_aarch64.whl
wget https://github.com/google-coral/pycoral/releases/download/v2.0.0/tflite_runtime-2.5.0.post1-cp37-cp37m-linux_aarch64.whl
~/miniforge3/envs/portiloop/bin/pip3 install tflite_runtime-2.5.0.post1-cp37-cp37m-linux_aarch64.whl
~/miniforge3/envs/portiloop/bin/pip3 install pycoral-2.0.0-cp37-cp37m-linux_aarch64.whl
rm tflite_runtime-2.5.0.post1-cp37-cp37m-linux_aarch64.whl
rm pycoral-2.0.0-cp37-cp37m-linux_aarch64.whl
touch step4.temp
step5.temp: step4.temp
echo "Installing the Portiloop software [This may take a while]"
cd ~/portiloop-software && sudo apt-get install git-lfs && git lfs pull && ~/miniforge3/envs/portiloop/bin/pip3 install notebook && ~/miniforge3/envs/portiloop/bin/pip3 install -e .
echo "Activating the widgets for the jupyter notebook..."
~/miniforge3/envs/portiloop/bin/jupyter nbextension enable --py widgetsnbextension
echo "Creating workspace directory..."
cd ~ && mkdir workspace && mkdir workspace/edf_recordings
echo "Copying files..."
cd ~/portiloop-software/portiloop/setup_files && sudo cp asound.conf /etc/asound.conf
cd ~/portiloop-software/portiloop/setup_files && sudo cp miniforge_jupyter.service /etc/systemd/system/jupyter.service
cd ~/portiloop-software/portiloop/setup_files && sudo cp 99-auto-mount.rules /etc/udev/rules.d/99-auto-mount.rules
touch step5.temp
step6.temp: step5.temp
echo "Reloading systemctl daemon..."
sudo systemctl daemon-reload
echo "Enabling jupyter service..."
sudo systemctl enable jupyter.service
touch step6.temp
step7.temp: step6.temp
echo "Playing test sound to update ALSA:"
echo "NOTE: This step may fail, just call make again when it does."
cd ~/portiloop-software/portiloop/sounds && aplay -Dplug:softvol stimulus.wav
touch step7.temp
miniforge: step7.temp
echo "Launching jupyter notebook password manager..."
~/miniforge3/envs/portiloop/bin/jupyter notebook password
rm *.temp
echo "All done! Please reboot the device."
# === Miniforge simple GUI Pipeline ===
step5_simple.temp: step4.temp
echo "Installing the Portiloop software [This may take a while]"
cd ~/portiloop-software && sudo apt-get install git-lfs && git lfs pull && ~/miniforge3/envs/portiloop/bin/pip3 install notebook && ~/miniforge3/envs/portiloop/bin/pip3 install -e .
echo "Activating the widgets for the jupyter notebook..."
~/miniforge3/envs/portiloop/bin/jupyter nbextension enable --py widgetsnbextension
echo "Creating workspace directory..."
cd ~ && mkdir workspace && mkdir workspace/edf_recordings
echo "Copying files..."
cd ~/portiloop-software/portiloop/setup_files && sudo cp asound.conf /etc/asound.conf
cd ~/portiloop-software/portiloop/setup_files && sudo cp simplegui.service /etc/systemd/system/simplegui.service
cd ~/portiloop-software/portiloop/setup_files && sudo cp 99-auto-mount.rules /etc/udev/rules.d/99-auto-mount.rules
touch step5_simple.temp
step6_simple.temp: step5_simple.temp
echo "Reloading systemctl daemon..."
sudo systemctl daemon-reload
echo "Enabling simple GUI service..."
sudo systemctl enable simplegui.service
touch step6_simple.temp
step7_simple.temp: step6_simple.temp
echo "Playing test sound to update ALSA:"
echo "NOTE: This step may fail, just call make again when it does."
cd ~/portiloop-software/portiloop/sounds && aplay -Dplug:softvol stimulus.wav
touch step7_simple.temp
miniforge_simplegui: step7_simple.temp
echo "Launching jupyter notebook password manager..."
~/miniforge3/envs/portiloop/bin/jupyter notebook password
rm *.temp
echo "All done! Please reboot the device."
# === vanilla pipeline ===
vstep1.temp: step0.temp
echo "--- PORTILOOP V2 INSTALLATION (Vanilla version) ---"
echo "The script will now update your system."
echo "Preparing apt..."
export LC_ALL="en_US.UTF-8"
sudo apt remove -y reportbug python3-reportbug
gpg --keyserver keyserver.ubuntu.com --recv-keys B53DC80D13EDEF05
gpg --export --armor B53DC80D13EDEF05 | sudo apt-key add -
echo "Updating apt..."
sudo apt-get --allow-releaseinfo-change-suite update
touch vstep1.temp
vstep2.temp: vstep1.temp
echo "Upgrading pip3..."
# sudo /usr/bin/python3 -m pip install --upgrade pip
pip3 install --upgrade pip --user
echo "pip3 is now at the following location:"
which pip3
@if [ $$(which pip3) = "/home/mendel/.local/bin/pip3" ]; then \
echo "Installed pip3 path is correct"; \
else \
echo "Installed pip3 path is incorrect, will now exit with an error."; \
echo "This is fine, please reboot the device and execute make again."; \
exit 1; \
fi
touch vstep2.temp
vstep3.temp: vstep2.temp
echo "Installing dependencies..."
sudo apt-get install -y python3-matplotlib python3-scipy python3-dev libasound2-dev jupyter-notebook jupyter
sudo apt-get install -y jupyter-nbextension-jupyter-js-widgets
touch vstep3.temp
vstep4.temp: vstep3.temp
echo "Installing latest pycoral and tflite-runtime..."
wget https://github.com/google-coral/pycoral/releases/download/v2.0.0/pycoral-2.0.0-cp37-cp37m-linux_aarch64.whl
wget https://github.com/google-coral/pycoral/releases/download/v2.0.0/tflite_runtime-2.5.0.post1-cp37-cp37m-linux_aarch64.whl
pip3 install tflite_runtime-2.5.0.post1-cp37-cp37m-linux_aarch64.whl --user
pip3 install pycoral-2.0.0-cp37-cp37m-linux_aarch64.whl --user
rm tflite_runtime-2.5.0.post1-cp37-cp37m-linux_aarch64.whl
rm pycoral-2.0.0-cp37-cp37m-linux_aarch64.whl
touch vstep4.temp
vstep5.temp: vstep4.temp
echo "Installing the Portiloop software [This may take a while]"
cd ~/portiloop-software && sudo apt-get install git-lfs && git lfs pull && pip3 install -e . --user
echo "Activating the widgets for the jupyter notebook..."
jupyter nbextension enable --py widgetsnbextension
echo "Creating workspace directory..."
cd ~ && mkdir workspace && mkdir workspace/edf_recordings
echo "Copying files..."
cd ~/portiloop-software/portiloop/setup_files && sudo cp asound.conf /etc/asound.conf
cd ~/portiloop-software/portiloop/setup_files && sudo cp jupyter.service /etc/systemd/system/jupyter.service
cd ~/portiloop-software/portiloop/setup_files && sudo cp 99-auto-mount.rules /etc/udev/rules.d/99-auto-mount.rules
touch vstep5.temp
vstep6.temp: vstep5.temp
echo "Reloading systemctl daemon..."
sudo systemctl daemon-reload
echo "Enabling jupyter service..."
sudo systemctl enable jupyter.service
touch vstep6.temp
vstep7.temp: vstep6.temp
echo "Playing test sound to update ALSA:"
echo "NOTE: This step may fail, just call make again when it does."
cd ~/portiloop-software/portiloop/sounds && aplay -Dplug:softvol stimulus.wav
touch vstep7.temp
vanilla: vstep7.temp
echo "Launching jupyter notebook password manager..."
jupyter notebook password
rm *.temp
echo "All done! Please reboot the device."
clean:
rm *.temp