158
def _find_and_copy(self, rootdir, odir, pattern, name=None):
160
for root, dirs, files in os.walk(rootdir):
162
if re.match(pattern, file):
164
dest = os.path.join(odir, name)
166
dest = os.path.join(odir, file)
168
src = os.path.join(rootdir, file)
169
shutil.copyfile(src, dest)
175
def _customize_bootloader(self):
176
self.proc.expect(self.config.bootloader_prompt, timeout=300)
177
if isinstance(self.config.boot_cmds, basestring):
178
boot_cmds = utils.string_to_list(self.config.boot_cmds.encode('ascii'))
180
boot_cmds = self.config.boot_cmds
181
for line in boot_cmds:
182
parts = re.match('^(?P<action>sendline|expect)\s*(?P<command>.*)', line)
185
action = parts.group('action')
186
command = parts.group('command')
187
except AttributeError as e:
188
raise Exception("Badly formatted command in boot_cmds %s" % e)
189
if action == "sendline":
190
self.proc.send(command)
191
self.proc.sendline('')
192
elif action == "expect":
193
command = re.escape(command)
194
self.proc.expect(command, timeout=300)
196
self.proc.sendline(line)
157
198
def _customize_ubuntu(self, rootdir):
158
199
self.deployment_data = Target.ubuntu_deployment_data
159
200
with open('%s/root/.bashrc' % rootdir, 'a') as f: