I would like to run a script to program my Balena Fin boards instead of using Balena Etcher, on a Mac. If I use Balena Etcher to scan for Compute modules, then a drive is created (/dev/disk2) that I can use in my script to program it. I can see this drive (/dev/disk2) when I run the “diskutil list” command. My script simply runs:
balena local flash <image_path> --drive <drive_path> --yes
where <drive_path> is /dev/disk2. This works great.
However, once I unplug the USB cable from the Balena Fin, the drive is deleted. If I connect the USB cable to a new Balena Fin, the drive is not automatically created again, so I am unable to program the Fin with this script. Running “diskutil list” does not show the /dev/disk2 drive. If I open Balena Etcher and scan for compute modules, Balena Etcher can discover the Compute module, and the /dev/disk2 drive is created again during Balena Etcher’s scan. However, I really don’t want to run Balena Etcher every time I connect the USB cable to a new Balena Fin.
Is there a command I can add to my script that can detect a new Balena Fin, and/or mount it to /dev/disk2, or is there any way to initiate a system scan to discover the Fin on /dev/disk2 so I don’t have to run Balena Etcher to create the drive? I don’t know enough about filesystems to know the right approach to solve this problem and appreciate any suggestions.