[mhwdcfg] PEP8 modification
This commit is contained in:
parent
f37c8627a6
commit
e761ae9008
@ -4,6 +4,7 @@
|
|||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2016, Artoo <artoo@manjaro.org>
|
# Copyright 2016, Artoo <artoo@manjaro.org>
|
||||||
|
# Copyright 2016-2017, Philip Müller <philm@manjaro.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -24,74 +25,76 @@ from libcalamares.utils import target_env_call, debug
|
|||||||
from os.path import join
|
from os.path import join
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
|
|
||||||
|
|
||||||
class MhwdController:
|
class MhwdController:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__root = libcalamares.globalstorage.value( "rootMountPoint" )
|
self.__root = libcalamares.globalstorage.value("rootMountPoint")
|
||||||
self.__bus = libcalamares.job.configuration.get('bus', [])
|
self.__bus = libcalamares.job.configuration.get('bus', [])
|
||||||
self.__identifier = libcalamares.job.configuration.get('identifier', [])
|
self.__identifier = libcalamares.job.configuration.get('identifier', [])
|
||||||
self.__local = libcalamares.job.configuration['local']
|
self.__local = libcalamares.job.configuration['local']
|
||||||
self.__repo = libcalamares.job.configuration['repo']
|
self.__repo = libcalamares.job.configuration['repo']
|
||||||
self._driver = libcalamares.job.configuration['driver']
|
self._driver = libcalamares.job.configuration['driver']
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def driver(self):
|
def driver(self):
|
||||||
return self._driver
|
return self._driver
|
||||||
|
|
||||||
@driver.setter
|
@driver.setter
|
||||||
def driver(self, value):
|
def driver(self, value):
|
||||||
self._driver = value
|
self._driver = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def root(self):
|
def root(self):
|
||||||
return self.__root
|
return self.__root
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def local(self):
|
def local(self):
|
||||||
return self.__local
|
return self.__local
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def repo(self):
|
def repo(self):
|
||||||
return self.__repo
|
return self.__repo
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self):
|
def identifier(self):
|
||||||
return self.__identifier
|
return self.__identifier
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bus(self):
|
def bus(self):
|
||||||
return self.__bus
|
return self.__bus
|
||||||
|
|
||||||
def umount(self, mp):
|
def umount(self, mp):
|
||||||
call(["umount", "-l", join(self.root, mp)])
|
call(["umount", "-l", join(self.root, mp)])
|
||||||
|
|
||||||
def mount(self, mp):
|
def mount(self, mp):
|
||||||
call(["mount", "-Br", "/" + mp, join(self.root, mp)])
|
call(["mount", "-Br", "/" + mp, join(self.root, mp)])
|
||||||
|
|
||||||
def configure(self, name, id):
|
def configure(self, name, id):
|
||||||
cmd = ["mhwd", "-a", str(name), str(self.driver), str(id).zfill(4)]
|
cmd = ["mhwd", "-a", str(name), str(self.driver), str(id).zfill(4)]
|
||||||
if self.local:
|
if self.local:
|
||||||
self.mount("opt")
|
self.mount("opt")
|
||||||
cmd.extend(["--pmconfig", self.repo])
|
cmd.extend(["--pmconfig", self.repo])
|
||||||
|
|
||||||
self.mount("etc/resolv.conf")
|
self.mount("etc/resolv.conf")
|
||||||
target_env_call(cmd)
|
target_env_call(cmd)
|
||||||
|
|
||||||
if self.local:
|
if self.local:
|
||||||
self.umount("opt")
|
self.umount("opt")
|
||||||
self.umount("etc/resolv.conf")
|
self.umount("etc/resolv.conf")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
for b in self.bus:
|
for b in self.bus:
|
||||||
for id in self.identifier['net']:
|
for id in self.identifier['net']:
|
||||||
self.configure(b, id)
|
self.configure(b, id)
|
||||||
for id in self.identifier['video']:
|
for id in self.identifier['video']:
|
||||||
self.configure(b, id)
|
self.configure(b, id)
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
""" Configure the hardware """
|
""" Configure the hardware """
|
||||||
|
|
||||||
mhwd = MhwdController()
|
mhwd = MhwdController()
|
||||||
|
|
||||||
return mhwd.run()
|
return mhwd.run()
|
||||||
|
Loading…
Reference in New Issue
Block a user