[modules] add mkdir and rmdir for 'opt/mhwd'

This commit is contained in:
Philip Müller 2019-09-02 14:18:17 -04:00
parent 250093d9f0
commit e797bb0dc5
2 changed files with 16 additions and 0 deletions

View File

@ -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")

View File

@ -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