只有在需要关机安装时才获取锁
This commit is contained in:
parent
efa7cfe23c
commit
ffb3028095
|
@ -906,13 +906,13 @@ class UpdateInstallMode():
|
|||
from gi.repository import Gio, GLib
|
||||
connection = Gio.bus_get_sync(Gio.BusType.SYSTEM)
|
||||
|
||||
# #首先设置systemd默认延长时间为1800
|
||||
# bus = dbus.SystemBus()
|
||||
# logind_proxy = bus.get_object('org.freedesktop.login1', '/org/freedesktop/login1')
|
||||
# getter_interface = dbus.Interface(
|
||||
# logind_proxy,
|
||||
# dbus_interface='org.freedesktop.login1.Manager')
|
||||
# ret = getter_interface.SetInhibitDelayMaxSec(1800)
|
||||
#首先设置systemd默认延长时间为1800
|
||||
bus = dbus.SystemBus()
|
||||
logind_proxy = bus.get_object('org.freedesktop.login1', '/org/freedesktop/login1')
|
||||
getter_interface = dbus.Interface(
|
||||
logind_proxy,
|
||||
dbus_interface='org.freedesktop.login1.Manager')
|
||||
ret = getter_interface.SetInhibitDelayMaxSec(1800)
|
||||
|
||||
var, fdlist = connection.call_with_unix_fd_list_sync(
|
||||
'org.freedesktop.login1', '/org/freedesktop/login1',
|
||||
|
@ -958,11 +958,6 @@ class UpdateInstallMode():
|
|||
|
||||
self._start_install_shutdown()
|
||||
|
||||
#只要是关机更新模式就监听抑制关机
|
||||
self.inhibit_lock = self._inhibit_sleep()
|
||||
if self.inhibit_lock == None:
|
||||
logging.error("Prepare inhibit lock failed...")
|
||||
|
||||
self.logind_proxy.connect_to_signal(
|
||||
"PrepareForShutdown", prepare_for_shutdown_handler)
|
||||
|
||||
|
@ -992,3 +987,10 @@ class UpdateInstallMode():
|
|||
else:
|
||||
logging.info("No need to shutdown install in the normal model...")
|
||||
return 0
|
||||
|
||||
def get_inhibit_lock(self):
|
||||
#只要是关机更新模式就监听抑制关机
|
||||
if self.inhibit_lock == None:
|
||||
self.inhibit_lock = self._inhibit_sleep()
|
||||
if self.inhibit_lock == None:
|
||||
logging.error("Prepare inhibit lock failed...")
|
||||
|
|
|
@ -642,6 +642,8 @@ class InstallBackend():
|
|||
|
||||
#如果下载成功 就标志需要 安装重启
|
||||
if success == True:
|
||||
#安装成功的话再获取关机锁
|
||||
self.window_main.install_mode.get_inhibit_lock()
|
||||
self.window_main.configs.setValue("InstallMode","manual_install",str(True),True)
|
||||
else:
|
||||
self.window_main.configs.setValue("InstallMode","manual_install",str(False),True)
|
||||
|
|
|
@ -7,7 +7,7 @@ Type=dbus
|
|||
Restart=always
|
||||
RestartSec=3
|
||||
BusName=com.kylin.systemupgrade
|
||||
ExecStart=/usr/share/kylin-system-updater/kylin-system-updater -n
|
||||
ExecStart=/usr/share/kylin-system-updater/kylin-system-updater
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue