Re: Detecting OS X version from perl
[email protected] (Michael Barto)
| Newsgroups | perl.macosx |
|---|---|
| Organization | LogiQwest |
| Message-ID | <[email protected]> |
Everyone has suggested "system_profiler" for the hardware stuff. But it
appears that I will need do some parsing with
$ grep -A1 'BundleShortVersion'
/Library/Receipts/*.pkg/Contents/version.plist | grep string
On Solaris you have pkginfo, in HP you have "swlist" and Linux you need
to use RPM and do "
if [ -e /bin/rpm ]; then
#rpm based distributions:
/bin/rpm -qiav >> ${DATADIR}/${HOST}.programs
elif [ -e /usr/bin/apt-cache ]; then
#APT (Advanced Packaging Tool) based distributions:
for PKG in `apt-cache pkgnames`; do apt-cache show $PKG; done >>
${DATADIR}/${HOST}.programs
elif [ -d /var/db/pkg ]; then
#Portage software management system based distributions:
for PKG in `find /var/db/pkg/ -mindepth 2 -maxdepth 2 -printf "%P\n"`; do
echo "Package name: $PKG";
if [ -f /var/db/pkg/$PKG/DESCRIPTION ]; then
echo "DESCRIPTION: `cat /var/db/pkg/$PKG/DESCRIPTION`";
else
cat /var/db/pkg/$PKG/*ebuild | grep "DESCRIPTION";
fi
if [ -f /var/db/pkg/$PKG/HOMEPAGE ]; then
echo "HOMEPAGE: `cat /var/db/pkg/$PKG/HOMEPAGE`";
else
cat /var/db/pkg/$PKG/*ebuild | grep "HOMEPAGE";
fi
if [ -f /var/db/pkg/$PKG/LICENSE ]; then
echo "LICENSE: `cat /var/db/pkg/$PKG/LICENSE`";
else
cat /var/db/pkg/$PKG/*ebuild | grep "LICENSE";
fi
echo;
done >> ${DATADIR}/${HOST}.programs
else
echo "Unable to retrieve package information" >>
${DATADIR}/${HOST}.programs
fi
"
Seems not a simple solution for MacOSX for system managers who use
script to collection information about Unix systems. On the other hand.
MacOSX does support "df" and "ifconfig -a"
> In article <[email protected]>,
> [email protected] (Chris Devers) wrote:
>
>
>> Quick report:
>>
>> $ system_profiler -detailLevel mini
>>
>> Obsessive detail report:
>>
>> $ system_profiler -detailLevel full
>>
>
>
> a little more precise if use system_profiler :
>
> system_profiler SPSoftwareDataType|grep "System Version"
>
>
>
--
------------------------------------------------------------------------
*Michael Barto*
Software Architect
LogiQwest Circle
LogiQwest Inc.
16458 Bolsa Chica Street, # 15
Huntington Beach, CA 92649
http://www.logiqwest.com/
[email protected] <mailto:[email protected]>
Tel: 714 377 3705
Fax: 714 840 3937
Cell: 714 883 1949
*'tis a gift to be simple*
------------------------------------------------------------------------
This e-mail may contain LogiQwest proprietary information and should be
treated as confidential.