Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds@gmail.com>2019-06-20 18:59:53 +0000
committerAnton Hvornum <anton.feeds@gmail.com>2019-06-20 18:59:53 +0000
commit6a0e906ac7e1c831b083d4983d819e613d45392a (patch)
tree0e6282e50a6ed7ee8d0691200eabd9d6581b7cb7 /archinstall.py
parent379113a015ae93f06917224c6040eb1119fe7754 (diff)
Fixing some logic issues in sys_command
Diffstat (limited to 'archinstall.py')
-rw-r--r--archinstall.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/archinstall.py b/archinstall.py
index 41e3feec..22993f7f 100644
--- a/archinstall.py
+++ b/archinstall.py
@@ -156,6 +156,7 @@ class sys_command():
alive = True
trace_log = b''
+ last_trigger_pos = 0
while alive:
for fileno, event in poller.poll(0.1):
try:
@@ -170,20 +171,27 @@ class sys_command():
print(output)
lower = output.lower()
+ broke = False
if 'triggers' in self.opts:
for trigger in list(self.opts['triggers']):
- if trigger.lower() in trace_log.lower():
+ if trigger.lower() in trace_log[last_trigger_pos:].lower():
if 'debug' in self.opts and self.opts['debug']:
print('[N] Writing to subsystem: {}'.format(self.opts['triggers'][trigger].decode('UTF-8')))
+
+ last_trigger_pos = len(trace_log)
os.write(child_fd, self.opts['triggers'][trigger])
del(self.opts['triggers'][trigger])
+ broke = True
break
+ if broke:
+ continue
+
## Adding a exit trigger:
if len(self.opts['triggers']) == 0:
if 'debug' in self.opts and self.opts['debug']:
print('[N] Waiting for last command to finish...')
- if bytes(f'[root@{args["hostname"]} ~]#'.lower(), 'UTF-8') in output[-len(f'[root@{args["hostname"]} ~]#')-5:].lower():
+ if bytes(f'[root@{args["hostname"]} ~]#'.lower(), 'UTF-8') in trace_log[-len(f'[root@{args["hostname"]} ~]#')-5:].lower():
if 'debug' in self.opts and self.opts['debug']:
print('[N] Last command finished, exiting subsystem.')
alive = False