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.