Hi guys im not sure if its possible to create a script to eject a usb device if its not encrypted.
i have tried using bits from here
https://jamfnation.jamfsoftware.com/discussion.html?id=5924
#!/bin/bash
#Get the disk name
for disk in $(diskutil list | awk '/disk[1-9]s/{ print $NF }' | grep -v /dev); do
if [[ $(diskutil info $disk | awk '/Protocol/{ print $2 }') == "USB" ]]; then
echo "Device $disk is a USB removable disk"
diskName=$(diskutil info $disk | awk -F"/" '/Mount Point/{ print $NF }')
# Eject the disk
diskutil unmountDisk $diskName
fi
done
If i use diskutil cs list | grep AES-XTS this finds the encrypted part, but i don't know how to reference the usb drive and check against it.
Does any one have an idea if this is possible?