Alternative to udev functionality on OSX

Posted by S1syphus on Stack Overflow See other posts from Stack Overflow or by S1syphus
Published on 2010-04-08T14:07:10Z Indexed on 2010/04/08 16:43 UTC
Read the original article Hit count: 452

Filed under:
|
|

I'm trying to create a custom file/check in check out script for external hardrives, however part of the script is from a Linux machine, which I have tested works fine, but uses udevinfo, OS X doesn't have udev, so is there anything that offers the same functionality?

#!/bin/bash
declare -a EXTERNAL_DISKS
declare -a INTERNAL_DISKS

for disk in /dev/[sh]d[a-z]; do
     eval `udevinfo -q env -n $disk`
     [ "$ID_BUS" = "usb" ] && EXTERNAL_DISKS=( ${EXTERNAL_DISKS[@]} $disk )
     [ "$ID_BUS" = "scsi" ] && INTERNAL_DISKS=( ${INTERNAL_DISKS[@]} $disk )
 done

 echo "Internal disks: ${INTERNAL_DISKS[@]}"
 echo "External disks: ${EXTERNAL_DISKS[@]}"

Anybody know any alternatives? Or a way this could be accomplished on OSX using bash?

© Stack Overflow or respective owner

Related posts about osx

Related posts about bash