Skip to content

Commit 0ba8809

Browse files
5310cole-h
andauthored
Persist files added to /etc past system updates in SteamOS 3.6+ (#1355)
* Add atomic update persistence list for SteamOS 3.6+ * Apply suggestions from code review and fix pushing the actual list Co-authored-by: Cole Helbling <cole.helbling@determinate.systems> * fixup: create atomic-update.conf.d entry only if directory exists * fixup: typo in variable name steamos, not streamos lol * fixup: path in test fixture --------- Co-authored-by: Cole Helbling <cole.helbling@determinate.systems>
1 parent 6beefac commit 0ba8809

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

src/planner/steam_deck.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ impl Planner for SteamDeck {
254254
.map_err(PlannerError::Action)?;
255255
actions.push(create_bind_mount_unit.boxed());
256256
} else {
257-
let revert_clean_streamos_nix_offload = RevertCleanSteamosNixOffload::plan()
257+
let revert_clean_steamos_nix_offload = RevertCleanSteamosNixOffload::plan()
258258
.await
259259
.map_err(PlannerError::Action)?;
260-
actions.push(revert_clean_streamos_nix_offload.boxed());
260+
actions.push(revert_clean_steamos_nix_offload.boxed());
261261

262262
let ensure_steamos_nix_directory = EnsureSteamosNixDirectory::plan()
263263
.await
@@ -270,6 +270,27 @@ impl Planner for SteamDeck {
270270
actions.push(start_nix_mount.boxed());
271271
}
272272

273+
if std::path::Path::new("/etc/atomic-update.conf.d").exists() {
274+
let create_atomic_update_buf = "\
275+
/etc/fish/conf.d/nix.fish\n\
276+
/etc/nix/**\n\
277+
/etc/profile.d/nix.sh\n\
278+
/etc/systemd/system/nix-daemon.socket\n\
279+
/etc/tmpfiles.d/nix-daemon.conf\n\
280+
";
281+
let create_atomic_update_unit = CreateFile::plan(
282+
"/etc/atomic-update.conf.d/nix-installer.conf",
283+
None,
284+
None,
285+
0o0644,
286+
create_atomic_update_buf.to_string(),
287+
false,
288+
)
289+
.await
290+
.map_err(PlannerError::Action)?;
291+
actions.push(create_atomic_update_unit.boxed());
292+
}
293+
273294
let ensure_symlinked_units_resolve_buf = "\
274295
[Unit]\n\
275296
Description=Ensure Nix related units which are symlinked resolve\n\

tests/fixtures/linux/steam-deck.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@
5555
},
5656
"state": "Completed"
5757
},
58+
{
59+
"action": {
60+
"action_name": "create_file",
61+
"path": "/etc/atomic-update.conf.d/nix-installer.conf",
62+
"user": null,
63+
"group": null,
64+
"mode": 420,
65+
"buf": "/etc/fish/conf.d/nix.fish\n/etc/nix/**\n/etc/profile.d/nix.sh\n/etc/systemd/system/nix-daemon.socket\n/etc/tmpfiles.d/nix-daemon.conf\n",
66+
"force": false
67+
},
68+
"state": "Completed"
69+
},
5870
{
5971
"action": {
6072
"action_name": "start_systemd_unit",

0 commit comments

Comments
 (0)