summaryrefslogtreecommitdiffstats
path: root/recipes-security
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-security')
-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