Skip to content

Commit 9ab5afc

Browse files
committed
dbus: rauc: implement forced polling via update channel files
1 parent 49ad780 commit 9ab5afc

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,10 @@ components:
11621162
type: string,
11631163
newer_than_installed:
11641164
type: boolean
1165+
force_polling:
1166+
type: boolean
1167+
force_auto_install:
1168+
type: boolean
11651169

11661170
ServiceStatus:
11671171
type: object

src/dbus/rauc/system_conf.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,20 @@ pub fn update_system_conf(
6565
enable_auto_install: bool,
6666
) -> std::io::Result<bool> {
6767
let dynamic_conf = {
68-
match poll_section(primary_channel, enable_polling, enable_auto_install) {
68+
// Allow force-enabling update polling and automatic installations
69+
// via the update channel config file to implement company wide
70+
// auto-update policies.
71+
let force_polling = primary_channel
72+
.and_then(|pc| pc.force_polling)
73+
.unwrap_or(false);
74+
let force_auto_install = primary_channel
75+
.and_then(|pc| pc.force_auto_install)
76+
.unwrap_or(false);
77+
78+
let polling = enable_polling || force_polling;
79+
let auto_install = enable_auto_install || force_auto_install;
80+
81+
match poll_section(primary_channel, polling, auto_install) {
6982
Ok(Some(ps)) => {
7083
// We use the config in /etc as a template ...
7184
let static_conf = read_to_string(STATIC_CONF_PATH)?;

src/dbus/rauc/update_channels.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ pub struct Channel {
5454
pub enabled: bool,
5555
pub primary: bool,
5656
pub bundle: Option<UpstreamBundle>,
57+
pub force_polling: Option<bool>,
58+
pub force_auto_install: Option<bool>,
5759
}
5860

5961
#[derive(Serialize, Deserialize, Clone, PartialEq)]
@@ -66,6 +68,8 @@ pub struct ChannelFile {
6668
pub description: String,
6769
pub url: String,
6870
pub polling_interval: Option<String>,
71+
pub force_polling: Option<bool>,
72+
pub force_auto_install: Option<bool>,
6973
}
7074

7175
#[cfg(not(feature = "demo_mode"))]
@@ -145,6 +149,8 @@ impl Channel {
145149
enabled: false,
146150
primary: false,
147151
bundle: None,
152+
force_polling: channel_file.force_polling,
153+
force_auto_install: channel_file.force_auto_install,
148154
};
149155

150156
ch.update_enabled();

0 commit comments

Comments
 (0)