0

I have a spec file with some content. There is also a script:

%postun
  if [ '$1' == 0 ]; then
    do some things
  fi

I want that a script in %postun section has been executed after package removed. But in $1 variable i receive a path (../../source/) instead of a number.

How can i receive a number instead a path?

1 Answer 1

0

First - single quote means do not expand variables. Use double quotes:

if [ "$1" == 0 ]; then

I guess that your scriptlet looks like:

%postun
  if [ '$1' == 0 ]; then
    ./some-script.sh foo
  fi

Mind that $1 in the script is the foo and not the $1 from the scriptlet.

1
  • Thank you for the reply! A problem is that instead of 1 or 0 i have received "../../source" value in $1 variable in %postun section. And i do not know why is that?
    – apogoreliy
    Commented Apr 6, 2021 at 10:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .