horto_os_ui_shared/steps/
s3_backup.rs1use crate::context::{HostContext, PlannedAction};
3use crate::error::Result;
4use crate::ops::backup;
5use crate::step::Step;
6
7pub struct S3Backup;
9
10impl Step for S3Backup {
11 fn id(&self) -> &'static str {
12 "s3"
13 }
14 fn title(&self) -> &'static str {
15 "Backup /etc paths listed in config"
16 }
17 fn reference_script(&self) -> &'static str {
18 "s3_backup_etc_configs.sh"
19 }
20 fn step_version(&self) -> u32 {
21 1
22 }
23 fn is_done(&self, ctx: &HostContext) -> bool {
24 ctx.paths.initial_backup_etc().is_dir()
25 }
26 fn plan(&self, ctx: &mut HostContext) -> Result<Vec<PlannedAction>> {
27 let dest = ctx.paths.initial_backup_etc();
28 ctx.plan_action(format!("backup managed /etc entries -> {}", dest.display()));
29 let _ = backup::copy_managed_etc(ctx, &dest)?;
30 Ok(ctx.planned.clone())
31 }
32 fn apply(&self, ctx: &mut HostContext) -> Result<()> {
33 backup::backup_etc_initial(ctx)?;
34 Ok(())
35 }
36}