3
from DistUpgradeMain import main
3
from DistUpgradeController import DistUpgradeController
4
from DistUpgradeConfigParser import DistUpgradeConfig
8
from optparse import OptionParser
9
from gettext import gettext as _
5
11
if __name__ == "__main__":
13
parser = OptionParser()
14
parser.add_option("-c", "--cdrom", dest="cdromPath", default=None,
15
help=_("Use the given path to search for a cdrom with upgradable packages"))
16
parser.add_option("--have-prerequists", dest="havePrerequists",
17
action="store_true", default=False)
18
parser.add_option("--with-network", dest="withNetwork",action="store_true")
19
parser.add_option("--without-network", dest="withNetwork",action="store_false")
20
parser.add_option("--frontend", dest="frontend",default=None,
21
help=_("Use frontend. Currently available: \n"\
22
"DistUpgradeViewText, DistUpgradeViewGtk, DistUpgradeViewKDE"))
23
parser.add_option("--mode", dest="mode",default="desktop",
24
help=_("*DEPRECATED* this option will be ignore"))
25
parser.add_option("--partial", dest="partial", default=False,
27
help=_("Perform a partial upgrade only (no sources.list rewriting)"))
28
parser.add_option("--datadir", dest="datadir", default=None,
29
help=_("Set datadir"))
30
(options, args) = parser.parse_args()
32
config = DistUpgradeConfig(".")
34
logdir = config.getWithDefault("Files","LogDir","/var/log/dist-upgrade/")
35
if not os.path.exists(logdir):
37
fname = os.path.join(logdir,"main.log")
38
# do not overwrite the default main.log
41
logging.basicConfig(level=logging.DEBUG,
43
format='%(asctime)s %(levelname)s %(message)s',
46
from DistUpgradeVersion import VERSION
47
logging.info("release-upgrader version '%s' started" % VERSION)
49
# the commandline overwrites the configfile
50
for requested_view in [options.frontend]+config.getlist("View","View"):
51
if not requested_view:
54
view_modul = __import__(requested_view)
55
view_class = getattr(view_modul, requested_view)
57
except (ImportError, AttributeError, TypeError), e:
58
logging.warning("can't import view '%s' (%s)" % (requested_view,e))
59
print "can't load %s (%s)" % (requested_view, e)
61
logging.error("No view can be imported, aborting")
62
print "No view can be imported, aborting"
66
view = view_class(logdir=logdir)
67
app = DistUpgradeController(view, options, datadir=options.datadir)
69
# partial upgrade only
71
if not app.doPartialUpgrade():