23 lines
555 B
Bash
23 lines
555 B
Bash
#!/bin/bash
|
|
|
|
echo "Mounting the disk"
|
|
# mount the disk
|
|
diskpath=$(udisksctl mount -b /dev/disk/by-label/CIRCUITPY)
|
|
echo "Disk mounted"
|
|
|
|
# Change to the mounted folder
|
|
cd $(echo $diskpath | awk '{print $4}')
|
|
|
|
echo "Backing up code to ~/Documents/Projects/light_control/backup.py"
|
|
# Backing up code
|
|
cp code.py ~/Documents/Projects/light_control/backup.py
|
|
|
|
echo "Replacing code"
|
|
# Replacing code
|
|
cp -f ~/Documents/Projects/light_control/code.py code.py
|
|
|
|
echo "Code uploaded, unmounting circuitpy"
|
|
sync
|
|
cd ~
|
|
|
|
udisksctl unmount -b /dev/disk/by-label/CIRCUITPY |