File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -634,6 +634,18 @@ async fn deploy(
634
634
let ostree = sysroot. get_ostree ( ) ?;
635
635
let staged = ostree. staged_deployment ( ) . unwrap ( ) ;
636
636
assert_eq ! ( staged. index( ) , r) ;
637
+
638
+ // This file is used to signal to other CLI commands that this deployment is a factory reset
639
+ // (e.g. bootc status)
640
+ if matches ! ( from, MergeState :: Reset { .. } ) {
641
+ let deployment_dir = ostree. deployment_dirpath ( & staged) ;
642
+ let deployment_dir = std:: path:: Path :: new ( deployment_dir. as_str ( ) ) ;
643
+ if deployment_dir. exists ( ) {
644
+ let marker_path = deployment_dir. join ( ".bootc-factory-reset" ) ;
645
+ std:: fs:: write ( & marker_path, b"" ) ?;
646
+ }
647
+ }
648
+
637
649
Ok ( staged)
638
650
}
639
651
Original file line number Diff line number Diff line change @@ -95,7 +95,20 @@ impl From<ImageReference> for OstreeImageReference {
95
95
96
96
/// Check if a deployment has soft reboot capability
97
97
fn has_soft_reboot_capability ( sysroot : & SysrootLock , deployment : & ostree:: Deployment ) -> bool {
98
- ostree_ext:: systemd_has_soft_reboot ( ) && sysroot. deployment_can_soft_reboot ( deployment)
98
+ let deployment_dir = sysroot. deployment_dirpath ( deployment) ;
99
+ let deployment_dir = std:: path:: Path :: new ( deployment_dir. as_str ( ) ) ;
100
+ let is_factory_reset =
101
+ deployment_dir. exists ( ) && deployment_dir. join ( ".bootc-factory-reset" ) . exists ( ) ;
102
+
103
+ if is_factory_reset {
104
+ // Factory reset deployments don't support soft reboots
105
+ // this is primarily because the kargs validation will fail when checking for soft reboot
106
+ // compatibility in the ostree code, which will cause bootc status and upgrade to fail.
107
+ // (see ostree_sysroot_deployment_can_soft_reboot in ostree)
108
+ false
109
+ } else {
110
+ ostree_ext:: systemd_has_soft_reboot ( ) && sysroot. deployment_can_soft_reboot ( deployment)
111
+ }
99
112
}
100
113
101
114
/// Parse an ostree origin file (a keyfile) and extract the targeted
Original file line number Diff line number Diff line change 1
1
//! Perform initial setup for a container image based system root
2
2
3
- #[ cfg( feature = "bootc" ) ]
4
3
use anyhow:: Result ;
5
4
use fn_error_context:: context;
6
5
use ostree:: glib;
You can’t perform that action at this time.
0 commit comments