Kaydet (Commit) e4d703a9 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Little changes

üst c39a0db4
......@@ -103,8 +103,3 @@ INSTALL (FILES
INSTALL (PROGRAMS tools/hav.py
DESTINATION /usr/bin
RENAME hav)
# Install hav to /usr/bin/scom2to3
INSTALL (PROGRAMS tools/scom2to3.py
DESTINATION /usr/bin
RENAME scom2to3)
[D-BUS Service]
Name=tr.org.sulin.scom2
Exec=/usr/sbin/scom -i -b tr.org.sulin.comar2
Exec=/usr/sbin/scom -i -b tr.org.sulin.scom2
User=root
<scomModel>
<interface name="Core">
<method name="register" action_id="">
<method name="register" action_id="tr.org.sulin.scom.register">
<arg name="model" type="s" direction="in"/>
<arg name="package" type="s" direction="in"/>
<arg name="script" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="remove" action_id="">
<method name="remove" action_id="tr.org.sulin.scom.remove">
<arg name="package" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
......
......@@ -32,7 +32,7 @@
<action id="tr.org.sulin.scom.system.package.preremove">
<description>Execute pre-remove script of a package</description>
<description xml:lang="tr">Bir paketin kaldırma öncesi betiğini çalıştır</description>
<description xml:lang="nl">Voer pre-verwijder script van een pakket uit</description>
<description xml:lang="nl">Voer pre-verwijder script van een pakket uit</description>
<description xml:lang="fr">Exécuter les scripts de préparation à la suppression d'un paquet</description>
<description xml:lang="es">Ejecutar script de pre-remove de un paquete</description>
<description xml:lang="pl">Wykonywanie skryptów "przed usunięciem" pakietów</description>
......@@ -59,7 +59,7 @@
<description xml:lang="pl">Wykonywanie skryptów "przed usunięciem" pakietów</description>
<description xml:lang="de">Preremove-Skript eines Pakets ausführen</description>
<description xml:lang="sv">Kör skript efter paketborttagning</description>
<description xml:lang="nl">Voer post-verwijder script van een pakket uit</description>
<description xml:lang="nl">Voer post-verwijder script van een pakket uit</description>
<message>System policy prevents executing post-remove script</message>
<message xml:lang="tr">Sistem politikası kaldırma öncesi betiği çalıştırmayı engelliyor</message>
<message xml:lang="fr">Le mode de gestion du système ne permet pas d'exécuter les scripts de préparation à la suppression d'un paquet</message>
......
......@@ -36,7 +36,7 @@
<description xml:lang="fr">Obtenir le statut d'un service</description>
<description xml:lang="es">Obtener estado de servicios</description>
<description xml:lang="pl">Odczyt stanu usługi</description>
<description xml:lang="de">Dienst-Zustand abrufen</description>
<description xml:lang="de">Dienst-Zustand abrufen</description>
<description xml:lang="sv">Visa status för tjänst</description>
<message>System policy prevents getting service status</message>
<message xml:lang="tr">Sistem politikası servis durumunu okumayı engelliyor</message>
......
......@@ -126,7 +126,7 @@ def main():
else:
print(met.call())
except dbus.exceptions.DBusException as e:
if e._dbus_error_name.endswith(".Comar.PolicyKit"):
if e._dbus_error_name.endswith(".Scom.PolicyKit"):
print("Access to '%s' PolicyKit action required." % e.get_dbus_message())
else:
print("Error:")
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
import dbus
import glob
import os
import time
COMAR_DB_OLD = "/var/db/scom/code"
COMAR_DB_NEW = "/var/db/scom3/scripts"
COMAR_ADDRESS = "tr.org.sulin.scom.updated"
COMAR_IFACE = "tr.org.sulin.scom"
COMAR_TIMEOUT = 10
def main():
if os.getuid() != 0:
print("Must be run as root.")
return -1
# If COMAR 3.0 database is already initialized, do nothing.
init = False
ignore_scom = False
if os.path.exists(COMAR_DB_NEW):
for model in os.listdir(COMAR_DB_NEW):
files = os.listdir(os.path.join(COMAR_DB_NEW, model))
if "scom.py" in files:
files.remove("scom.py")
ignore_scom = True
if len(files):
init = True
break
if init:
print("COMAR database is already initialized.")
return 0
bus = dbus.SystemBus()
obj = None
# Old PiSi releases start new COMAR service after all postInstall
# operations complete. We start our own COMAR service so we
# guarantee that we register all scripts to new COMAR.
os.system("/usr/sbin/scom -i -b %s &" % COMAR_ADDRESS)
# Wait until service gets ready
timeout = COMAR_TIMEOUT
while timeout > 0:
try:
obj = bus.get_object(COMAR_ADDRESS, "/", introspect=False)
break
except dbus.exceptions.DBusException:
pass
time.sleep(0.2)
timeout -= 0.2
if not obj:
print("Unable to start new COMAR service.")
return -2
# Register all scripts
for filename in os.listdir(COMAR_DB_OLD):
if filename.endswith(".py"):
_group, _class, _app = filename.split("_", 2)
_model = "%s.%s" % (_group, _class)
_app = _app.rsplit(".py", 1)[0]
# If COMAR package is already registered, pass
if _app == "scom" and ignore_comar:
continue
obj.register(_app, _model, os.path.join(COMAR_DB_OLD, filename), dbus_interface=COMAR_IFACE)
print("Registering %s" % filename)
return 0
if __name__ == "__main__":
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment