From 2c65800d2984c31553e9de388eaecc9b72f2e92a Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 14:58:18 +0100 Subject: Changing detault for tests --- deployments/default.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/default.json b/deployments/default.json index 95870c6c..1eeac949 100644 --- a/deployments/default.json +++ b/deployments/default.json @@ -1,7 +1,7 @@ { "args" : { "password" : "", - "post" : "reboot" + "post" : "stay" }, "post" : { "test exit codes" : { -- cgit v1.2.3-70-g09d2 From 56ad7efe845c19c39aa078fb427228e12ae8e559 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:09:05 +0100 Subject: One step in fixing #20. User-given parameters override template. And next is reworking the inheritance structure of the templates --- archinstall.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/archinstall.py b/archinstall.py index 8437575c..5ce575c0 100644 --- a/archinstall.py +++ b/archinstall.py @@ -28,18 +28,6 @@ harddrives = oDict() commandlog = [] worker_history = oDict() instructions = oDict() -args = {} -positionals = [] -for arg in sys.argv[1:]: - if '--' == arg[:2]: - if '=' in arg: - key, val = [x.strip() for x in arg[2:].split('=')] - else: - key, val = arg[2:], True - args[key] = val - else: - positionals.append(arg) - import logging from systemd.journal import JournalHandler @@ -1134,7 +1122,17 @@ if __name__ == '__main__': ## Setup some defaults # (in case no command-line parameters or netdeploy-params were given) - args = setup_args_defaults(args) + args = setup_args_defaults() + positionals = [] + for arg in sys.argv[1:]: + if '--' == arg[:2]: + if '=' in arg: + key, val = [x.strip() for x in arg[2:].split('=')] + else: + key, val = arg[2:], True + args[key] = val + else: + positionals.append(arg) ## == If we got networking, # Try fetching instructions for this box unless a specific profile was given, and execute them. -- cgit v1.2.3-70-g09d2 From 2d9606777f24078b86d9e2e25efe0181b3e8c51c Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:09:54 +0100 Subject: Forgot to setup args --- archinstall.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 5ce575c0..d5ff48a9 100644 --- a/archinstall.py +++ b/archinstall.py @@ -28,6 +28,7 @@ harddrives = oDict() commandlog = [] worker_history = oDict() instructions = oDict() +args = {} import logging from systemd.journal import JournalHandler @@ -1122,7 +1123,7 @@ if __name__ == '__main__': ## Setup some defaults # (in case no command-line parameters or netdeploy-params were given) - args = setup_args_defaults() + args = setup_args_defaults(args) positionals = [] for arg in sys.argv[1:]: if '--' == arg[:2]: -- cgit v1.2.3-70-g09d2 From 6faeeb0bd302ae5f853ab63e46bf7b2c9ba2b544 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:10:49 +0100 Subject: Don't update git until we have some args --- archinstall.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archinstall.py b/archinstall.py index d5ff48a9..8075e6f4 100644 --- a/archinstall.py +++ b/archinstall.py @@ -1118,9 +1118,6 @@ def run_post_install_steps(*positionals, **kwargs): #print(o) if __name__ == '__main__': - update_git() # Breaks and restarts the script if an update was found. - update_drive_list() - ## Setup some defaults # (in case no command-line parameters or netdeploy-params were given) args = setup_args_defaults(args) @@ -1135,6 +1132,9 @@ if __name__ == '__main__': else: positionals.append(arg) + update_git() # Breaks and restarts the script if an update was found. + update_drive_list() + ## == If we got networking, # Try fetching instructions for this box unless a specific profile was given, and execute them. if args['profile'] is None and not args['minimal']: -- cgit v1.2.3-70-g09d2 From b0804b41d00ec6f58d14f23e864cd290a489acd8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:17:31 +0100 Subject: Fixing args --- archinstall.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/archinstall.py b/archinstall.py index 8075e6f4..05361fab 100644 --- a/archinstall.py +++ b/archinstall.py @@ -576,6 +576,9 @@ def merge_in_includes(instructions, *positionals, **kwargs): ## Update arguments if we found any for key, val in instructions['args'].items(): args[key] = val + if 'user_args' in kwargs: + for key, val in kwargs['user_args'].items(): + args[key] = val return instructions @@ -830,6 +833,9 @@ def load_automatic_instructions(*positionals, **kwargs): ## Update arguments if we found any for key, val in instructions['args'].items(): args[key] = val + if 'user_args' in kwargs: + for key, val in kwargs['user_args'].items(): + args[key] = val else: print('[N] No gateway - No net deploy') @@ -1121,6 +1127,7 @@ if __name__ == '__main__': ## Setup some defaults # (in case no command-line parameters or netdeploy-params were given) args = setup_args_defaults(args) + user_args = {} positionals = [] for arg in sys.argv[1:]: if '--' == arg[:2]: @@ -1129,6 +1136,7 @@ if __name__ == '__main__': else: key, val = arg[2:], True args[key] = val + user_args[key] = val else: positionals.append(arg) @@ -1138,7 +1146,7 @@ if __name__ == '__main__': ## == If we got networking, # Try fetching instructions for this box unless a specific profile was given, and execute them. if args['profile'] is None and not args['minimal']: - instructions = load_automatic_instructions() + instructions = load_automatic_instructions(user_args=user_args) elif args['profile'] and not args['minimal']: instructions = get_instructions(args['profile']) @@ -1159,7 +1167,7 @@ if __name__ == '__main__': first = False # TODO: Might not need to return anything here, passed by reference? - instructions = merge_in_includes(instructions) + instructions = merge_in_includes(instructions, user_args=user_args) cleanup_args() ## If no drive was found in args, select one. -- cgit v1.2.3-70-g09d2 From b4f311584b0f85f66fcbbf20ee8cce10686562d3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:25:27 +0100 Subject: Fixing argument for boot command --- archinstall.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/archinstall.py b/archinstall.py index 05361fab..25b6feb4 100644 --- a/archinstall.py +++ b/archinstall.py @@ -1109,11 +1109,15 @@ def run_post_install_steps(*positionals, **kwargs): ## " login" followed by "Passwodd" in case it's been set in a previous step.. usually this shouldn't be nessecary ## since we set the password as the last step. And then the command itself which will be executed by looking for: ## [root@ ~]# - o = b''.join(sys_command('/usr/bin/systemd-nspawn -D /mnt -b --machine temporary', events={ - bytes(f'login:', 'UTF-8') : b'root\n', - #b'Password:' : bytes(args['password']+'\n', 'UTF-8'), - bytes(f'[root@{args["hostname"]} ~]#', 'UTF-8') : bytes(command+'\n', 'UTF-8'), - }, **opts)) + defaults = { + bytes(f'login:', 'UTF-8') : b'root\n', + #b'Password:' : bytes(args['password']+'\n', 'UTF-8'), + bytes(f'[root@{args["hostname"]} ~]#', 'UTF-8') : bytes(command+'\n', 'UTF-8'), + } + if not 'events' in opts: opts['events'] = {} + events = {**defaults, **opts['events']} + del(opts['events']) + o = b''.join(sys_command('/usr/bin/systemd-nspawn -D /mnt -b --machine temporary', events=events, **opts)) ## Not needed anymore: And cleanup after out selves.. Don't want to leave any residue.. # os.remove('/mnt/etc/systemd/system/console-getty.service.d/override.conf') -- cgit v1.2.3-70-g09d2 From b2f85c93e7a93ad31910902975f408ae106a0bb2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:33:00 +0100 Subject: Fixing bytes conversion on JSON triggers on command lines --- archinstall.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 25b6feb4..62fd88e1 100644 --- a/archinstall.py +++ b/archinstall.py @@ -312,6 +312,7 @@ class sys_command():#Thread): broke = False if 'events' in self.kwargs: for trigger in list(self.kwargs['events']): + if type(trigger) != bytes: trigger = bytes(trigger, 'UTF-8') if trigger.lower() in self.trace_log[last_trigger_pos:].lower(): trigger_pos = self.trace_log[last_trigger_pos:].lower().find(trigger.lower()) @@ -1087,7 +1088,7 @@ def run_post_install_steps(*positionals, **kwargs): o = simple_command("cd /mnt; mount -t proc /proc proc") o = simple_command("cd /mnt; mount --make-rslave --rbind /sys sys") o = simple_command("cd /mnt; mount --make-rslave --rbind /dev dev") - o = simple_command('chroot /mnt /bin/bash -c "{c}"'.format(c=command), events=opts) + o = simple_command('chroot /mnt /bin/bash -c "{c}"'.format(c=command), opts=opts) o = simple_command("cd /mnt; umount -R dev") o = simple_command("cd /mnt; umount -R sys") o = simple_command("cd /mnt; umount -R proc") -- cgit v1.2.3-70-g09d2 From c2badea10badc3d48d4250955c58732e6dcb08b3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:35:37 +0100 Subject: Debugging --- archinstall.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 62fd88e1..1b442d1c 100644 --- a/archinstall.py +++ b/archinstall.py @@ -1229,7 +1229,9 @@ if __name__ == '__main__': close_disks() print(f'[N] Setting up {args["drive"]}.') - format_disk('drive', start='start', end='size') + if not format_disk('drive', start='start', end='size', debug=True): + pritn(f'[E] Coult not format drive {args["drive"]}') + exit(1) refresh_partition_list('drive') print(f'[N] Partitions: {len(args["partitions"])} (Boot: {list(args["partitions"].keys())[0]})') -- cgit v1.2.3-70-g09d2 From 253e52da228183be504b1fd8249dcb7bbad5f011 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:37:05 +0100 Subject: debugging --- archinstall.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 1b442d1c..2502b00e 100644 --- a/archinstall.py +++ b/archinstall.py @@ -306,6 +306,7 @@ class sys_command():#Thread): break if 'debug' in self.kwargs and self.kwargs['debug'] and len(output): + print(self.cmd[0], 'gave:', output.decode('UTF-8'), origin='spawn', level=4) log(self.cmd[0],'gave:', output.decode('UTF-8'), origin='spawn', level=4) lower = output.lower() @@ -1230,7 +1231,7 @@ if __name__ == '__main__': close_disks() print(f'[N] Setting up {args["drive"]}.') if not format_disk('drive', start='start', end='size', debug=True): - pritn(f'[E] Coult not format drive {args["drive"]}') + print(f'[E] Coult not format drive {args["drive"]}') exit(1) refresh_partition_list('drive') -- cgit v1.2.3-70-g09d2 From f537eee6b35c4f19a347f22209432d3bbeaaa024 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:37:44 +0100 Subject: debugging --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 2502b00e..2794b1a8 100644 --- a/archinstall.py +++ b/archinstall.py @@ -306,7 +306,7 @@ class sys_command():#Thread): break if 'debug' in self.kwargs and self.kwargs['debug'] and len(output): - print(self.cmd[0], 'gave:', output.decode('UTF-8'), origin='spawn', level=4) + print(self.cmd[0], 'gave:', output.decode('UTF-8')) log(self.cmd[0],'gave:', output.decode('UTF-8'), origin='spawn', level=4) lower = output.lower() -- cgit v1.2.3-70-g09d2 From 735a2b02e90131dd2621c7430d4621be88fee4e3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 15:50:08 +0100 Subject: Adding test of multiple event triggers --- deployments/default.json | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/deployments/default.json b/deployments/default.json index 1eeac949..4aa0489d 100644 --- a/deployments/default.json +++ b/deployments/default.json @@ -1,15 +1,18 @@ { "args" : { - "password" : "", + "password" : "0000", "post" : "stay" }, "post" : { "test exit codes" : { "exit 1" : {"ignore_errors" : true}, - "echo 'test1'; read moo; echo 'test2'; read mooo" : {"events" : { - "test1" : "something", - "test2" : "something" - }, "boot" : true} + "echo 'ssh test@77.80.220.176" : { + "events" : { + "continue connecting" : "yes", + "s password" : "test" + }, + "boot" : true + } } } } -- cgit v1.2.3-70-g09d2 From 7b1968fa9a27eedb195e0d3e9d416413dafe71bb Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 16:12:10 +0100 Subject: Adding more debug output --- archinstall.py | 4 ++++ deployments/default.json | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 2794b1a8..feb73093 100644 --- a/archinstall.py +++ b/archinstall.py @@ -294,6 +294,10 @@ class sys_command():#Thread): poller = epoll() poller.register(child_fd, EPOLLIN | EPOLLHUP) + if 'events' in self.kwargs and 'debug' in self.kwargs: + print(f'[D] Using triggers for command: {self.cmd}') + print(json.dumps(self.kwargs['events'])) + alive = True last_trigger_pos = 0 while alive and not self.kwargs['emulate']: diff --git a/deployments/default.json b/deployments/default.json index 4aa0489d..78fd346e 100644 --- a/deployments/default.json +++ b/deployments/default.json @@ -11,7 +11,8 @@ "continue connecting" : "yes", "s password" : "test" }, - "boot" : true + "boot" : true, + "debug" : true } } } -- cgit v1.2.3-70-g09d2 From 3769a3193b24ff77620f0160239058296dc495be Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 16:36:43 +0100 Subject: Tweaking event input --- archinstall.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archinstall.py b/archinstall.py index feb73093..39911742 100644 --- a/archinstall.py +++ b/archinstall.py @@ -1116,9 +1116,9 @@ def run_post_install_steps(*positionals, **kwargs): ## since we set the password as the last step. And then the command itself which will be executed by looking for: ## [root@ ~]# defaults = { - bytes(f'login:', 'UTF-8') : b'root\n', - #b'Password:' : bytes(args['password']+'\n', 'UTF-8'), - bytes(f'[root@{args["hostname"]} ~]#', 'UTF-8') : bytes(command+'\n', 'UTF-8'), + 'login:' : 'root\n', + #b'Password:' : bytes(args['password']+'\n', + '[root@{args["hostname"]} ~]#' : command+'\n', } if not 'events' in opts: opts['events'] = {} events = {**defaults, **opts['events']} -- cgit v1.2.3-70-g09d2 From cefe7e4f8b714e2c5c1ea7b6153eff42fc051878 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 16:53:47 +0100 Subject: Enhancing trigger values --- archinstall.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/archinstall.py b/archinstall.py index 39911742..07205096 100644 --- a/archinstall.py +++ b/archinstall.py @@ -317,7 +317,12 @@ class sys_command():#Thread): broke = False if 'events' in self.kwargs: for trigger in list(self.kwargs['events']): - if type(trigger) != bytes: trigger = bytes(trigger, 'UTF-8') + if type(trigger) != bytes: + key = self.kwargs['events'][trigger] + del(self.kwargs['events'][trigger]) + trigger = bytes(key, 'UTF-8') + self.kwargs['events'][trigger] = self.kwargs['events'][key] + if trigger.lower() in self.trace_log[last_trigger_pos:].lower(): trigger_pos = self.trace_log[last_trigger_pos:].lower().find(trigger.lower()) @@ -325,6 +330,8 @@ class sys_command():#Thread): log(f"Writing to subprocess {self.cmd[0]}: {self.kwargs['events'][trigger].decode('UTF-8')}", origin='spawn', level=5) last_trigger_pos = trigger_pos + if type(self.kwargs['events'][trigger]) != bytes: + self.kwargs['events'][trigger] = bytes(self.kwargs['events'][trigger], 'UTF-8') os.write(child_fd, self.kwargs['events'][trigger]) del(self.kwargs['events'][trigger]) broke = True @@ -1117,7 +1124,7 @@ def run_post_install_steps(*positionals, **kwargs): ## [root@ ~]# defaults = { 'login:' : 'root\n', - #b'Password:' : bytes(args['password']+'\n', + #'Password:' : args['password']+'\n', '[root@{args["hostname"]} ~]#' : command+'\n', } if not 'events' in opts: opts['events'] = {} -- cgit v1.2.3-70-g09d2 From fc196a589ba2f83cbc188ffe0e7f7c48da05ec3f Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 17:02:40 +0100 Subject: Debugging --- deployments/default.json | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/deployments/default.json b/deployments/default.json index 78fd346e..78ea5472 100644 --- a/deployments/default.json +++ b/deployments/default.json @@ -1,19 +1,17 @@ { - "args" : { - "password" : "0000", - "post" : "stay" - }, - "post" : { - "test exit codes" : { - "exit 1" : {"ignore_errors" : true}, - "echo 'ssh test@77.80.220.176" : { - "events" : { - "continue connecting" : "yes", - "s password" : "test" - }, - "boot" : true, - "debug" : true - } - } - } + "args" : { + "password" : "0000", + "post" : "stay" + }, + "post" : { + "test exit codes" : { + "ssh test@77.80.220.176" : {"events" : { + "continue connecting" : "yes", + "s password" : "test" + }, + "boot" : true, + "debug" : true + } + } + } } -- cgit v1.2.3-70-g09d2 From 198c47333ea93083e141146ceb60d1166914df6e Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 17:10:04 +0100 Subject: Debugging --- archinstall.py | 5 +++-- deployments/default.json | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/archinstall.py b/archinstall.py index 07205096..74e22898 100644 --- a/archinstall.py +++ b/archinstall.py @@ -322,16 +322,17 @@ class sys_command():#Thread): del(self.kwargs['events'][trigger]) trigger = bytes(key, 'UTF-8') self.kwargs['events'][trigger] = self.kwargs['events'][key] + if type(self.kwargs['events'][key]) != bytes: + self.kwargs['events'][key] = bytes(self.kwargs['events'][key], 'UTF-8') if trigger.lower() in self.trace_log[last_trigger_pos:].lower(): trigger_pos = self.trace_log[last_trigger_pos:].lower().find(trigger.lower()) if 'debug' in self.kwargs and self.kwargs['debug']: + print(f"Writing to subprocess {self.cmd[0]}: {self.kwargs['events'][trigger].decode('UTF-8')}") log(f"Writing to subprocess {self.cmd[0]}: {self.kwargs['events'][trigger].decode('UTF-8')}", origin='spawn', level=5) last_trigger_pos = trigger_pos - if type(self.kwargs['events'][trigger]) != bytes: - self.kwargs['events'][trigger] = bytes(self.kwargs['events'][trigger], 'UTF-8') os.write(child_fd, self.kwargs['events'][trigger]) del(self.kwargs['events'][trigger]) broke = True diff --git a/deployments/default.json b/deployments/default.json index 78ea5472..cd205f84 100644 --- a/deployments/default.json +++ b/deployments/default.json @@ -6,8 +6,8 @@ "post" : { "test exit codes" : { "ssh test@77.80.220.176" : {"events" : { - "continue connecting" : "yes", - "s password" : "test" + "continue connecting" : "yes\n", + "s password" : "test\n" }, "boot" : true, "debug" : true -- cgit v1.2.3-70-g09d2 From c5b44a6935b7b4fe3762202f3d2ae746e7ad24b3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 17:23:04 +0100 Subject: Fixing issues with the spawning of containers. --- archinstall.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/archinstall.py b/archinstall.py index 74e22898..f449c133 100644 --- a/archinstall.py +++ b/archinstall.py @@ -318,12 +318,13 @@ class sys_command():#Thread): if 'events' in self.kwargs: for trigger in list(self.kwargs['events']): if type(trigger) != bytes: - key = self.kwargs['events'][trigger] + original = self.kwargs['events'][trigger] del(self.kwargs['events'][trigger]) - trigger = bytes(key, 'UTF-8') - self.kwargs['events'][trigger] = self.kwargs['events'][key] - if type(self.kwargs['events'][key]) != bytes: - self.kwargs['events'][key] = bytes(self.kwargs['events'][key], 'UTF-8') + + trigger = bytes(original, 'UTF-8') + self.kwargs['events'][trigger] = self.kwargs['events'][original] + if type(self.kwargs['events'][trigger]) != bytes: + self.kwargs['events'][trigger] = bytes(self.kwargs['events'][trigger], 'UTF-8') if trigger.lower() in self.trace_log[last_trigger_pos:].lower(): trigger_pos = self.trace_log[last_trigger_pos:].lower().find(trigger.lower()) -- cgit v1.2.3-70-g09d2 From 92d9af970d0ea1d318c20bf0d6c1ec05168b5824 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 17:27:53 +0100 Subject: Fixing issues with the spawning of containers. --- archinstall.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/archinstall.py b/archinstall.py index f449c133..7ecb338a 100644 --- a/archinstall.py +++ b/archinstall.py @@ -319,10 +319,9 @@ class sys_command():#Thread): for trigger in list(self.kwargs['events']): if type(trigger) != bytes: original = self.kwargs['events'][trigger] - del(self.kwargs['events'][trigger]) - trigger = bytes(original, 'UTF-8') self.kwargs['events'][trigger] = self.kwargs['events'][original] + del(self.kwargs['events'][original]) if type(self.kwargs['events'][trigger]) != bytes: self.kwargs['events'][trigger] = bytes(self.kwargs['events'][trigger], 'UTF-8') -- cgit v1.2.3-70-g09d2 From 3ba199628bdd21f908e5c1934f302183aac2e3b5 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 17:38:22 +0100 Subject: Fixing issues with the spawning of containers. --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index 7ecb338a..f25c3f0a 100644 --- a/archinstall.py +++ b/archinstall.py @@ -318,7 +318,7 @@ class sys_command():#Thread): if 'events' in self.kwargs: for trigger in list(self.kwargs['events']): if type(trigger) != bytes: - original = self.kwargs['events'][trigger] + original = trigger trigger = bytes(original, 'UTF-8') self.kwargs['events'][trigger] = self.kwargs['events'][original] del(self.kwargs['events'][original]) -- cgit v1.2.3-70-g09d2 From 9eb80c139ff76b0bb02568911625c6c12b7b6bdf Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 17:39:47 +0100 Subject: Fixing rerun --- archinstall.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/archinstall.py b/archinstall.py index f25c3f0a..b1814ed6 100644 --- a/archinstall.py +++ b/archinstall.py @@ -1297,6 +1297,8 @@ if __name__ == '__main__': update_git(pre_conf['git-branch']) del(pre_conf['git-branch']) + rerun = args['ignore-rerun'] + ## Prerequisit steps needs to NOT be executed in arch-chroot. ## Mainly because there's no root structure to chroot into. ## But partly because some configurations need to be done against the live CD. -- cgit v1.2.3-70-g09d2 From cb3d16b0bbec1a45c32fe3ac2e98e6c256f3d6b9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 17:47:21 +0100 Subject: Fixed password prompt for nspawn --- archinstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall.py b/archinstall.py index b1814ed6..5635561e 100644 --- a/archinstall.py +++ b/archinstall.py @@ -1125,7 +1125,7 @@ def run_post_install_steps(*positionals, **kwargs): ## [root@ ~]# defaults = { 'login:' : 'root\n', - #'Password:' : args['password']+'\n', + 'Password:' : args['password']+'\n', '[root@{args["hostname"]} ~]#' : command+'\n', } if not 'events' in opts: opts['events'] = {} -- cgit v1.2.3-70-g09d2 From bf32476bfd92af8280c17bc04fe73a3932e01b7d Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 17:56:27 +0100 Subject: Fixing password order for commnaads --- archinstall.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/archinstall.py b/archinstall.py index 5635561e..2f22f94c 100644 --- a/archinstall.py +++ b/archinstall.py @@ -1356,6 +1356,14 @@ if __name__ == '__main__': add_AUR_support() print('[N] AUR support added. use "yay -Syy --noconfirm " to deploy in POST.') + ## == Passwords + # o = sys_command('arch-chroot /mnt usermod --password {} root'.format(args['password'])) + # o = sys_command("arch-chroot /mnt sh -c 'echo {pin} | passwd --stdin root'".format(pin='"{pin}"'.format(**args, pin=args['password'])), echo=True) + o = simple_command("/usr/bin/arch-chroot /mnt sh -c \"echo 'root:{pin}' | chpasswd\"".format(**args, pin=args['password'])) + if 'user' in args: + o = ('/usr/bin/arch-chroot /mnt useradd -m -G wheel {user}'.format(**args)) + o = ("/usr/bin/arch-chroot /mnt sh -c \"echo '{user}:{pin}' | chpasswd\"".format(**args, pin=args['password'])) + print('[N] Running post installation steps.') run_post_install_steps() time.sleep(2) @@ -1368,14 +1376,6 @@ if __name__ == '__main__': if args['phone-home']: phone_home(args['phone-home']) - ## == Passwords - # o = sys_command('arch-chroot /mnt usermod --password {} root'.format(args['password'])) - # o = sys_command("arch-chroot /mnt sh -c 'echo {pin} | passwd --stdin root'".format(pin='"{pin}"'.format(**args, pin=args['password'])), echo=True) - o = simple_command("/usr/bin/arch-chroot /mnt sh -c \"echo 'root:{pin}' | chpasswd\"".format(**args, pin=args['password'])) - if 'user' in args: - o = ('/usr/bin/arch-chroot /mnt useradd -m -G wheel {user}'.format(**args)) - o = ("/usr/bin/arch-chroot /mnt sh -c \"echo '{user}:{pin}' | chpasswd\"".format(**args, pin=args['password'])) - if args['post'] == 'reboot': o = simple_command('/usr/bin/umount -R /mnt') o = simple_command('/usr/bin/reboot now') -- cgit v1.2.3-70-g09d2 From 42b697a4e35bfe6248f2b57c7166d5e496b2326b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 29 Nov 2019 18:02:11 +0100 Subject: Debugging --- archinstall.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/archinstall.py b/archinstall.py index 2f22f94c..64c1a164 100644 --- a/archinstall.py +++ b/archinstall.py @@ -1360,6 +1360,8 @@ if __name__ == '__main__': # o = sys_command('arch-chroot /mnt usermod --password {} root'.format(args['password'])) # o = sys_command("arch-chroot /mnt sh -c 'echo {pin} | passwd --stdin root'".format(pin='"{pin}"'.format(**args, pin=args['password'])), echo=True) o = simple_command("/usr/bin/arch-chroot /mnt sh -c \"echo 'root:{pin}' | chpasswd\"".format(**args, pin=args['password'])) + print(o) + time.sleep(5) if 'user' in args: o = ('/usr/bin/arch-chroot /mnt useradd -m -G wheel {user}'.format(**args)) o = ("/usr/bin/arch-chroot /mnt sh -c \"echo '{user}:{pin}' | chpasswd\"".format(**args, pin=args['password'])) -- cgit v1.2.3-70-g09d2