66
77// This sub-module is the "basic" installer that handles creating basic block device
88// and filesystem setup.
9+ #[ cfg( feature = "install-to-disk" ) ]
910pub ( crate ) mod baseline;
1011pub ( crate ) mod completion;
1112pub ( crate ) mod config;
@@ -40,9 +41,12 @@ use ostree_ext::oci_spec;
4041use ostree_ext:: ostree;
4142use ostree_ext:: prelude:: Cast ;
4243use ostree_ext:: sysroot:: SysrootLock ;
43- use rustix:: fs:: { FileTypeExt , MetadataExt as _} ;
44+ #[ cfg( feature = "install-to-disk" ) ]
45+ use rustix:: fs:: FileTypeExt ;
46+ use rustix:: fs:: MetadataExt as _;
4447use serde:: { Deserialize , Serialize } ;
4548
49+ #[ cfg( feature = "install-to-disk" ) ]
4650use self :: baseline:: InstallBlockDeviceOpts ;
4751use crate :: boundimage:: { BoundImage , ResolvedBoundImage } ;
4852use crate :: containerenv:: ContainerExecutionInfo ;
@@ -57,6 +61,7 @@ use crate::utils::sigpolicy_from_opts;
5761/// The toplevel boot directory
5862const BOOT : & str = "boot" ;
5963/// Directory for transient runtime state
64+ #[ cfg( feature = "install-to-disk" ) ]
6065const RUN_BOOTC : & str = "/run/bootc" ;
6166/// The default path for the host rootfs
6267const ALONGSIDE_ROOT_MOUNT : & str = "/target" ;
@@ -65,10 +70,8 @@ const LOST_AND_FOUND: &str = "lost+found";
6570/// The filename of the composefs EROFS superblock; TODO move this into ostree
6671const OSTREE_COMPOSEFS_SUPER : & str = ".ostree.cfs" ;
6772/// The mount path for selinux
68- #[ cfg( feature = "install" ) ]
6973const SELINUXFS : & str = "/sys/fs/selinux" ;
7074/// The mount path for uefi
71- #[ cfg( feature = "install" ) ]
7275const EFIVARFS : & str = "/sys/firmware/efi/efivars" ;
7376pub ( crate ) const ARCH_USES_EFI : bool = cfg ! ( any( target_arch = "x86_64" , target_arch = "aarch64" ) ) ;
7477
@@ -202,6 +205,7 @@ pub(crate) struct InstallConfigOpts {
202205 pub ( crate ) stateroot : Option < String > ,
203206}
204207
208+ #[ cfg( feature = "install-to-disk" ) ]
205209#[ derive( Debug , Clone , clap:: Parser , Serialize , Deserialize , PartialEq , Eq ) ]
206210pub ( crate ) struct InstallToDiskOpts {
207211 #[ clap( flatten) ]
@@ -375,6 +379,7 @@ impl State {
375379 }
376380
377381 #[ context( "Finalizing state" ) ]
382+ #[ allow( dead_code) ]
378383 pub ( crate ) fn consume ( self ) -> Result < ( ) > {
379384 self . tempdir . close ( ) ?;
380385 // If we had invoked `setenforce 0`, then let's re-enable it.
@@ -880,6 +885,7 @@ pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> {
880885}
881886
882887pub ( crate ) struct RootSetup {
888+ #[ cfg( feature = "install-to-disk" ) ]
883889 luks_device : Option < String > ,
884890 device_info : crate :: blockdev:: PartitionTable ,
885891 /// Absolute path to the location where we've mounted the physical
@@ -907,12 +913,14 @@ impl RootSetup {
907913 }
908914
909915 // Drop any open file descriptors and return just the mount path and backing luks device, if any
916+ #[ cfg( feature = "install-to-disk" ) ]
910917 fn into_storage ( self ) -> ( Utf8PathBuf , Option < String > ) {
911918 ( self . physical_root_path , self . luks_device )
912919 }
913920}
914921
915922#[ derive( Debug ) ]
923+ #[ allow( dead_code) ]
916924pub ( crate ) enum SELinuxFinalState {
917925 /// Host and target both have SELinux, but user forced it off for target
918926 ForceTargetDisabled ,
@@ -1449,6 +1457,7 @@ fn installation_complete() {
14491457
14501458/// Implementation of the `bootc install to-disk` CLI command.
14511459#[ context( "Installing to disk" ) ]
1460+ #[ cfg( feature = "install-to-disk" ) ]
14521461pub ( crate ) async fn install_to_disk ( mut opts : InstallToDiskOpts ) -> Result < ( ) > {
14531462 let mut block_opts = opts. block_opts ;
14541463 let target_blockdev_meta = block_opts
@@ -1845,6 +1854,7 @@ pub(crate) async fn install_to_filesystem(
18451854 let skip_finalize =
18461855 matches ! ( fsopts. replace, Some ( ReplaceMode :: Alongside ) ) || fsopts. skip_finalize ;
18471856 let mut rootfs = RootSetup {
1857+ #[ cfg( feature = "install-to-disk" ) ]
18481858 luks_device : None ,
18491859 device_info,
18501860 physical_root_path : fsopts. root_path ,
0 commit comments