0

I need to create rpm package, that when installed into OBS environment, GBS environment, and on target device will execute different postinstall scripts.

I'm looking for code in spec file like this:

%post
if ### check for OBS env ###
then action_one;
elif ### check for GBS env ###
then action_two;
else ### target device ###
action_tree;
fi

I'm using official Tizen OBS and Tizen developer tools. Though, I think It should look the same in OpenSUSE build system.

I could not find any documented way to do this and I'm not sure that it exists. But I found that postinstall scripts when executed from preinstall (Preinstall: and RunScripts: in prjconf) are located in /.init_b_cache/scripts/ directory, and it can be checked through $0 bash variable.

I wonder if there is a way to check for environment without setting package as preinstall.

  • What is `GBS`? What is the target device? Why are you trying to do different things on them? What, specifically, are you trying to do differently on them? – Etan Reisner Sep 07 '15 at 19:49
  • [GBS](https://source.tizen.org/documentation/reference/git-build-system?langredirect=1) is another way to build Tizen packages locally(apart from osc tool). I have 3 possible environments where my package can and will be installed: 1) OBS worker(or similar local build by osc) 2) GBS local build by some developer 3) On working Tizen system (QEMU image, some smartphone firmware, etc) - I call this target device. I need to add my library to `ld.so.preload` but only in OBS build using only the package with that library. – Yury Usishchev Sep 08 '15 at 11:19
  • I would see if you can detect the presence of something unique to the GBS environment. A package would be best (as you could then use a `%trigger` to add to `ld.so.preload`) but a file/etc. would work as well in a pinch. That said I'd probably try to see if there was a way to avoid needing to do this at all and/or just make that something the person using GBS needs to do (and make that easy to do). – Etan Reisner Sep 08 '15 at 12:57

0 Answers0