6
6
7
7
// This sub-module is the "basic" installer that handles creating basic block device
8
8
// and filesystem setup.
9
+ mod aleph;
9
10
#[ cfg( feature = "install-to-disk" ) ]
10
11
pub ( crate ) mod baseline;
11
12
pub ( crate ) mod completion;
@@ -23,6 +24,7 @@ use std::str::FromStr;
23
24
use std:: sync:: Arc ;
24
25
use std:: time:: Duration ;
25
26
27
+ use aleph:: InstallAleph ;
26
28
use anyhow:: { anyhow, ensure, Context , Result } ;
27
29
use bootc_utils:: CommandRunExt ;
28
30
use camino:: Utf8Path ;
@@ -35,11 +37,9 @@ use cap_std_ext::cap_std::fs_utf8::DirEntry as DirEntryUtf8;
35
37
use cap_std_ext:: cap_tempfile:: TempDir ;
36
38
use cap_std_ext:: cmdext:: CapStdExtCommandExt ;
37
39
use cap_std_ext:: prelude:: CapStdExtDirExt ;
38
- use chrono:: prelude:: * ;
39
40
use clap:: ValueEnum ;
40
41
use fn_error_context:: context;
41
42
use ostree:: gio;
42
- use ostree_ext:: oci_spec;
43
43
use ostree_ext:: ostree;
44
44
use ostree_ext:: ostree_prepareroot:: { ComposefsState , Tristate } ;
45
45
use ostree_ext:: prelude:: Cast ;
@@ -417,27 +417,6 @@ impl State {
417
417
}
418
418
}
419
419
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
-
441
420
/// A mount specification is a subset of a line in `/etc/fstab`.
442
421
///
443
422
/// There are 3 (ASCII) whitespace separated values:
@@ -529,32 +508,6 @@ impl FromStr for MountSpec {
529
508
}
530
509
}
531
510
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
-
558
511
impl SourceInfo {
559
512
// Inspect container information and convert it to an ostree image reference
560
513
// that pulls from containers-storage.
@@ -1346,12 +1299,7 @@ async fn install_with_sysroot(
1346
1299
// the aleph state (see below).
1347
1300
let ( deployment, aleph) = install_container ( state, rootfs, & sysroot, has_ostree) . await ?;
1348
1301
// 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 ) ?;
1355
1303
1356
1304
let deployment_path = sysroot. deployment_dirpath ( & deployment) ;
1357
1305
0 commit comments