Fetch values from plist file on Linux
libplist seems to meet your requirements. There is a Ubuntu package name "libplist-utils" that you could reference in your script:
Description-en: Apple property list converter This package containt tools to convert Apple property list files from binary to XML and vice-versa. It's part of the libimobiledevice stack, providing access to iDevices (iPod, iPhone, iPad ...).
Homepage: http://www.libimobiledevice.org/
Install command:
apt-get install libplist-utils
Usage example:
plistutil -i Info.plist
Since .plist
files are already XML (or can be easily converted) you just need something to decode the XML.
For that use xml2
:
$ cat com.apple.systemsound.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.sound.beep.volume</key>
<real>1</real>
</dict>
</plist>
$ xml2 < com.apple.systemsound.plist
/plist/@version=1.0
/plist/dict/key=com.apple.sound.beep.volume
/plist/dict/real=1
$
You should be able to figure out the rest.
Or for Perl, use XML::Simple;
(see perldoc
for more) to put the XML data structure into a hash.