Hi Im trying to turn this bash script so it would work for macOS.
Basically what it already does it look for a disk that's attached but lsblk doesn't work for macOS and
cat /sys/class/block/$phison/device/vendor
PHP Code:
echo "Checking privileges."
if [ "$EUID" -ne 0 ] ;then
echo "You must run this script as root, try sudo."
exit
fi
disks=$(lsblk -l | awk '$6=="disk" {print $1}')
for disk in $disks
do
echo "Checking:$disk"
partitions=$(ls -d /dev/* | grep "$disk" | wc -l)
if [ "$partitions" -eq 14 ]; then
echo "Phison candidate found: $disk"
phison=$disk
fi
done
#Uncomment below to override the detection.
#phison="sde"
echo "Checking Phison..."
if [ -z "$phison" ]; then
echo "No phison candidate found."
exit
fi
echo "The Phison has been detected as: $phison ($(cat /sys/class/block/$phison/device/vendor)), is this correct? [y/N]"
read verify
if [ "$verify" != 'y' ]; then
echo "You selected N, cancelling write."
exit
fi