mirror of
https://git.yoctoproject.org/meta-security
synced 2026-05-09 05:29:56 +00:00
bastille: Fix failure during install.
[YOCTO #5177] On some systems the bitbake install step failed. The failure was due to some files that were being overwritten not having sufficient permissions. The install script in the recipe is changed so that the set_required_questions.py script is invoked on the files in the image directory, which are guaranteed to have adequate permission. Previously, it had been invoked on the files in the work directory. The set_required_questions.py script is changed in the following ways. * The xform_file function now handles the overwriting of the files in a more robust manner. * The script now accepts a debug flag. When set this flag will cause the script to display more developer friendly information on error. * The xform_file function has a descriptive comment. Signed-off-by: mulhern <mulhern@yoctoproject.org>
This commit is contained in:
@@ -143,14 +143,14 @@ do_install () {
|
||||
install -m 0644 OSMap/OSX.bastille ${D}${datadir}/Bastille/OSMap
|
||||
install -m 0644 OSMap/OSX.system ${D}${datadir}/Bastille/OSMap
|
||||
|
||||
${THISDIR}/files/set_required_questions.py ${WORKDIR}/config Questions
|
||||
|
||||
install -m 0777 ${WORKDIR}/config ${D}${sysconfdir}/Bastille/config
|
||||
|
||||
for file in `cat Modules.txt` ; do
|
||||
install -m 0644 Questions/$file.txt ${D}${datadir}/Bastille/Questions
|
||||
done
|
||||
|
||||
${THISDIR}/files/set_required_questions.py ${D}${sysconfdir}/Bastille/config ${D}${datadir}/Bastille/Questions
|
||||
|
||||
ln -s ${D}${sbindir}/RevertBastille ${D}${sbindir}/UndoBastille
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#Signed-off-by: Anne Mulhern <mulhern@yoctoproject.org>
|
||||
|
||||
import argparse, os, shutil, sys, tempfile
|
||||
import argparse, os, shutil, sys, tempfile, traceback
|
||||
from os import path
|
||||
|
||||
|
||||
@@ -76,12 +76,20 @@ def add_requires(the_ident, distro, lines):
|
||||
|
||||
|
||||
def xform_file(qfile, distro, qlabel):
|
||||
"""
|
||||
Transform a Questions file.
|
||||
@param name qfile The designated questions file.
|
||||
@param name distro The distribution to add to the required distributions.
|
||||
@param name qlabel The question label for which the distro is to be added.
|
||||
"""
|
||||
questions_in = open(qfile)
|
||||
questions_out = tempfile.NamedTemporaryFile(delete=False)
|
||||
for l in add_requires(qlabel, distro, questions_in):
|
||||
questions_out.write(l)
|
||||
questions_out.close()
|
||||
questions_in.close()
|
||||
shutil.copystat(qfile, questions_out.name)
|
||||
os.remove(qfile)
|
||||
shutil.move(questions_out.name, qfile)
|
||||
|
||||
|
||||
@@ -94,6 +102,9 @@ def handle_args(parser):
|
||||
parser.add_argument('--distro', '-d',
|
||||
help = "The distribution, the default is Yocto.",
|
||||
default = "Yocto")
|
||||
parser.add_argument('--debug', '-b',
|
||||
help = "Print debug information.",
|
||||
action = 'store_true')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -116,7 +127,10 @@ def main():
|
||||
try:
|
||||
check_args(opts)
|
||||
except ValueError as e:
|
||||
sys.exit("Fatal error: %s" % e)
|
||||
if opts.debug:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
sys.exit("Fatal error:\n%s" % e)
|
||||
|
||||
|
||||
try:
|
||||
@@ -127,9 +141,15 @@ def main():
|
||||
config_in.close()
|
||||
|
||||
except IOError as e:
|
||||
sys.exit("Fatal error reading config file: %s" % e)
|
||||
if opts.debug:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
sys.exit("Fatal error reading or writing file:\n%s" % e)
|
||||
except ValueError as e:
|
||||
sys.exit("Fatal error: %s" % e)
|
||||
if opts.debug:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
sys.exit("Fatal error:\n%s" % e)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user