66
77// This sub-module is the "basic" installer that handles creating basic block device
88// and filesystem setup.
9+ mod aleph;
910#[ cfg( feature = "install-to-disk" ) ]
1011pub ( crate ) mod baseline;
1112pub ( crate ) mod completion;
@@ -23,6 +24,7 @@ use std::str::FromStr;
2324use std:: sync:: Arc ;
2425use std:: time:: Duration ;
2526
27+ use aleph:: InstallAleph ;
2628use anyhow:: { anyhow, ensure, Context , Result } ;
2729use bootc_utils:: CommandRunExt ;
2830use camino:: Utf8Path ;
@@ -35,11 +37,9 @@ use cap_std_ext::cap_std::fs_utf8::DirEntry as DirEntryUtf8;
3537use cap_std_ext:: cap_tempfile:: TempDir ;
3638use cap_std_ext:: cmdext:: CapStdExtCommandExt ;
3739use cap_std_ext:: prelude:: CapStdExtDirExt ;
38- use chrono:: prelude:: * ;
3940use clap:: ValueEnum ;
4041use fn_error_context:: context;
4142use ostree:: gio;
42- use ostree_ext:: oci_spec;
4343use ostree_ext:: ostree;
4444use ostree_ext:: ostree_prepareroot:: { ComposefsState , Tristate } ;
4545use ostree_ext:: prelude:: Cast ;
@@ -417,27 +417,6 @@ impl State {
417417 }
418418}
419419
420- /// Path to initially deployed version information
421- const BOOTC_ALEPH_PATH : & str = ".bootc-aleph.json" ;
422-
423- /// The "aleph" version information is injected into /root/.bootc-aleph.json
424- /// and contains the image ID that was initially used to install. This can
425- /// be used to trace things like the specific version of `mkfs.ext4` or
426- /// kernel version that was used.
427- #[ derive( Debug , Serialize ) ]
428- struct InstallAleph {
429- /// Digested pull spec for installed image
430- image : String ,
431- /// The version number
432- version : Option < String > ,
433- /// The timestamp
434- timestamp : Option < chrono:: DateTime < Utc > > ,
435- /// The `uname -r` of the kernel doing the installation
436- kernel : String ,
437- /// The state of SELinux at install time
438- selinux : String ,
439- }
440-
441420/// A mount specification is a subset of a line in `/etc/fstab`.
442421///
443422/// There are 3 (ASCII) whitespace separated values:
@@ -529,32 +508,6 @@ impl FromStr for MountSpec {
529508 }
530509}
531510
532- impl InstallAleph {
533- #[ context( "Creating aleph data" ) ]
534- pub ( crate ) fn new (
535- src_imageref : & ostree_container:: OstreeImageReference ,
536- imgstate : & ostree_container:: store:: LayeredImageState ,
537- selinux_state : & SELinuxFinalState ,
538- ) -> Result < Self > {
539- let uname = rustix:: system:: uname ( ) ;
540- let labels = crate :: status:: labels_of_config ( & imgstate. configuration ) ;
541- let timestamp = labels
542- . and_then ( |l| {
543- l. get ( oci_spec:: image:: ANNOTATION_CREATED )
544- . map ( |s| s. as_str ( ) )
545- } )
546- . and_then ( bootc_utils:: try_deserialize_timestamp) ;
547- let r = InstallAleph {
548- image : src_imageref. imgref . name . clone ( ) ,
549- version : imgstate. version ( ) . as_ref ( ) . map ( |s| s. to_string ( ) ) ,
550- timestamp,
551- kernel : uname. release ( ) . to_str ( ) ?. to_string ( ) ,
552- selinux : selinux_state. to_aleph ( ) . to_string ( ) ,
553- } ;
554- Ok ( r)
555- }
556- }
557-
558511impl SourceInfo {
559512 // Inspect container information and convert it to an ostree image reference
560513 // that pulls from containers-storage.
@@ -1346,12 +1299,7 @@ async fn install_with_sysroot(
13461299 // the aleph state (see below).
13471300 let ( deployment, aleph) = install_container ( state, rootfs, & sysroot, has_ostree) . await ?;
13481301 // Write the aleph data that captures the system state at the time of provisioning for aid in future debugging.
1349- rootfs
1350- . physical_root
1351- . atomic_replace_with ( BOOTC_ALEPH_PATH , |f| {
1352- anyhow:: Ok ( aleph. to_canon_json_writer ( f) ?)
1353- } )
1354- . context ( "Writing aleph version" ) ?;
1302+ aleph. write_to ( & rootfs. physical_root ) ?;
13551303
13561304 let deployment_path = sysroot. deployment_dirpath ( & deployment) ;
13571305
0 commit comments