forked from dbisu/pico-ducky
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
50 lines (45 loc) · 1.73 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
#!/bin/bash
# Check if wget is installed
command -v wget >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Wget is installed. You're good to go!"
else
echo "Wget is not installed on your system."
echo "Please install wget and try again."
fi
check_path_existence() {
if [ -d "$1" ]; then
echo "Found path: $1"
return 0
else
return 1
fi
}
if check_path_existence "/media/CIRCUITPY"; then
target="/media/CIRCUITPY"
echo "Found path: /media/CIRCUITPY"
elif check_path_existence "/Volumes/CIRCUITPY"; then
target="/Volumes/CIRCUITPY"
echo "Found path: /Volumes/CIRCUITPY"
else
echo "Neither path /media/CIRCUITPY nor /Volumes/CIRCUITPY exists."
read -p "Please enter the path to your CIRCUITPY volume: " target
fi
echo "Downloading Adafruit CircuitPython libraries..."
url="https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/download/20230416/adafruit-circuitpython-bundle-8.x-mpy-20230416.zip"
wget "${url}"
echo "Unzipping Adafruit CircuitPython libraries..."
unzip "adafruit-circuitpython-bundle-8.x-mpy-20230416.zip"
echo "Installing libraries to CIRCUITPY..."
# Delete the test folder if it exists.
rm -rf "${target}/lib" || true
rm -rf "${target}/scripts" || true
mkdir -p "${target}/lib"
cp adafruit-circuitpython-bundle-8.x-mpy-20230416/lib/adafruit_ticks.mpy "${target}/lib/"
cp adafruit-circuitpython-bundle-8.x-mpy-20230416/lib/adafruit_debouncer.mpy "${target}/lib/"
cp -r adafruit-circuitpython-bundle-8.x-mpy-20230416/lib/adafruit_display_text "${target}/lib/"
cp -r adafruit-circuitpython-bundle-8.x-mpy-20230416/lib/adafruit_hid "${target}/lib/"
echo "Installing Rubber Ducky to CIRCUITPY..."
cp -f src/*.py "${target}/"
echo "Installing Rubber Ducky scripts CIRCUITPY..."
cp -r scripts "${target}/"