!/bin/sh
echo "<result>$(diskutil info / | awk -F': ' '/File System/{print $NF}' | xargs)</result>"
Using diskutil
will give you various results across models and different hardware configurations. The only true way to get it, is to just probe system_profiler
, which is a slow as far as binaries go, but it is one of the few ways to always get guaranteed results.
#!/usr/bin/python
import subprocess
import plistlib
cmd = ['system_profiler', 'SPStorageDataType', '-xml']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate()
data = plistlib.readPlistFromString(out)[0]['_items']
print(data[0]['file_system'])
Both scripts did the job. Thanks for your help!