-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·69 lines (55 loc) · 1.6 KB
/
install.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
#!/usr/bin/bash
ROOT_PICO_PATH="/media/$(whoami)/CIRCUITPY"
if [ -d "$ROOT_PICO_PATH/lib/adafruit_hid/" ]
then
echo -e "\e[0;36madafruit_hid is installed on pico ✅"
else
if [ -d "Adafruit_CircuitPython_HID/adafruit_hid" ]
then
echo -e "\e[0;32mAdafruit_CircuitPython_HID is cloned ✔️"
else
printf "\e[0;31mAdafruit_CircuitPython_HID doesn't exist. Installing "
for i in {1..5}
do
printf "."
sleep 0.1
done
git clone https://github.com/adafruit/Adafruit_CircuitPython_HID.git
echo -e "\n\e[0;32mInstalled successfully ✔️"
fi
if [ -d $ROOT_PICO_PATH ]
then
echo -e "\e[0;36mcopying the library to pico"
cp -r Adafruit_CircuitPython_HID/adafruit_hid/ "$ROOT_PICO_PATH/lib"
rm -rf Adafruit_CircuitPython_HID
else
echo -e "\e[0;31mPICO ISN'T CONNECTED!"
exit
fi
fi
echo -e "\n\e[1;36m[1]Windows\n\e[1;33m[2]Linux/Unix(default)\n\n"
echo -ne "\e[0;35mChoose your target's OS: "
read CHOICE
if [[ $CHOICE == "1" ]]
then
OS="win"
else
OS="unix"
fi
echo -e "{
\"os\": \"$OS\"\n
}" > config.json
if [ -d $ROOT_PICO_PATH ]
then
echo -e "\e[1;33m🔴 Copying the code🔴"
cp code.py $ROOT_PICO_PATH
cp commands.txt $ROOT_PICO_PATH
cp config.json $ROOT_PICO_PATH
else
echo -e "\e[1;31mPico is not connected. Please connect the bord and try again"
exit
fi
echo -e "\e[1;36mUnmounting..."
MOUNTPOINT=$(df -P $ROOT_PICO_PATH | tail -1 | cut -d' ' -f 1)
sudo eject $MOUNTPOINT
echo -e "\e[1;33m⚠⚠️⚠️⚠️\nUSB is ready to use. Make sure to press the kill switch before you plug into your main device.\n⚠⚠️⚠️⚠️"