From d195dbaa52df5cc6aa266d81631b48f861346803 Mon Sep 17 00:00:00 2001 From: David Palao Date: Fri, 29 Nov 2019 14:44:33 +0100 Subject: [PATCH] Seems to be fixed... --- catalyst/base/stagebase.py | 20 ++++++++++++++++++++ catalyst/targets/stage4.py | 5 +++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 85e30450..13951041 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -195,6 +195,7 @@ class StageBase(TargetBase, ClearBase, GenBase): self.set_packages() self.set_rm() self.set_linuxrc() + self.set_users() self.set_busybox_config() self.set_overlay() self.set_portage_overlay() @@ -614,6 +615,16 @@ class StageBase(TargetBase, ClearBase, GenBase): self.settings[self.settings["spec_prefix"] + "/linuxrc"] del self.settings[self.settings["spec_prefix"] + "/linuxrc"] + def set_users(self): + users = self.settings["spec_prefix"] + "/users" + if users in self.settings: + if isinstance(self.settings[users], str): + self.settings["users"] = self.settings[users].split() + self.settings["users"] = self.settings[users] + del self.settings[users] + else: + self.settings["users"] = [] + def set_busybox_config(self): if self.settings["spec_prefix"] + "/busybox_config" in self.settings: if isinstance(self.settings[self.settings['spec_prefix'] + '/busybox_config'], str): @@ -955,6 +966,15 @@ class StageBase(TargetBase, ClearBase, GenBase): cmd(['rsync', '-a', x + '/', self.settings['chroot_path']], env=self.env) + def users(self): + for x in self.settings["users"]: + log.info("Creating user: '%s'", x) + cmd([ + "useradd", "-R", self.settings['chroot_path'], + "-m", "-G", "users,wheel,audio,cdrom,usb", x + ], + env=self.env) + def base_dirs(self): pass diff --git a/catalyst/targets/stage4.py b/catalyst/targets/stage4.py index 71c1f302..5b252472 100644 --- a/catalyst/targets/stage4.py +++ b/catalyst/targets/stage4.py @@ -17,7 +17,8 @@ class stage4(StageBase): "stage4/root_overlay", "stage4/fsscript", "stage4/gk_mainargs", "splash_theme", "portage_overlay", "stage4/rcadd", "stage4/rcdel", - "stage4/linuxrc", "stage4/unmerge", "stage4/rm", "stage4/empty"]) + "stage4/linuxrc", "stage4/unmerge", "stage4/rm", "stage4/users", "stage4/empty", + ]) StageBase.__init__(self,spec,addlargs) def set_cleanables(self): @@ -28,6 +29,6 @@ class stage4(StageBase): "config_profile_link", "setup_confdir", "portage_overlay", "bind", "chroot_setup", "setup_environment", "build_packages", "build_kernel", "bootloader", "root_overlay", "fsscript", - "preclean", "rcupdate", "unmerge", "unbind", "remove", "empty", + "preclean", "rcupdate", "unmerge", "unbind", "remove", "users", "empty", "clean"] self.set_completion_action_sequences() -- 2.23.0