-
Notifications
You must be signed in to change notification settings - Fork 64
/
installer-test
executable file
·55 lines (40 loc) · 1.12 KB
/
installer-test
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
#!/usr/bin/env python3
import gi
gi.require_version('CinnamonDesktop', '3.0')
from gi.repository import CinnamonDesktop, GLib, GObject
import sys
def install_finished_cb(success, data=None):
if success:
print("Install Finished!")
else:
print("Install Failed!")
quit()
def check_finished_cb(success, data=None):
if success:
print("Packages already installed!")
else:
print("Some packages missing!")
quit()
def working_cb():
print("working...")
return True
if (len(sys.argv) < 3 or sys.argv[1] not in ("install", "check")):
print ("""
Usage:
installer-test install|check package_1 [package_2 ...]
""")
quit()
i = 2
pkgs = []
while i < len(sys.argv):
pkgs.append(sys.argv[i])
i+=1
print( "Working with packages: %s" % pkgs )
# Testing non-blocking-ness of the installer
GObject.timeout_add(250, working_cb)
if (sys.argv[1] == "install"):
CinnamonDesktop.installer_install_packages(pkgs, install_finished_cb, None)
else:
CinnamonDesktop.installer_check_for_packages(pkgs, check_finished_cb, None)
ml = GLib.MainLoop.new(None, True)
ml.run()