Results 1 to 9 of 9

Thread: What is the difference between ${releasever} and $releasever?

  1. #1

    Default What is the difference between ${releasever} and $releasever?

    Hi,

    This WiKi page gives this command:
    Code:
    sudo sed -i 's/15.1/${releasever}/g' /etc/zypp/repos.d/*.repo
    And this page says:
    Code:
    sed -i 's/15.1/$releasever/g' /etc/zypp/repos.d/*.repo
    Do the curly braces make a difference? Does it matter?
    And where is the environment variable $releserver? I can't find it locally?

    Regards,
    openSUSE Leap 15.1; KDE Plasma 5.12.8;

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    27,342

    Default Re: What is the difference between ${releasever} and $releasever?

    It is all in
    Code:
    man zypper
    If a variable is followed by an alphanumeric character or underscore it needs to be enclosed in {}:
    So in most cases the {} are not needed because it is between / and / in the .repo files.
    Last edited by hcvv; 24-Oct-2020 at 02:25.
    Henk van Velden

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    27,342

    Default Re: What is the difference between ${releasever} and $releasever?

    Quote Originally Posted by martinprowe View Post
    And where is the environment variable $releserver? I can't find it locally?

    Regards,
    I can not find the word "environment" in that page. Where do you see it?

    I am not aware such an environment variable (with or without the $) is involved here. Why do you think so?
    Henk van Velden

  4. #4
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    14,530
    Blog Entries
    3

    Default Re: What is the difference between ${releasever} and $releasever?

    Quote Originally Posted by martinprowe View Post
    And where is the environment variable $releserver? I can't find it locally?
    I'm not sure what you are looking for there. The variable $releasever is internal to zypper.

    From the "zypper" man page:

    "Use this variable to refer to the version of your openSUSE or SUSE Linux. The value is obtained from the /product/version XML-node in /etc/products.d/baseproduct."

    and

    This is how you can set a custom variable, e.g. $releasever to a value of 99.0:
    Code:
    echo "99.0" >/etc/zypp/vars.d/releasever
    openSUSE Leap 15.2; KDE Plasma 5.18.5;

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    27,342

    Default Re: What is the difference between ${releasever} and $releasever?

    Quote Originally Posted by nrickert View Post
    I'm not sure what you are looking for there. The variable $releasever is internal to zypper.

    From the "zypper" man page:

    "Use this variable to refer to the version of your openSUSE or SUSE Linux. The value is obtained from the /product/version XML-node in /etc/products.d/baseproduct."

    and

    This is how you can set a custom variable, e.g. $releasever to a value of 99.0:
    Code:
    echo "99.0" >/etc/zypp/vars.d/releasever
    As I quoted from the man page, $releasever is the basic way to do this. But as there are more of those variables (see the man page), their must be a way to see where the parameter stops and other characters in the total string start again.

    Code:
    something/$releasever/somethingelse
    is fine, but
    Code:
    something$releaseversomethingelse
    is wrong because the variable releaseversomethingelse will not be defined.
    It is the same in bash and the developers use the same method to avoid the problem (but from there the similarity stops).
    Code:
    something${releasever}somethingelse
    is OK.

    It is a bit technical and probably not very applicable in the case of $releasever, but the zypper developers came with a general solution for having parameters in the .repo definitions and it is explained in the man page!

    Now the OP saw it somewhere mentioned and was confused about what to use. Thus his question.
    You can of course always use the full form, but the one without the {} will work with all the $releasever in .repo definitions I saw thus far.
    Henk van Velden

  6. #6

    Default Re: What is the difference between ${releasever} and $releasever?

    Thank you all for a very rapid and full explanation.

    When (many years ago), I was in the military, I was taught never to press a button UNLESS I knew what it did!
    Maintaining my PC forces me to go against this rule - I see lots of advice to "Do This.." "Click that..."
    It seems to me that although the advice is well meant, very rarely am I at the same starting point that the author thinks I should be!

    Regards,

    PS - I (think) I have successfully upgraded to 15.2
    openSUSE Leap 15.1; KDE Plasma 5.12.8;

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    27,342

    Default Re: What is the difference between ${releasever} and $releasever?

    Quote Originally Posted by martinprowe View Post
    Thank you all for a very rapid and full explanation.

    When (many years ago), I was in the military, I was taught never to press a button UNLESS I knew what it did!
    Maintaining my PC forces me to go against this rule - I see lots of advice to "Do This.." "Click that..."
    It seems to me that although the advice is well meant, very rarely am I at the same starting point that the author thinks I should be!
    Nowadays we have the "culture" of "I read it on the Interne!t". Just stupidly do what you read somewhere and then complain to the world that your system (or whatever) is borked.

    You are correct. Read any advice/help and then try to understand waht the statements do. Read man pages, etc. Or ask here on the forums.

    Quote Originally Posted by martinprowe View Post
    PS - I (think) I have successfully upgraded to 15.2
    Nice. I did two systems last two weeks in the same way as you seem to have done. No problems here (except a few surprises from KDE, but that is only to be expected ).
    Henk van Velden

  8. #8

    Default Re: What is the difference between ${releasever} and $releasever?

    Quote Originally Posted by hcvv View Post
    No problems here (except a few surprises from KDE, but that is only to be expected ).
    Ah... That's interesting? I know its not forum etiquette to mix threads topics. But...

    Was your KDE problem anything like: "Dr Konqi - We are sorry, kdeinit5 closed unexpectedly. You cannot report <...> address"
    This is every time I open Dolphin.

    Regards,
    openSUSE Leap 15.1; KDE Plasma 5.12.8;

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    27,342

    Default Re: What is the difference between ${releasever} and $releasever?

    Quote Originally Posted by martinprowe View Post
    Ah... That's interesting? I know its not forum etiquette to mix threads topics. But...

    Was your KDE problem anything like: "Dr Konqi - We are sorry, kdeinit5 closed unexpectedly. You cannot report <...> address"
    This is every time I open Dolphin.

    Regards,
    No I do not see that. Indeed better start a new thread for that.

    What I mean is not real breaking things, but small changes in the UI. Other cursor forms, changes of defaults (one of the meanest things you can do to a user, change a default of something he never configured and thus used that default because it fits his needs). All those minor things that make you think: do you really need to pester me?
    Henk van Velden

Posting Permissions

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