This repository has been archived by the owner on Jun 6, 2018. It is now read-only.
forked from calamares/calamares
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.4.x-stable' of github.com:manjaro/calamares into 2.4.…
…x-stable
- Loading branch information
Showing
9 changed files
with
156 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# === This file is part of Calamares - <http://github.com/calamares> === | ||
# | ||
# Copyright 2016, Artoo <[email protected]> | ||
# | ||
# Calamares is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Calamares is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Calamares. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import libcalamares | ||
|
||
from libcalamares.utils import target_env_call, debug | ||
from os.path import join | ||
from subprocess import call | ||
|
||
class MhwdController: | ||
def __init__(self): | ||
self.__root = libcalamares.globalstorage.value( "rootMountPoint" ) | ||
self.__bus = libcalamares.job.configuration.get('bus', []) | ||
self.__identifier = libcalamares.job.configuration.get('identifier', []) | ||
self.__local = libcalamares.job.configuration['local'] | ||
self.__repo = libcalamares.job.configuration['repo'] | ||
self._driver = libcalamares.job.configuration['driver'] | ||
|
||
@property | ||
def driver(self): | ||
return self._driver | ||
|
||
@driver.setter | ||
def driver(self, value): | ||
self._driver = value | ||
|
||
@property | ||
def root(self): | ||
return self.__root | ||
|
||
@property | ||
def local(self): | ||
return self.__local | ||
|
||
@property | ||
def repo(self): | ||
return self.__repo | ||
|
||
@property | ||
def identifier(self): | ||
return self.__identifier | ||
|
||
@property | ||
def bus(self): | ||
return self.__bus | ||
|
||
def umount(self, mp): | ||
call(["umount", "-l", join(self.root, mp)]) | ||
|
||
def mount(self, mp): | ||
call(["mount", "-Br", "/" + mp, join(self.root, mp)]) | ||
|
||
def configure(self, name, id): | ||
cmd = ["mhwd", "-a", str(name), str(self.driver), str(id).zfill(4)] | ||
if self.local: | ||
self.mount("opt") | ||
cmd.extend(["--pmconfig", self.repo]) | ||
|
||
self.mount("etc/resolv.conf") | ||
target_env_call(cmd) | ||
|
||
if self.local: | ||
self.umount("opt") | ||
self.umount("etc/resolv.conf") | ||
|
||
def run(self): | ||
for b in self.bus: | ||
for id in self.identifier['net']: | ||
self.configure(b, id) | ||
for id in self.identifier['video']: | ||
self.configure(b, id) | ||
|
||
return None | ||
|
||
def run(): | ||
""" Configure the hardware """ | ||
|
||
mhwd = MhwdController() | ||
|
||
return mhwd.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
bus: | ||
- pci | ||
# - usb | ||
|
||
identifier: | ||
net: | ||
- 200 | ||
- 280 | ||
video: | ||
- 300 | ||
- 302 | ||
- 380 | ||
|
||
driver: free | ||
|
||
local: true | ||
|
||
repo: /opt/pacman-mhwd.conf |
2 changes: 1 addition & 1 deletion
2
src/modules/hardwarecfg/module.desc → src/modules/mhwdcfg/module.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Syntax is YAML 1.2 | ||
--- | ||
type: "job" | ||
name: "hardwarecfg" | ||
name: "mhwdcfg" | ||
interface: "python" | ||
script: "main.py" #assumed relative to the current directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.