Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit grub d-bus interfaces

git-svn-id: https://camelo.conectiva/repos/projetos/qtlab/mcc2@8798 aeaf0dc8-91d7-0310-8701-e1fc1a66ab8d
  • Loading branch information...
commit d6da7617f5903de03f66e903dbb8e241ac4e5fb3 1 parent 79b4ab3
wiliam authored
View
8 bin/grub-mechanism.py
@@ -0,0 +1,8 @@
+#!/usr/bin/python
+
+import sys
+sys.path.append('/usr/share/mandriva/')
+
+from mcc2.backends.grub.service import Grub
+if __name__ == '__main__':
+ Grub.main()
View
17 dbus/org.mandrivalinux.mcc2.Grub.conf
@@ -0,0 +1,17 @@
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy user="root">
+ <allow own="org.mandrivalinux.mcc2.Grub"/>
+ </policy>
+
+ <policy context="default">
+ <allow send_destination="org.mandrivalinux.mcc2.Grub"
+ send_interface="org.mandrivalinux.mcc2.Grub"/>
+ <allow send_destination="org.mandrivalinux.mcc2.Grub"
+ send_interface="org.freedesktop.DBus.Introspectable"/>
+ <allow send_destination="org.mandrivalinux.mcc2.Grub"
+ send_interface="org.freedesktop.DBus.Properties"/>
+ </policy>
+</busconfig>
View
4 dbus/org.mandrivalinux.mcc2.Grub.service
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.mandrivalinux.mcc2.Grub
+Exec=/usr/share/mandriva/bin/grub-mechanism.py
+User=root
View
7 examples/grub/list-titles.py
@@ -0,0 +1,7 @@
+import dbus
+bus = dbus.SystemBus()
+proxy = bus.get_object(
+ 'org.mandrivalinux.mcc2.Grub',
+ '/org/mandrivalinux/mcc2/Grub')
+interface = dbus.Interface(proxy, 'org.mandrivalinux.mcc2.Grub')
+print interface.ListTiles():
View
0  mcc2/backends/grub/__init__.py
No changes.
View
48 mcc2/backends/grub/service.py
@@ -0,0 +1,48 @@
+import gobject
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+
+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+from mcc2.parsers.grub.GrubConfig import GrubConfig
+
+from mcc2.backends.policykit import check_authorization
+
+__all__ = ['Grub']
+
+class Grub(dbus.service.Object):
+ def __init__(self):
+ self.__bus = dbus.SystemBus()
+
+ bus_name = dbus.service.BusName(
+ "org.mandrivalinux.mcc2.Grub",
+ bus=self.__bus)
+
+ dbus.service.Object.__init__(
+ self,
+ bus_name,
+ "/org/mandrivalinux/mcc2/Grub")
+
+ self.__loop = gobject.MainLoop()
+ self.__grub = grub = GrubConfig()
+ self.__grub.parse()
+
+
+ @dbus.service.method("org.mandrivalinux.mcc2.Grub",
+ out_signature='a{sv}')
+ def ListTitles(self):
+ return self.__grub.get_title_blocks()
+
+
+ def run(self):
+ self.__loop.run()
+
+
+ @classmethod
+ def main(cls):
+ sshd = cls()
+ try:
+ sshd.run()
+ except KeyboardInterrupt:
+ pass
View
29 policykit/org.mandrivalinux.mcc2.grub.policy
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+<policyconfig>
+ <vendor>Mandriva Linux</vendor>
+ <vendor_url>http://www.mandriva.com</vendor_url>
+<!--
+ <action id="org.mandrivalinux.mcc2.grub.optionvalue">
+ <description>Option Value</description>
+ <message>Authentication is required</message>
+ <defaults>
+ <allow_any>no</allow_any>
+ <allow_inactive>no</allow_inactive>
+ <allow_active>yes</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.mandrivalinux.mcc2.grub.deleteoption">
+ <description>Remove Option</description>
+ <message>Authentication is required to remove sshd option</message>
+ <defaults>
+ <allow_any>no</allow_any>
+ <allow_inactive>no</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ </action>
+ -->
+</policyconfig>
Please sign in to comment.
Something went wrong with that request. Please try again.