/usr/share/system-config-lvm/system-config-lvm.py is in system-config-lvm 1.1.18-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | #!/usr/bin/python
"""Entry point for system-config-lvm.
This application wraps the LVM2 command line
interface in a graphical user interface.
"""
import sys
import types
import select
import signal
import string
import os
PROGNAME = "system-config-lvm"
INSTALLDIR="/usr/share/system-config-lvm"
VERSION = "1.1.18"
### gettext ("_") must come before import gtk ###
import gettext
gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
gettext.textdomain(PROGNAME)
try:
gettext.install(PROGNAME, "/usr/share/locale", 1)
except IOError:
import __builtin__
__builtin__.__dict__['_'] = unicode
### gettext first, then import gtk (exception prints gettext "_") ###
try:
import gtk
import gtk.glade
except RuntimeError, e:
print _("""
Unable to initialize graphical environment. Most likely cause of failure
is that the tool was not run using a graphical environment. Please either
start your graphical user interface or set your DISPLAY variable.
Caught exception: %s
""") % e
sys.exit(-1)
from lvm_model import lvm_model, lvm_conf_get_locking_type
from Volume_Tab_View import Volume_Tab_View
from lvmui_constants import *
import gnome
import gnome.ui
gnome.program_init (PROGNAME, VERSION)
gnome.app_version = VERSION
FORMALNAME=_("system-config-lvm")
ABOUT_VERSION=_("%s %s") % ('system-config-lvm',VERSION)
from execute import execWithCapture
from Cluster import Cluster
###############################################
class baselvm:
def __init__(self, glade_xml, app):
# check locking type
locking_type = lvm_conf_get_locking_type()
if locking_type != 1:
should_exit = False
if locking_type == 0:
msg = _("LVM locks are disabled!!! \nMassive data corruption may occur.\nEnable locking (locking_type=1, 2 or 3 in /etc/lvm/lvm.conf).")
should_exit = True
elif locking_type == 2 or locking_type == 3:
ps_out = execWithCapture('/bin/ps', ['/bin/ps', '-A'])
if ps_out.find('clvmd') == -1:
msg = _("LVM is configured to use Cluster Locking mechanism, but clvmd daemon is not running. Start daemon with command:\nservice clvmd start \nor, turn off cluster locking (locking_type=1 in /etc/lvm/lvm.conf).")
should_exit = True
else:
if not Cluster().running():
msg = _("LVM is configured to use Cluster Locking mechanism, but cluster is not quorate.\nEither wait until cluster is quorate or turn off cluster locking (locking_type=1 in /etc/lvm/lvm.conf).")
should_exit = True
else:
msg = _("%s only supports file and cluster based lockings (locking_type=1, 2 or 3 in /etc/lvm/lvm.conf).")
msg = msg % PROGNAME
should_exit = True
if should_exit:
dlg = gtk.MessageDialog(None, 0,
gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
msg)
dlg.run()
sys.exit(10)
#Need to suppress the spewing of file descriptor errors to terminal
os.environ["LVM_SUPPRESS_FD_WARNINGS"] = "1"
self.lvmm = lvm_model()
self.main_win = app
self.glade_xml = glade_xml
self.volume_tab_view = Volume_Tab_View(glade_xml, self.lvmm, self.main_win)
self.glade_xml.signal_autoconnect(
{
"on_quit1_activate" : self.quit,
"on_about1_activate" : self.on_about,
"on_reload_lvm_activate" : self.on_reload
}
)
def on_about(self, *args):
dialog = gnome.ui.About(
ABOUT_VERSION,
'', ### Don't specify version - already in ABOUT_VERSION
_("Copyright (c) 2004 Red Hat, Inc. All rights reserved."),
_("This software is licensed under the terms of the GPL."),
[ 'Stanko Kupcevic (system-config-lvm) <kupcevic at redhat.com>',
'Jim Parsons (system-config-lvm) <jparsons at redhat.com>',
'Alasdair Kergon (LVM2 Maintainer) <agk at redhat.com>',
'Heinz Mauelshagen (LVM Maintainer) <mauelshagen at redhat.com>',
'',
'Kevin Anderson (Project Leader) <kanderso at redhat.com>'],
[ 'Paul Kennedy <pkennedy at redhat.com>',
'John Ha <jha at redhat.com>'], # doc people
) ### end dialog
dialog.set_title (FORMALNAME)
dialog.show()
def on_reload(self, *args):
self.volume_tab_view.reset_tree_model()
def quit(self, *args):
gtk.main_quit()
#############################################################
def initGlade():
gladepath = "lvui.glade"
if not os.path.exists(gladepath):
gladepath = "%s/%s" % (INSTALLDIR,gladepath)
gtk.glade.bindtextdomain(PROGNAME)
glade_xml = gtk.glade.XML (gladepath, domain=PROGNAME)
return glade_xml
def runFullGUI():
glade_xml = initGlade()
gtk.window_set_default_icon_from_file(INSTALLDIR + '/pixmaps/lv_icon.png')
app = glade_xml.get_widget('window1')
app.set_icon_from_file(INSTALLDIR + '/pixmaps/lv_icon.png')
blvm = baselvm(glade_xml, app)
app.show()
app.connect("destroy", lambda w: gtk.main_quit())
gtk.main()
if __name__ == "__main__":
cmdline = sys.argv[1:]
sys.argv = sys.argv[:1]
if os.getuid() != 0:
print _("Please restart %s with root permissions!") % (sys.argv[0])
sys.exit(10)
runFullGUI()
|