Initialize a mock chroot environment variable

Anthony Messina amessina at messinet.com
Sat Feb 2 02:21:39 UTC 2013


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

-- 
Anthony - http://messinet.com - http://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.fedoraproject.org/pipermail/buildsys/attachments/20130201/1d2e9315/attachment.sig>


More information about the buildsys mailing list