Results 1 to 3 of 3

Thread: zypper addrepo to detect current version of opensuse

  1. #1

    Default zypper addrepo to detect current version of opensuse

    In order to get the latest version of the R software, I need to add the repository using a line like this:

    Code:
    sudo zypper addrepo -f http://download.opensuse.org/repositories/devel\:languages\:R\:patched/openSUSE_12.2 "R patched devel"
    Where it is important that 12.2 is replaced by the version of OpenSUSE. I would like to make a script that automatically adds this repository for the appropriate, current version of OpenSUSE. I.e. a script that I can run on either version 11.x or 12.x and which will automatically insert the current version into the addrepo line. Is there an easy way to use zypper to add for example the repository above, where 12.2 will equal the running release? Or is there a more natural way of doing this?

  2. #2
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: zypper addrepo to detect current version of opensuse

    You can get the version with something like
    Code:
    grep VERSION /etc/SuSE-release | sed -e 's/VERSION = //'
    --
    PC: oS 12.2 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.5 | GeForce GT 420
    ThinkPad E320: oS 12.2 x86_64 | i3@2.30GHz | 8GB | KDE 4.9.2 | HD 3000
    eCAFE 800: oS 11.4 i586 | AMD Geode LX 800@500MHz | 512MB | lamp server

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,157

    Default Re: zypper addrepo to detect current version of opensuse

    Do you mean to do this for this special line or in general for all repos you like to add in the future and where the URL may have a complete different structure (dependend on the whim of the repo owner and he may not even have the openSUSE version in any place in that URL).

    When it is on this URL only, you can change the part
    Code:
    12.2
    with
    Code:
    $(grep VERSION /etc/SuSE-release | sed -e 's/VERSION = //')
    This to help you to put Martin's statement in your statement.

    Of course this works similar for URLs where there is "12.2" somewhere inside.
    Last edited by hcvv; 27-Oct-2012 at 01:24.
    Henk van Velden

Tags for this Thread

Posting Permissions

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