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"
Where /usr/local/sbin/myscript.sh contains something like: #!/usr/bin/bash file="/tmp/$RANDOM.txt" touch "$file" # Created outside the chroot echo "$file" # $file passed as the MYVAR environment variable
If not, might you suggest another way of accomplishing this task?
Thanks in advance. -A
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) """
On Friday, February 01, 2013 10:44:26 PM Ville Skyttä wrote:
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) """
Thank you, Ville! That is exactly what I was looking for. I appreciate the help. -A
buildsys@lists.fedoraproject.org