@@ -29,15 +29,16 @@ use ostree_ext::sysroot::SysrootLock;
29
29
use schemars:: schema_for;
30
30
use serde:: { Deserialize , Serialize } ;
31
31
32
- use crate :: bootc_composefs:: rollback:: composefs_rollback;
33
- use crate :: bootc_composefs:: switch:: switch_composefs;
34
- use crate :: bootc_composefs:: update:: upgrade_composefs;
32
+ #[ cfg( feature = "composefs-backend" ) ]
33
+ use crate :: bootc_composefs:: {
34
+ rollback:: composefs_rollback, status:: composefs_booted, switch:: switch_composefs,
35
+ update:: upgrade_composefs,
36
+ } ;
35
37
use crate :: deploy:: RequiredHostSpec ;
36
38
use crate :: lints;
37
39
use crate :: progress_jsonl:: { ProgressWriter , RawProgressFd } ;
38
40
use crate :: spec:: Host ;
39
41
use crate :: spec:: ImageReference ;
40
- use crate :: status:: composefs_booted;
41
42
use crate :: utils:: sigpolicy_from_opt;
42
43
43
44
/// Shared progress options
@@ -1141,29 +1142,21 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
1141
1142
1142
1143
/// Implementation of the `bootc rollback` CLI command.
1143
1144
#[ context( "Rollback" ) ]
1144
- async fn rollback ( opts : RollbackOpts ) -> Result < ( ) > {
1145
- if composefs_booted ( ) ?. is_some ( ) {
1146
- composefs_rollback ( ) . await ?
1147
- } else {
1148
- let sysroot = & get_storage ( ) . await ?;
1149
- let ostree = sysroot. get_ostree ( ) ?;
1150
- crate :: deploy:: rollback ( sysroot) . await ?;
1151
-
1152
- if opts. soft_reboot . is_some ( ) {
1153
- // Get status of rollback deployment to check soft-reboot capability
1154
- let host = crate :: status:: get_status_require_booted ( ostree) ?. 2 ;
1155
-
1156
- handle_soft_reboot (
1157
- opts. soft_reboot ,
1158
- host. status . rollback . as_ref ( ) ,
1159
- "rollback" ,
1160
- || soft_reboot_rollback ( ostree) ,
1161
- ) ?;
1162
- }
1163
- } ;
1145
+ async fn rollback ( opts : & RollbackOpts ) -> Result < ( ) > {
1146
+ let sysroot = & get_storage ( ) . await ?;
1147
+ let ostree = sysroot. get_ostree ( ) ?;
1148
+ crate :: deploy:: rollback ( sysroot) . await ?;
1164
1149
1165
- if opts. apply {
1166
- crate :: reboot:: reboot ( ) ?;
1150
+ if opts. soft_reboot . is_some ( ) {
1151
+ // Get status of rollback deployment to check soft-reboot capability
1152
+ let host = crate :: status:: get_status_require_booted ( ostree) ?. 2 ;
1153
+
1154
+ handle_soft_reboot (
1155
+ opts. soft_reboot ,
1156
+ host. status . rollback . as_ref ( ) ,
1157
+ "rollback" ,
1158
+ || soft_reboot_rollback ( ostree) ,
1159
+ ) ?;
1167
1160
}
1168
1161
1169
1162
Ok ( ( ) )
@@ -1310,20 +1303,44 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
1310
1303
let root = & Dir :: open_ambient_dir ( "/" , cap_std:: ambient_authority ( ) ) ?;
1311
1304
match opt {
1312
1305
Opt :: Upgrade ( opts) => {
1306
+ #[ cfg( feature = "composefs-backend" ) ]
1313
1307
if composefs_booted ( ) ?. is_some ( ) {
1314
1308
upgrade_composefs ( opts) . await
1315
1309
} else {
1316
1310
upgrade ( opts) . await
1317
1311
}
1312
+
1313
+ #[ cfg( not( feature = "composefs-backend" ) ) ]
1314
+ upgrade ( opts) . await
1318
1315
}
1319
1316
Opt :: Switch ( opts) => {
1317
+ #[ cfg( feature = "composefs-backend" ) ]
1320
1318
if composefs_booted ( ) ?. is_some ( ) {
1321
1319
switch_composefs ( opts) . await
1322
1320
} else {
1323
1321
switch ( opts) . await
1324
1322
}
1323
+
1324
+ #[ cfg( not( feature = "composefs-backend" ) ) ]
1325
+ switch ( opts) . await
1326
+ }
1327
+ Opt :: Rollback ( opts) => {
1328
+ #[ cfg( feature = "composefs-backend" ) ]
1329
+ if composefs_booted ( ) ?. is_some ( ) {
1330
+ composefs_rollback ( ) . await ?
1331
+ } else {
1332
+ rollback ( & opts) . await ?
1333
+ }
1334
+
1335
+ #[ cfg( not( feature = "composefs-backend" ) ) ]
1336
+ rollback ( & opts) . await ?;
1337
+
1338
+ if opts. apply {
1339
+ crate :: reboot:: reboot ( ) ?;
1340
+ }
1341
+
1342
+ Ok ( ( ) )
1325
1343
}
1326
- Opt :: Rollback ( opts) => rollback ( opts) . await ,
1327
1344
Opt :: Edit ( opts) => edit ( opts) . await ,
1328
1345
Opt :: UsrOverlay => usroverlay ( ) . await ,
1329
1346
Opt :: Container ( opts) => match opts {
0 commit comments