2
# update-manager.in - easy updating application
4
# Copyright (c) 2004-2008 Canonical
5
# 2004-2008 Michael Vogt
8
# Author: Michiel Sikkes <michiel@eyesopened.nl>
9
# Michael Vogt <mvo@debian.org>
11
# This program is free software; you can redistribute it and/or
12
# modify it under the terms of the GNU General Public License as
13
# published by the Free Software Foundation; either version 2 of the
14
# License, or (at your option) any later version.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU General Public License for more details.
21
# You should have received a copy of the GNU General Public License
22
# along with this program; if not, write to the Free Software
23
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26
from __future__ import print_function
28
from gi.repository import Gtk
30
gi.require_version("Gtk", "3.0")
35
from UpdateManager.UpdateManager import UpdateManager
36
from DistUpgrade.DistUpgradeVersion import VERSION
39
from gettext import gettext as _
41
from optparse import OptionParser
43
if __name__ == "__main__":
45
Gtk.init_check(sys.argv)
47
gettext.bindtextdomain("update-manager", "/usr/share/locale")
48
gettext.textdomain("update-manager")
51
locale.setlocale(locale.LC_ALL, "")
55
# Begin parsing of options
56
parser = OptionParser()
57
#FIXME: Workaround a bug in optparser which doesn't handle unicode/str
58
# correctly, see http://bugs.python.org/issue4391
59
# Should be resolved by Python3
60
enc = locale.getpreferredencoding()
61
parser.add_option ("-V", "--version", action="store_true",
62
dest="show_version", default=False,
63
help=_("Show version and exit").decode(enc))
64
parser.add_option ("--data-dir", "",
65
default="/usr/share/update-manager/",
66
help=_("Directory that contains the data files").decode(enc))
67
parser.add_option ("-c", "--check-dist-upgrades", action="store_true",
68
dest="check_dist_upgrades", default=False,
69
help=_("Check if a new Ubuntu release is available").decode(enc))
70
parser.add_option ("-d", "--devel-release", action="store_true",
71
dest="devel_release", default=False,
72
help=_("Check if upgrading to the latest devel release "
73
"is possible").decode(enc))
74
parser.add_option ("-p","--proposed", action="store_true",
75
dest="use_proposed", default=False,
76
help=_("Upgrade using the latest proposed version of the release upgrader").decode(enc))
77
parser.add_option ("--no-focus-on-map", action="store_true",
78
dest="no_focus_on_map", default=False,
79
# TRANSLATORS: this describes the "focus-on-map" gtk
80
# property that controls if a new window takes the
81
# input focus control when it is displayed for the
82
# first time (see also the gtk devhelp page)
83
help=_("Do not focus on map when starting").decode(enc))
84
parser.add_option ("--dist-upgrade", action="store_true",
85
dest="dist_upgrade", default=False,
86
help=_("Try to run a dist-upgrade").decode(enc))
87
parser.add_option ("--no-update", action="store_true",
88
dest="no_update", default=False,
89
help=_("Do not check for updates when starting").decode(enc))
90
parser.add_option ("-s","--sandbox", action="store_true", default=False,
91
# TRANSLATORS: aufs is the name of the filesystem
92
# that is used to create the overlay
93
help=_("Test upgrade with a sandbox aufs overlay").decode(enc))
95
(options, args) = parser.parse_args()
97
#data_dir="/usr/share/update-manager/"
98
#data_dir="/tmp/xxx/share/update-manager/"
99
data_dir = os.path.normpath(options.data_dir)+"/"
101
if options.show_version:
102
print("%s: version %s" % (os.path.basename(sys.argv[0]), VERSION))
105
if options.dist_upgrade == True:
107
#logging.basicConfig(level=logging.DEBUG)
108
from DistUpgrade.DistUpgradeViewGtk3 import DistUpgradeViewGtk3
109
from DistUpgrade.DistUpgradeController import DistUpgradeController
110
# FIXME: Having a "partial upgrade" view here would make it possible
111
# to get rid of the ugly hideStep() stuff
112
view = DistUpgradeViewGtk3(data_dir)
113
view.label_title.set_markup("<b><big>%s</big></b>" % _("Running partial upgrade"))
114
controller = DistUpgradeController(view, datadir=data_dir)
115
controller.doPartialUpgrade()
117
app = UpdateManager(data_dir, options)