Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions data/io.elementary.settings-daemon.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@
<summary>When updates were last refreshed</summary>
<description>When the cache was last refreshed and checked for updates in unix utc.</description>
</key>
<key type="x" name="refresh-interval">
<default>86400</default>
<summary>How often to check for updates</summary>
<description>How often to check for updates in seconds.</description>
</key>
</schema>

<schema path="/io/elementary/settings-daemon/power/" id="io.elementary.settings-daemon.power">
Expand Down
8 changes: 8 additions & 0 deletions data/io.elementary.settings-daemon.system-update.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=Check for system updates daily
ConditionACPower=true
After=network.target network-online.target systemd-networkd.service NetworkManager.service connman.service

[Service]
Type=oneshot
ExecStart=@busctl_path@ --user call io.elementary.settings-daemon /io/elementary/settings_daemon io.elementary.settings_daemon.SystemUpdate CheckForUpdates bb false true
11 changes: 11 additions & 0 deletions data/io.elementary.settings-daemon.system-update.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Check for system updates daily

[Timer]
OnCalendar=daily
OnStartupSec=60
RandomizedDelaySec=60
Persistent=true

[Install]
WantedBy=timers.target
18 changes: 17 additions & 1 deletion data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ i18n.merge_file(

busctl_path = get_option('busctlpath')
systemd_system_unit_dir = get_option('systemdsystemunitdir')
systemd_user_unit_dir = get_option('systemduserunitdir')

if systemd_system_unit_dir != 'no'
if systemd_system_unit_dir != 'no' and systemd_user_unit_dir != 'no'
systemd = dependency('systemd')
if systemd_system_unit_dir == ''
systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir', pkgconfig_define: ['rootprefix', prefix])
endif
if systemd_user_unit_dir == ''
systemd_user_unit_dir = systemd.get_variable('systemduserunitdir', pkgconfig_define: ['prefix', prefix])
endif
if busctl_path == ''
busctl_path = systemd.get_variable('prefix') / 'bin' / 'busctl'
endif
Expand All @@ -71,4 +75,16 @@ if systemd_system_unit_dir != 'no'
meson.project_name() + '.check-for-firmware-updates.timer',
install_dir: systemd_system_unit_dir
)

configure_file(
input: meson.project_name() + '.system-update.service.in',
output: meson.project_name() + '.system-update.service',
configuration: service_config,
install_dir: systemd_user_unit_dir
)

install_data(
meson.project_name() + '.system-update.timer',
install_dir: systemd_user_unit_dir
)
endif
7 changes: 0 additions & 7 deletions src/Backends/SystemUpdate.vala
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ public class SettingsDaemon.Backends.SystemUpdate : Object {
} catch (Error e) {
warning ("Couldn't determine last offline results: %s", e.message);
}

check_for_updates.begin (false, true);

Timeout.add_seconds ((uint) settings.get_int64 ("refresh-interval"), () => {
check_for_updates.begin (false, true);
return Source.CONTINUE;
});
}

public async void check_for_updates (bool force, bool notify) throws DBusError, IOError {
Expand Down