home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.misc
- Path: sparky!uunet!destroyer!gatech!purdue!mentor.cc.purdue.edu!news
- From: ab@nova.cc.purdue.edu (Allen B)
- Subject: Re: Distinguishing 3.0 binaries
- Message-ID: <BxKMsL.2rv@mentor.cc.purdue.edu>
- Keywords: cool sh script
- Sender: news@mentor.cc.purdue.edu (USENET News)
- Organization: Purdue University
- References: <BxKBs1.3yH@mentor.cc.purdue.edu>
- Date: Wed, 11 Nov 1992 21:38:44 GMT
- Lines: 89
-
- Earlier, I said:
- > I received several responses that all said about the same
- > thing. Since I have a fantastic collection of old
- > NeXTstep releases, I will post a sh script here shortly
- > that identifies binaries of as many as I can manage. This
- > should be fun!
-
- Here's the script. It's also on sonata as
- pub/next/lore/version. I'll add some more error
- checking and junk later. Make sure you set the modes right
- on it (readable and executable for whomever).
-
- To use, just give it filenames of programs you want to
- check, like "version /LocalApps/*" and it does the rest.
- I'm no sh wizard, but I do OK. :-)
-
- Thanks for the tips. I rummaged through my morgue and made
- it a little more robust. :-)
-
- #!/bin/sh
- #
- # version Find the version of the OS a program was created under
- #
- # by Allen B (ab@nova.cc.purdue.edu) with help from the net.
- #
- # Uses otool to check version numbers on libraries, then checks those
- # against the versions of the OS I had handy. I've got quite a morgue
- # here, but I don't have a lot of 2.x variants.
- #
- # If it ever says "Version n" instead of printing the OS level, send
- # the version number and OS name to me and I'll fix it.
-
- for PROGRAM
- do
- BINARY=`echo $PROGRAM | sed "s,\([^/]*\)\.app,\1.app/\1,"`
-
- if [ "$BINARY" = "$PROGRAM" ]
- then
- TYPE="executable"
- else
- TYPE="App"
- fi
-
- VERSION=`/bin/otool -L "$BINARY" | grep libsys_s...shlib | sed "s/.*
- \([0-9][0-9]*\).*/\1/"`
- if [ ! "$VERSION" ]
- then
- VERSION=`/bin/otool -L "$BINARY" | grep libappkit | sed "s/.*
- \([0-9][0-9]*\).*/\1/"`
- fi
-
- # OS="I have no idea what kind of"
- OS="Version $VERSION"
- case "$VERSION" in
- 14) # 0.8a26e0.8
- OS="NeXTStep 0.8"
- ;;
- 1) # 0.9.49:0.83
- OS="NeXTStep 0.9"
- ;;
- 10) # 1.0.63 (also labeled 0.981 physically)
- OS="NeXTStep 0.981"
- ;;
- 12) # 1.0.63 (also labeled 0.981 physically)
- OS="NeXTStep 0.981"
- ;;
- 13) # 1.0.63/1.067 (also labeled 0.981/0.991 physically)
- OS="NeXTStep 0.991"
- ;;
- 17) # 1.067 (also labeled 0.991 physically)
- OS="NeXTStep 0.991"
- ;;
- 18) # 1.0.68
- OS="NextStep 1.0"
- ;;
- 19) # 1.0.68
- OS="NextStep 1.0"
- ;;
- 44) # Whatever I was using
- OS="NeXTstep 2.x"
- ;;
- 55) # 3.0 CD Distribution
- OS="NeXTSTEP 3.0"
- ;;
- esac
-
- # echo "$PROGRAM: $OS ($VERSION) $TYPE"
- echo "$PROGRAM: $OS $TYPE"
- done
-