I am producing an rpm for Sia in ClearOS7 (based on Centos7) and have hit a brick wall. I am trying to set SIA_DATA_DIR=/var/lib/siad-data for the session where I am installing the rpm. It is needed for both the sia daemon and for the siac app which is a command line app. For the daemon it is simple enough and I can set it in the systemd unit file.
To try to set it globally I have created a file, /etc/profile.d/siad.sh and in it I've put
[ -x /usr/bin/siad ] && export SIA_DATA_DIR=/var/lib/siad-data
In the %post section of the spec file I have source /etc/profile.d/siad.sh. I can see the profile.d file works for a new shell, but in the current shell it is not work. Guessing, it is because yum is opening a subprocess and the variable does not get back up to the parent process. Putting export SIA_DATA_DIR=/var/lib/siad-data directly in the %post script does not work either.
How can I set the environment variable for the session used to install the rpm in the rpm?