On 2013-02-01 20:36, Anthony Messina wrote:
Is it possible to initialize a mock chroot environment variable with
the
return from the evaulation of a simple script when calling a koji build?
Something like:
/etc/mock/site-defaults.cfg:
config_opts['environment']['MYVAR'] =
"/usr/local/sbin/myscript.sh"
[...]
If not, might you suggest another way of accomplishing this task?
Do you want to run /usr/local/sbin/myscript.sh inside the chroot or
outside of it? If outside, something like this should work -- the config
file is just plain Python code:
import os
config_opts['environment']['MYVAR'] = \
os.popen("/usr/local/sbin/myscript.sh").read().strip()
If you want to run it inside the chroot, you can emit a chroot profile.d
script that does stuff, for example:
config_opts['files']['etc/profile.d/zz-mystuff.sh'] = """
MYVAR=$(/usr/local/sbin/myscript.sh)
"""