Class: Yast::PackageKitClass
- Inherits:
-
Module
- Object
- Module
- Yast::PackageKitClass
- Defined in:
- library/packages/src/modules/PackageKit.rb
Instance Method Summary collapse
-
#IsRunning ⇒ Boolean
Check whether PackageKit daemon is running.
- #main ⇒ Object
-
#SuggestQuit ⇒ Object
Ask the PackageKit daemon to quit If a transaction is in progress the daemon will not quit, you have to check the current status using isRunning() function.
Instance Method Details
#IsRunning ⇒ Boolean
Check whether PackageKit daemon is running
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'library/packages/src/modules/PackageKit.rb', line 38 def IsRunning cmd = "/usr/bin/dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply " \ "--reply-timeout=200 / org.freedesktop.DBus.NameHasOwner string:org.freedesktop.PackageKit" Builtins.y2milestone("Checking PackageKit status: %1", cmd) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) ret = false lines = Builtins.splitstring(Ops.get_string(out, "stdout", ""), "\n") Builtins.foreach(lines) do |line| ret = true if Builtins.regexpmatch(line, "boolean.*true") end Builtins.y2milestone("PackageKit is running: %1", ret) ret end |
#main ⇒ Object
34 |
# File 'library/packages/src/modules/PackageKit.rb', line 34 def main; end |
#SuggestQuit ⇒ Object
Ask the PackageKit daemon to quit If a transaction is in progress the daemon will not quit, you have to check the current status using isRunning() function.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'library/packages/src/modules/PackageKit.rb', line 60 def SuggestQuit cmd = "/usr/bin/dbus-send --system --dest=org.freedesktop.PackageKit --type=method_call " \ "/org/freedesktop/PackageKit org.freedesktop.PackageKit.SuggestDaemonQuit" Builtins.y2milestone("Asking PackageKit to quit: %1", cmd) ret = Convert.to_integer(SCR.Execute(path(".target.bash"), cmd)) Builtins.y2error("dbus-send failed!") if ret != 0 nil end |