Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Perl on OSX > Re: Detecting O...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 16 Topic 999 of 1076
Post > Topic >>

Re: Detecting OS X version from perl

by mbarto@[EMAIL PROTECTED] (Michael Barto) Nov 18, 2007 at 05:40 PM

--------------020500030209070901040201
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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
  #****tage 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 sup****t "df" and "ifconfig -a"
> In article <690737E1-4461-49C0-B8BB-40182A1CF063@[EMAIL PROTECTED]
>,
>  cdevers@[EMAIL PROTECTED]
 (Chris Devers) wrote:
>
>   
>> Quick re****t:
>>
>>      $ system_profiler -detailLevel mini
>>
>> Obsessive detail re****t:
>>
>>      $ 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/

	    	mbarto@[EMAIL PROTECTED]
 <mailto:mbarto@[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.


--------------020500030209070901040201
Content-Type: multipart/related;
 boundary="------------020002070202050505060700"


--------------020002070202050505060700
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Everyone has suggested&nbsp; "system_profiler" for the hardware stuff. But
it appears that I will need do some parsing with <br>
&nbsp;$ grep -A1 'BundleShortVersion' <i class="moz-txt-slash"><span
 class="moz-txt-tag">/</span>Library/Receipts<span
class="moz-txt-tag">/</span></i>*.pkg/Contents/version.plist&nbsp;
| grep string<br>
<br>
On Solaris you have pkginfo,&nbsp; in HP you have "swlist" and Linux you
need to use RPM and do "<br>
<br>
<tt>if [ -e /bin/rpm ]; then<br>
&nbsp; #rpm based distributions:<br>
&nbsp; /bin/rpm -qiav &gt;&gt; ${DATADIR}/${HOST}.programs<br>
<br>
elif [ -e /usr/bin/apt-cache ]; then<br>
&nbsp; #APT (Advanced Packaging Tool) based distributions:<br>
&nbsp; for PKG in `apt-cache pkgnames`; do apt-cache show $PKG; done
&gt;&gt; ${DATADIR}/${HOST}.programs<br>
<br>
elif [ -d /var/db/pkg ]; then<br>
&nbsp; #****tage software management system based distributions:<br>
&nbsp; for PKG in `find /var/db/pkg/ -mindepth 2 -maxdepth 2 -printf
"%P\n"`; do<br>
&nbsp;&nbsp;&nbsp; echo "Package name: $PKG";<br>
&nbsp;&nbsp;&nbsp; if [ -f /var/db/pkg/$PKG/DESCRIPTION ]; then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "DESCRIPTION: `cat
/var/db/pkg/$PKG/DESCRIPTION`";<br>
&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cat /var/db/pkg/$PKG/*ebuild | grep
"DESCRIPTION";<br>
&nbsp;&nbsp;&nbsp; fi<br>
&nbsp;&nbsp;&nbsp; if [ -f /var/db/pkg/$PKG/HOMEPAGE ]; then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "HOMEPAGE: `cat
/var/db/pkg/$PKG/HOMEPAGE`";<br>
&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cat /var/db/pkg/$PKG/*ebuild | grep
"HOMEPAGE";<br>
&nbsp;&nbsp;&nbsp; fi<br>
&nbsp;&nbsp;&nbsp; if [ -f /var/db/pkg/$PKG/LICENSE ]; then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "LICENSE: `cat
/var/db/pkg/$PKG/LICENSE`";<br>
&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cat /var/db/pkg/$PKG/*ebuild | grep
"LICENSE";<br>
&nbsp;&nbsp;&nbsp; fi<br>
&nbsp;&nbsp;&nbsp; echo;<br>
&nbsp; done &gt;&gt; ${DATADIR}/${HOST}.programs<br>
<br>
else<br>
&nbsp;&nbsp;&nbsp; echo "Unable to retrieve package information" &gt;&gt;
${DATADIR}/${HOST}.programs<br>
<br>
fi</tt><br>
"<br>
<br>
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 sup****t "df" and "ifconfig -a" <br>
<blockquote
 cite="mid:kurtzlepirate-481C83.10492218112007@[EMAIL PROTECTED]
"
 type="cite">
  <pre wrap="">In article <a class="moz-txt-link-rfc2396E"
href="mailto:690737E1-4461-49C0-B8BB-40182A1CF063@[EMAIL PROTECTED]
">&lt;690737E1-4461-49C0-B8BB-40182A1CF063@[EMAIL PROTECTED]
>,
 <a class="moz-txt-link-abbreviated"
href="mailto:cdevers@[EMAIL PROTECTED]
">cdevers@[EMAIL PROTECTED]
> (Chris Devers)
wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">Quick re****t:

     $ system_profiler -detailLevel mini

Obsessive detail re****t:

     $ system_profiler -detailLevel full
    </pre>
  </blockquote>
  <pre wrap=""><!---->

a little more precise if use system_profiler :

    system_profiler SPSoftwareDataType|grep "System Version"


  </pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta content="text/html;" http-equiv="Content-Type">
<title></title>
<div class="moz-signature">
<div class="moz-signature">
<table border="0" cellpadding="0" cellspacing="0" width="490">
  <tbody>
    <tr>
      <td colspan="4" width="490">
      <hr color="#cccccc"></td>
    </tr>
    <tr>
      <td colspan="3" align="left" valign="top" width="390"><font
 face="arial, helvetica, sans-serif"><font size="3"><b>Michael
Barto</b><br>
      </font><font size="2">Software Architect<br>
      <br>
      </font></font></td>
      <td rowspan="2" align="right" valign="middle" width="100"><img
 alt="LogiQwest Circle" src="cid:part1.01080707.09010007@[EMAIL PROTECTED]
"
 height="80" width="81"><br>
      </td>
    </tr>
    <tr>
      <td align="left" valign="top" width="220"><font
 face="arial, helvetica, sans-serif"> <font color="#003366"
size="2">LogiQwest
Inc.<br>
16458 Bolsa Chica Street, # 15<br>
Huntington Beach, CA&nbsp;&nbsp;92649<br>
      <a
href="http://www.logiqwest.com/">http://www.logiqwest.com/</a><br>
      <br>
      </font></font></td>
      <td width="10">&nbsp;&nbsp;&nbsp;</td>
      <td align="left" valign="top" width="160"><font
 face="arial, helvetica, sans-serif"><font color="#003366" size="2"><a
 href="mailto:mbarto@[EMAIL PROTECTED]
">mbarto@[EMAIL PROTECTED]
><br>
Tel:&nbsp;&nbsp;714 377 3705<br>
Fax:&nbsp;714 840 3937<br>
Cell: 714 883 1949<br>
      <br>
      </font></font></td>
    </tr>
    <tr>
      <td colspan="4" align="right" width="490"><font color="#ff6633"
 face="arial, helvetica, sans-serif" size="2"><strong>'tis a gift to be
simple</strong></font>
      <hr color="#cccccc"> </td>
    </tr>
    <tr>
      <td colspan="4" align="center" width="490"> <font
 face="arial, helvetica, sans-serif" size="1">This e-mail may contain
LogiQwest
proprietary information and should be treated as confidential.</font>
</td>
    </tr>
  </tbody>
</table>
</div>
</div>
</div>
</body>
</html>

--------------020002070202050505060700
Content-Type: image/gif; x-mac-type="47494666"; x-mac-creator="70727677";
 name="circle.gif"
Content-Transfer-Encoding: base64
Content-ID: <part1.01080707.09010007@[EMAIL PROTECTED]
>
Content-Disposition: inline;
 filename="circle.gif"

R0lGODlhUQBQAJEAAAAAAP////1HA////yH5BAEAAAMALAAAAABRAFAAAAL/jI+pyybSopy0
OvWy3bwfmGSPR5bMGIrmaqEhpqWgM7Ocii0uggexvdm9WrsfsCLk3VLHW43ZjCp5T6qsijSu
fiKt75qcdI/cMYzaI6ZLRvP54w56Pen4FI11eZPzRtwO9wYD0jcoh9OF5aN4UhOm89hoBtHH
KEWXeLFGo3PZkeg4xxcpZqmmtfkFhllIAbgYJvRa2hqRCRn7NCuRmvXaO2jqR0p7C1trBZlc
CgWGqJInvIxMM9MKesxIjAYnDdvNO7Z74jfkWhT+TN3t3WmTGlk0PrwuiRofCmyrX1zV68/P
Xjtnun4ZIhGQ3h6DQZrdCQSRYLBYTrjRAreo2p+E/1mWhbOoB1S+cg0vhcSG0R0eT43AGStU
kOM7ayg2ntpGhqZFdio14gTyqIcxj8cQGsVFaOgHcphYaJik1BNKJy+jqlKTrY3IZxLZUep5
jpNYK/KWOlsVbRWUkDIyRlS0JunVdBQvmJ3i7+7BpfWsPjQp61tLr6YGfnqq1hxPluc2imK8
ZahfyKwkAyJWU6dZN5nH4oH6r7Bcpno150LpV7SSghm/jkWMVNastKqgYbudGdjlf8rIZpsr
e/PFxK6Q0MEabLDiiHaZzU0Xey9z5rn3HF64sHcOiJOpan3MJu/2n1k/g23+cXnk76O0N6NN
Gnn57f30cofNivB55dOvrFzXTx9ReVBWzUr7KSMMeb60ZUIdABEIj3vPeUagT3xIGF9/UUxl
31qucfUbYJWQ81SJJmpiWFP7KVghhm6JsWKLtmQ4QigyluRQbX/dyItxE/LYIGspAknSjlEU
AAA7
--------------020002070202050505060700--

--------------020500030209070901040201--
 




 16 Posts in Topic:
Detecting OS X version from perl
david@[EMAIL PROTECTED]   2007-10-14 17:29:25 
Re: Detecting OS X version from perl
emoy@[EMAIL PROTECTED] (  2007-10-14 10:45:30 
Re: Detecting OS X version from perl
david@[EMAIL PROTECTED]   2007-10-14 23:56:52 
Re: Detecting OS X version from perl
cdevers@[EMAIL PROTECTED]  2007-10-14 21:37:11 
Re: Detecting OS X version from perl
JD@[EMAIL PROTECTED] (Jo  2007-10-14 19:25:12 
Re: Detecting OS X version from perl
pudge@[EMAIL PROTECTED]   2007-10-15 17:52:04 
Re: Detecting OS X version from perl
nospam@[EMAIL PROTECTED]   2007-11-17 13:21:45 
Re: Detecting OS X version from perl
mbarto@[EMAIL PROTECTED]   2007-11-17 16:37:06 
Re: Detecting OS X version from perl
lprall@[EMAIL PROTECTED]   2007-11-17 21:36:41 
Re: Detecting OS X version from perl
cdevers@[EMAIL PROTECTED]  2007-11-17 21:46:17 
Re: Detecting OS X version from perl
kurtzlepirate@[EMAIL PROT  2007-11-18 10:49:22 
Re: Detecting OS X version from perl
mbarto@[EMAIL PROTECTED]   2007-11-18 17:40:51 
Re: Detecting OS X version from perl
brian.d.foy@[EMAIL PROTEC  2007-11-19 20:22:32 
Re: Detecting OS X version from perl
peter@[EMAIL PROTECTED]   2007-11-18 17:02:02 
Re: Detecting OS X version from perl
brian.d.foy@[EMAIL PROTEC  2007-11-18 21:22:04 
Re: Detecting OS X version from perl
cdevers@[EMAIL PROTECTED]  2007-11-20 22:21:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 0:48:31 CST 2008.