Results 1 to 7 of 7

Thread: Identifying the OS

  1. #1
    dizwell NNTP User

    Default Identifying the OS

    I have a script I want to run only on openSUSE 11.1. So I include this bit of code in the script:

    Code:
    VERCHECK=`grep 11.1 /etc/SuSE-brand > /dev/null; echo $?`
    if [ "$VERCHECK" -eq "1" ]; 
      exit 1
    fi
    ...so the script exits if the string "11.1" is NOT found in that file.

    Two questions. The SUSE-brand file actually contains the contents

    openSUSE
    VERSION = 11.1


    How would one go about checking for both lines in a single test. I know, in other words that I could grep for "openSUSE" and then, if that succeeds, nest another grep for "11.1". But if I didn't want to nest grep tests?

    Secondly, and a bit cheekily I realise, but what are the *exact* contents of the equivalent file on Suse Enterprise Linux, please (if anyone here knows, of course!)?

    Thanks in advance for any help offered.

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: Identifying the OS

    You could instead look at /etc/SuSE-release which contains this:

    openSUSE 11.1 (x86_64)
    VERSION = 11.1
    on a 64-bit machine for example. Both the distro and version are on the first line.

  3. #3
    dizwell NNTP User

    Default Re: Identifying the OS

    Wonderful advice. I looked in the /etc directory until my eyes went square... and they obviously did! Thank you for that.

    Do you, by any chance, happen to know the contents of the SLES equivalent of that file?? No worries if not: you've already helped alot!

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: Identifying the OS

    Ask in the SLES forum perhaps?

  5. #5

    Default Re: Identifying the OS

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    /etc/SuSE-release from SLES 10 SP2 x86_32:

    ab@mybox0:~> cat /etc/SuSE-release
    SUSE Linux Enterprise Server 10 (i586)
    VERSION = 10
    PATCHLEVEL = 2

    and from SLES 11 x86_64

    ab@mybox1:~> cat /etc/SuSE-release
    SUSE Linux Enterprise Server 11 (x86_64)
    VERSION = 11
    PATCHLEVEL = 0

    ab@mybox1:~> cat /etc/SuSE-brand
    SLES
    VERSION = 11
    CO-BRANDS = SLE openSUSE

    But yes, this is a good question for the SLES forums specifically in the
    future.

    Good luck.





    ken yap wrote:
    > Ask in the SLES forum perhaps?
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJKoG2oAAoJEF+XTK08PnB5NT4P/im757CcWfZdi36lHucU6XtG
    ooGH2ah2hax8UQzlU+lGp0F2ZkdiTBscpJT1jEkTxYXHKZjSzxhaUZvu10FRuUzs
    zb3TIC8JHmFOB2pOGrk5hati2dlXQQ4e+eCRMqIfpSidNISqkHf7VJAJosLx0VZX
    OZhB61/a8RgNjpz9Y11nI8sj7AtTpJ6BbxkpsP/BUhWikcqLpujdTvuEILObDM40
    wql++Z/eq4qNMynPrEb4/WHTSB8wwxed/ZCNA7SRwbUUFiG47QR4y/xeP8SjiFNo
    lT9NIclr/bDneJjI1LkDoP6rDmwQqdsgrvNaO6kuHQwaeFegrZqBAag63EjsBkOs
    XNwvT2RDSmL7kUodFl318eVcNLpNJhjdJj3BbAQZ/sKZzHfHPx+NaAozXGA45M61
    dJoc/YtejToWLFG6NJuBBqzE8B+95vzvHnoNd3ntxNFJxN9FJlXJRlWQknc+BoV6
    8q43sNuF0BSxQH7QnSHmgSNQPZlMMw5D+HldgYLoB+f48aRCN9xJd/W+j3lZ2i+T
    7+pWvWBeO44BRe6XjeGm67MnQeG81vOHjT6j3vUNJnOo3mrgoUndwF1LuVYCfC6O
    /ccnP4xHdFvplaiawixKtsXKRXsRtG+KNTBmo7Z9dRdpX7yihRdm823WngkbCG7K
    Bg7UGUs24cJSgEenIZhK
    =cjNK
    -----END PGP SIGNATURE-----

  6. #6
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,325
    Blog Entries
    15

    Default Re: Identifying the OS

    Quote Originally Posted by ab@novell.com
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    /etc/SuSE-release from SLES 10 SP2 x86_32:

    ab@mybox0:~> cat /etc/SuSE-release
    SUSE Linux Enterprise Server 10 (i586)
    VERSION = 10
    PATCHLEVEL = 2

    and from SLES 11 x86_64

    ab@mybox1:~> cat /etc/SuSE-release
    SUSE Linux Enterprise Server 11 (x86_64)
    VERSION = 11
    PATCHLEVEL = 0

    ab@mybox1:~> cat /etc/SuSE-brand
    SLES
    VERSION = 11
    CO-BRANDS = SLE openSUSE

    But yes, this is a good question for the SLES forums specifically in the
    future.

    Good luck.
    Hi
    I use this in my signature script;
    Code:
    lsb_release -sd |cut -f2 -d ""\"
    --
    Cheers Malcolm (Linux Counter #276890)
    openSUSE 11.2 Milestone 6 (i586) Kernel 2.6.31-rc7-4-desktop
    up 10:28, 2 users, load average: 0.11, 0.12, 0.36
    ASUS eeePC 1000HE ATOM N280 1.66GHz | GPU Mobile 945GM/GMS/GME


  7. #7
    dizwell NNTP User

    Default Re: Identifying the OS

    Am very grateful for the SLES information (and, as I said, I realise I was being a bit cheeky). Great to know, anyway!

    Thank you everyone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •