fi
filelist="${filelist}"
+filelist_opt="${filelist_opt}"
tmpdir=/tmp/jailhouse-config-collect.$$
rm -rf $tmpdir
mkdir $tmpdir
+copy_file()
+{
+ dstdir=$tmpdir/$(dirname $1)
+ if [ ! -d $dstdir ]; then
+ mkdir -p $dstdir
+ fi
+ cp -p $1 $tmpdir/$1
+}
+
# copy all the files we need to a temporary directory first
for f in $filelist; do
+ copy_file $f
+done
+for f in $filelist_opt; do
if [ -f $f ]; then
- dstdir=$tmpdir/$(dirname $f)
- if [ ! -d $dstdir ]; then
- mkdir -p $dstdir
- fi
- cp -p $f $tmpdir/$f
- else
- echo "Warning: $f does not exist" 1>&2
+ copy_file $f
fi
done
options = parser.parse_args()
-inputs = {'files': set(), 'dirs': set()}
+inputs = {'files': set(), 'files_opt': set(), 'dirs': set()}
class PCIDevice:
def input_open(name, optional, *args):
- inputs['files'].add(name)
+ inputs['files_opt' if optional else 'files'].add(name)
try:
f = open(options.root + name, *args)
except Exception as e:
if options.generate_collector:
filelist = ' '.join(inputs['files'].union(inputs['dirs']))
+ filelist_opt = ' '.join(inputs['files_opt'])
tmpl = Template(filename='jailhouse-config-collect.tmpl')
- f.write(tmpl.render(filelist=filelist))
+ f.write(tmpl.render(filelist=filelist, filelist_opt=filelist_opt))
else:
tmpl = Template(filename='root-cell-config.c.tmpl')
f.write(tmpl.render(regions=regions,