From eaae9d910f7e88cd2cb41d1f767638e5ef833ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20M=C3=BCller?= Date: Mon, 2 Sep 2019 14:18:17 -0400 Subject: [PATCH] [modules] add mkdir and rmdir for 'opt/mhwd' --- src/modules/mhwdcfg/main.py | 8 ++++++++ src/modules/postcfg/main.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/modules/mhwdcfg/main.py b/src/modules/mhwdcfg/main.py index 717596c57..5335e3e87 100644 --- a/src/modules/mhwdcfg/main.py +++ b/src/modules/mhwdcfg/main.py @@ -72,9 +72,16 @@ class MhwdController: def mount(self, mp): call(["mount", "-B", "/" + mp, join(self.root, mp)]) + def rmdir(self, dir): + subprocess.call(["rm", "-Rf", join(self.root, dir)]) + + def mkdir(self, dir): + subprocess.call(["mkdir", "-p", "/" + mp, join(self.root, dir)]) + def configure(self, name, id): cmd = ["mhwd", "-a", str(name), str(self.driver), str(id).zfill(4)] if self.local: + self.mkdir("opt/mhwd") self.mount("opt/mhwd") self.mount("var/lib/mhwd") cmd.extend(["--pmconfig", self.repo]) @@ -84,6 +91,7 @@ class MhwdController: if self.local: self.umount("opt/mhwd") + self.rmdir("opt/mhwd") self.umount("var/lib/mhwd") self.umount("etc/resolv.conf") diff --git a/src/modules/postcfg/main.py b/src/modules/postcfg/main.py index 80b030165..90b454e16 100644 --- a/src/modules/postcfg/main.py +++ b/src/modules/postcfg/main.py @@ -68,6 +68,12 @@ class ConfigController: def mount(self, mp): subprocess.call(["mount", "-B", "/" + mp, join(self.root, mp)]) + def rmdir(self, dir): + subprocess.call(["rm", "-Rf", join(self.root, dir)]) + + def mkdir(self, dir): + subprocess.call(["mkdir", "-p", "/" + mp, join(self.root, dir)]) + def run(self): self.init_keyring() self.populate_keyring() @@ -118,10 +124,12 @@ class ConfigController: else: # For PoC we added the Office Packages to mhwd-live overlay in 18.1.0 cmd = ["pacman", "-S", office_package, "--noconfirm", "--config", "/opt/mhwd/pacman-mhwd.conf" ] + self.mkdir("opt/mhwd") self.mount("opt/mhwd") self.mount("etc/resolv.conf") target_env_call(cmd) self.umount("opt/mhwd") + self.rmdir("opt/mhwd") self.umount("etc/resolv.conf") return None