summaryrefslogtreecommitdiffstats
path: root/recipes-security/bastille
diff options
context:
space:
mode:
authormulhern <mulhern@yoctoproject.org>2013-09-13 13:51:59 -0400
committermulhern <mulhern@yoctoproject.org>2013-09-25 20:52:09 -0400
commitb2a60ba7ff7eb43446e96fc5048109922d58b45d (patch)
tree39de51a28c3eb7cfe9dacc1dcdaa668be5faba7a /recipes-security/bastille
parent23815f300174ce6cab48356e3fffba9868b626d4 (diff)
downloadmeta-security-b2a60ba7ff7eb43446e96fc5048109922d58b45d.tar.gz
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>
Diffstat (limited to 'recipes-security/bastille')
-rw-r--r--recipes-security/bastille/bastille_3.2.1.bb4
-rwxr-xr-xrecipes-security/bastille/files/set_required_questions.py28
2 files changed, 26 insertions, 6 deletions
diff --git a/recipes-security/bastille/bastille_3.2.1.bb b/recipes-security/bastille/bastille_3.2.1.bb
index ef697d7..969ce30 100644
--- a/recipes-security/bastille/bastille_3.2.1.bb
+++ b/recipes-security/bastille/bastille_3.2.1.bb
@@ -143,14 +143,14 @@ do_install () {
143 install -m 0644 OSMap/OSX.bastille ${D}${datadir}/Bastille/OSMap 143 install -m 0644 OSMap/OSX.bastille ${D}${datadir}/Bastille/OSMap
144 install -m 0644 OSMap/OSX.system ${D}${datadir}/Bastille/OSMap 144 install -m 0644 OSMap/OSX.system ${D}${datadir}/Bastille/OSMap
145 145
146 ${THISDIR}/files/set_required_questions.py ${WORKDIR}/config Questions
147
148 install -m 0777 ${WORKDIR}/config ${D}${sysconfdir}/Bastille/config 146 install -m 0777 ${WORKDIR}/config ${D}${sysconfdir}/Bastille/config
149 147
150 for file in `cat Modules.txt` ; do 148 for file in `cat Modules.txt` ; do
151 install -m 0644 Questions/$file.txt ${D}${datadir}/Bastille/Questions 149 install -m 0644 Questions/$file.txt ${D}${datadir}/Bastille/Questions
152 done 150 done
153 151
152 ${THISDIR}/files/set_required_questions.py ${D}${sysconfdir}/Bastille/config ${D}${datadir}/Bastille/Questions
153
154 ln -s ${D}${sbindir}/RevertBastille ${D}${sbindir}/UndoBastille 154 ln -s ${D}${sbindir}/RevertBastille ${D}${sbindir}/UndoBastille
155} 155}
156 156
diff --git a/recipes-security/bastille/files/set_required_questions.py b/recipes-security/bastille/files/set_required_questions.py
index ed299e5..4a28358 100755
--- a/recipes-security/bastille/files/set_required_questions.py
+++ b/recipes-security/bastille/files/set_required_questions.py
@@ -2,7 +2,7 @@
2 2
3#Signed-off-by: Anne Mulhern <mulhern@yoctoproject.org> 3#Signed-off-by: Anne Mulhern <mulhern@yoctoproject.org>
4 4
5import argparse, os, shutil, sys, tempfile 5import argparse, os, shutil, sys, tempfile, traceback
6from os import path 6from os import path
7 7
8 8
@@ -76,12 +76,20 @@ def add_requires(the_ident, distro, lines):
76 76
77 77
78def xform_file(qfile, distro, qlabel): 78def xform_file(qfile, distro, qlabel):
79 """
80 Transform a Questions file.
81 @param name qfile The designated questions file.
82 @param name distro The distribution to add to the required distributions.
83 @param name qlabel The question label for which the distro is to be added.
84 """
79 questions_in = open(qfile) 85 questions_in = open(qfile)
80 questions_out = tempfile.NamedTemporaryFile(delete=False) 86 questions_out = tempfile.NamedTemporaryFile(delete=False)
81 for l in add_requires(qlabel, distro, questions_in): 87 for l in add_requires(qlabel, distro, questions_in):
82 questions_out.write(l) 88 questions_out.write(l)
83 questions_out.close() 89 questions_out.close()
84 questions_in.close() 90 questions_in.close()
91 shutil.copystat(qfile, questions_out.name)
92 os.remove(qfile)
85 shutil.move(questions_out.name, qfile) 93 shutil.move(questions_out.name, qfile)
86 94
87 95
@@ -94,6 +102,9 @@ def handle_args(parser):
94 parser.add_argument('--distro', '-d', 102 parser.add_argument('--distro', '-d',
95 help = "The distribution, the default is Yocto.", 103 help = "The distribution, the default is Yocto.",
96 default = "Yocto") 104 default = "Yocto")
105 parser.add_argument('--debug', '-b',
106 help = "Print debug information.",
107 action = 'store_true')
97 return parser.parse_args() 108 return parser.parse_args()
98 109
99 110
@@ -116,7 +127,10 @@ def main():
116 try: 127 try:
117 check_args(opts) 128 check_args(opts)
118 except ValueError as e: 129 except ValueError as e:
119 sys.exit("Fatal error: %s" % e) 130 if opts.debug:
131 traceback.print_exc()
132 else:
133 sys.exit("Fatal error:\n%s" % e)
120 134
121 135
122 try: 136 try:
@@ -127,9 +141,15 @@ def main():
127 config_in.close() 141 config_in.close()
128 142
129 except IOError as e: 143 except IOError as e:
130 sys.exit("Fatal error reading config file: %s" % e) 144 if opts.debug:
145 traceback.print_exc()
146 else:
147 sys.exit("Fatal error reading or writing file:\n%s" % e)
131 except ValueError as e: 148 except ValueError as e:
132 sys.exit("Fatal error: %s" % e) 149 if opts.debug:
150 traceback.print_exc()
151 else:
152 sys.exit("Fatal error:\n%s" % e)
133 153
134 154
135 155