-
Notifications
You must be signed in to change notification settings - Fork 19
/
driver.py
63 lines (50 loc) · 1.47 KB
/
driver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-only
import sys
# user-interface stuff:
from snack import *
import tui.installer
import tui.installer.screens
import tui.progress
import util
# backend
import repository
# general
from version import *
from xcp import logger
def doInteractiveLoadDriver(ui, answers):
media = None
address = None
required_repo_list = []
loaded_drivers = []
rc = ui.init.driver_disk_sequence(answers, answers['driver-repos'])
if rc:
media, address = rc
repos = answers['repos']
# now load the drivers:
for r in repos:
logger.log("Processing repo %s" % r)
try:
r.installPackages(lambda x: (), {'root': '/'})
answers['driver-repos'].append(str(r))
ButtonChoiceWindow(
ui.screen,
"Drivers Loaded",
"Loaded %s." % r.name(),
['Ok'])
except Exception as e:
logger.logException(e)
ButtonChoiceWindow(
ui.screen,
"Problem Loading Driver",
"Setup was unable to load the device driver.",
['Ok']
)
return media, address
def main(args):
if len(doInteractiveLoadDriver(tui, {})) > 0:
return 0
else:
return 1
if __name__ == "__main__":
sys.exit(main(util.splitArgs(sys.argv[1:])))