Skip to content

dbus: rauc: replace tacd-based update polling with native update polling #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ac2e0c4
tacd: dbus: rauc: re-introspect services
hnez Mar 27, 2025
77aafa2
dbus: systemd: also monitor rauc.service
hnez Apr 2, 2025
a164327
dbus: rauc: add Channels type to use instead of Vec<Channel>
hnez Apr 2, 2025
0833495
dbus: rauc: use a UpdateRequest object instead of a simple URL for in…
hnez Apr 2, 2025
b1d8baa
dbus: rauc: allow restricting installation to a specific manifest_hash
hnez Apr 2, 2025
46cb875
dbus: rauc: remove tacd-based update polling
hnez Apr 2, 2025
6a43333
dbus: rauc: update_channels: add a concept of a single primary channel
hnez Apr 2, 2025
42b959f
dbus: rauc: only install bundles from the primary channel
hnez Apr 2, 2025
2b84818
dbus: rauc: system_conf: write runtime RAUC config with poll section
hnez Apr 2, 2025
008b883
dbus: rauc: reload rauc daemon when required
hnez Apr 2, 2025
632685f
dbus: rauc: trigger a single poll for updates after reloading the daemon
hnez Apr 3, 2025
0ab21a3
dbus: rauc: forward poller status to broker
hnez Apr 2, 2025
911e489
dbus: rauc: add manifest_hash und effective_url to UpstreamBundle
hnez Apr 2, 2025
f6d6b46
dbus: rauc: add support for enabling the auto install feature
hnez Apr 2, 2025
79f970f
dbus: rauc: implement forced polling via update channel files
hnez Mar 31, 2025
e5c3a3c
dbus: rauc: allow configuring the *_criteria in channel files
hnez Mar 31, 2025
31dd189
dbus: rauc: prevent auto updates while in setup mode
hnez Apr 2, 2025
cb89591
web: setup: inform the user about additional headers that are sent now
hnez Apr 2, 2025
9f5d256
web: indicate to the user when a channel is enabled but not primary
hnez Apr 2, 2025
84c6b9e
web: add toggle switches to enable automatic installation of updates
hnez Apr 2, 2025
4e711b3
web: use manifest_hash and effective_url when triggering an install
hnez Apr 2, 2025
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
3 changes: 2 additions & 1 deletion src/dbus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ impl DbusSession {
wtb: &mut WatchedTasksBuilder,
led_dut: Arc<Topic<BlinkPattern>>,
led_uplink: Arc<Topic<BlinkPattern>>,
setup_mode: Arc<Topic<bool>>,
) -> anyhow::Result<Self> {
let tacd = Tacd::new();

Expand All @@ -94,7 +95,7 @@ impl DbusSession {
Ok(Self {
hostname: Hostname::new(bb, wtb, &conn)?,
network: Network::new(bb, wtb, &conn, led_dut, led_uplink)?,
rauc: Rauc::new(bb, wtb, &conn, systemd.rauc.clone())?,
rauc: Rauc::new(bb, wtb, &conn, systemd.rauc.clone(), setup_mode)?,
systemd,
})
}
Expand Down
18 changes: 16 additions & 2 deletions src/dbus/rauc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ async fn channel_list_update_task(
reload: Arc<Topic<bool>>,
enable_polling: Arc<Topic<bool>>,
enable_auto_install: Arc<Topic<bool>>,
setup_mode: Arc<Topic<bool>>,
channels: Arc<Topic<Channels>>,
rauc_service: Service,
) -> Result<()> {
Expand All @@ -215,9 +216,11 @@ async fn channel_list_update_task(
let (reload_stream, _) = reload.subscribe_unbounded();
let (mut enable_polling_stream, _) = enable_polling.subscribe_unbounded();
let (mut enable_auto_install_stream, _) = enable_auto_install.subscribe_unbounded();
let (mut setup_mode_stream, _) = setup_mode.subscribe_unbounded();

let mut enable_polling = enable_polling_stream.next().await.unwrap_or(false);
let mut enable_auto_install = enable_auto_install_stream.next().await.unwrap_or(false);
let mut setup_mode = setup_mode_stream.next().await.unwrap_or(true);

'reload_loop: loop {
futures::select! {
Expand All @@ -232,6 +235,9 @@ async fn channel_list_update_task(
enable_auto_install_new = enable_auto_install_stream.recv().fuse() => {
enable_auto_install = enable_auto_install_new?;
}
setup_mode_new = setup_mode_stream.recv().fuse() => {
setup_mode = setup_mode_new?;
}
};

// Read the list of available update channels
Expand All @@ -243,8 +249,12 @@ async fn channel_list_update_task(
}
};

let should_reload =
update_system_conf(new_channels.primary(), enable_polling, enable_auto_install)?;
let should_reload = update_system_conf(
new_channels.primary(),
enable_polling,
enable_auto_install,
setup_mode,
)?;

channels.set(new_channels);

Expand Down Expand Up @@ -329,6 +339,7 @@ impl Rauc {
wtb: &mut WatchedTasksBuilder,
_conn: &Arc<Connection>,
rauc_service: Service,
setup_mode: Arc<Topic<bool>>,
) -> Result<Self> {
let inst = Self::setup_topics(bb);

Expand All @@ -344,6 +355,7 @@ impl Rauc {
inst.reload.clone(),
inst.enable_polling.clone(),
inst.enable_auto_install.clone(),
setup_mode,
inst.channels.clone(),
rauc_service,
),
Expand All @@ -358,6 +370,7 @@ impl Rauc {
wtb: &mut WatchedTasksBuilder,
conn: &Arc<Connection>,
rauc_service: Service,
setup_mode: Arc<Topic<bool>>,
) -> Result<Self> {
let inst = Self::setup_topics(bb);

Expand Down Expand Up @@ -613,6 +626,7 @@ impl Rauc {
inst.reload.clone(),
inst.enable_polling.clone(),
inst.enable_auto_install.clone(),
setup_mode,
inst.channels.clone(),
rauc_service,
),
Expand Down
8 changes: 7 additions & 1 deletion src/dbus/rauc/system_conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ pub fn update_system_conf(
primary_channel: Option<&Channel>,
enable_polling: bool,
enable_auto_install: bool,
setup_mode: bool,
) -> std::io::Result<bool> {
let dynamic_conf = {
// Allow force-enabling update polling and automatic installations
Expand All @@ -86,8 +87,13 @@ pub fn update_system_conf(
.and_then(|pc| pc.force_auto_install)
.unwrap_or(false);

// Allow polling for updates, but not automatically installing them
// while the user is still in setup mode.
// Otherwise they may unbox a TAC, click through the setup process,
// activate auto installation, and then an installation starts in the
// background without them even noticing.
let polling = enable_polling || force_polling;
let auto_install = enable_auto_install || force_auto_install;
let auto_install = (enable_auto_install || force_auto_install) && !setup_mode;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this use the inhibit file mechanism to prevent polling while in setup mode?


match poll_section(primary_channel, polling, auto_install) {
Ok(Some(ps)) => {
Expand Down
25 changes: 16 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,23 @@ async fn init(screenshooter: ScreenShooter) -> Result<(Ui, WatchedTasksBuilder)>
adc.iobus_curr.fast.clone(),
adc.iobus_volt.fast.clone(),
)?;

// Set up a http server and provide some static files like the web
// interface and config files that may be edited inside the web ui.
let mut http_server = HttpServer::new();

// Allow editing some aspects of the TAC configuration when in "setup mode".
let setup_mode = SetupMode::new(&mut bb, &mut wtb, &mut http_server.server)?;

let (hostname, network, rauc, systemd) = {
let dbus =
DbusSession::new(&mut bb, &mut wtb, led.eth_dut.clone(), led.eth_lab.clone()).await?;
let dbus = DbusSession::new(
&mut bb,
&mut wtb,
led.eth_dut.clone(),
led.eth_lab.clone(),
setup_mode.setup_mode.clone(),
)
.await?;

(dbus.hostname, dbus.network, dbus.rauc, dbus.systemd)
};
Expand All @@ -123,13 +137,6 @@ async fn init(screenshooter: ScreenShooter) -> Result<(Ui, WatchedTasksBuilder)>
// (if requested on start).
let watchdog = Watchdog::new(dut_pwr.tick());

// Set up a http server and provide some static files like the web
// interface and config files that may be edited inside the web ui.
let mut http_server = HttpServer::new();

// Allow editing some aspects of the TAC configuration when in "setup mode".
let setup_mode = SetupMode::new(&mut bb, &mut wtb, &mut http_server.server)?;

// Expose a live log of the TAC's systemd journal so it can be viewed
// in the web interface.
journal::serve(&mut http_server.server);
Expand Down