forked from dell/dell-recovery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dell-driver-installer
60 lines (52 loc) · 2.08 KB
/
dell-driver-installer
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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Dell Driver Installer
#
# Copyright (C) 2012 Dell Inc,
# Author: Mario Limonciello
#
# This 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 2 of the License, or at your option)
# any later version.
#
# This program 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 this application; if not, write to the Free Software Foundation, Inc., 51
# Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##################################################################################
from Dell.recovery_common import find_partition
import subprocess
from Dell.driver_gtk import DriverGTK
import argparse
import logging
def setup_logging(debug=False, logfile=None):
'''Setup logging.'''
logging.raiseExceptions = False
if debug:
logging.basicConfig(level=logging.DEBUG, filename=logfile,
format='%(asctime)s %(levelname)s: %(message)s')
else:
logging.basicConfig(level=logging.WARNING, filename=logfile,
format='%(levelname)s: %(message)s')
parser = argparse.ArgumentParser()
parser.add_argument('fname', nargs='?', default='')
parser.add_argument ('--debug', action='store_true',
dest='debug', default=False,
help='Enable debugging messages.')
parser.add_argument ('--logfile', metavar='FILE', dest='logfile', default=None,
help='Write logging messages to a file instead to stderr.')
parser_args = parser.parse_args()
setup_logging(parser_args.debug, parser_args.logfile)
if __name__ == '__main__':
import dbus.mainloop.glib
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
recovery = find_partition()
args = (recovery, parser_args.fname, 'driver')
tool = DriverGTK(*args)
tool.run()