2
2
//!
3
3
//! Command line tool to manage bootable ostree-based containers.
4
4
5
+ use anyhow:: Ok ;
5
6
use anyhow:: { Context , Result } ;
6
7
use camino:: Utf8PathBuf ;
7
8
use cap_std_ext:: cap_std;
@@ -12,9 +13,12 @@ use ostree_container::store::PrepareResult;
12
13
use ostree_ext:: container as ostree_container;
13
14
use ostree_ext:: keyfileext:: KeyFileExt ;
14
15
use ostree_ext:: ostree;
16
+ use tracing:: debug;
17
+ use tracing:: field:: debug;
15
18
use std:: ffi:: OsString ;
16
19
use std:: io:: Seek ;
17
20
use std:: os:: unix:: process:: CommandExt ;
21
+ use std:: path;
18
22
use std:: process:: Command ;
19
23
20
24
use crate :: deploy:: RequiredHostSpec ;
@@ -213,6 +217,8 @@ pub(crate) enum Opt {
213
217
#[ clap( subcommand) ]
214
218
#[ cfg( feature = "install" ) ]
215
219
Install ( InstallOpts ) ,
220
+ /// Validate non supported files are not present.
221
+ BuildLint ,
216
222
/// Execute the given command in the host mount namespace
217
223
#[ cfg( feature = "install" ) ]
218
224
#[ clap( hide = true ) ]
@@ -511,6 +517,21 @@ async fn usroverlay() -> Result<()> {
511
517
. into ( ) ) ;
512
518
}
513
519
520
+ /// Implementation of `bootc build commit`
521
+ /// async fn lint() -> Result<()> {
522
+ #[ context( "linting" ) ]
523
+ fn lint ( ) -> Result < ( ) > {
524
+ if !ostree_ext:: container_utils:: is_ostree_container ( ) ? {
525
+ anyhow:: bail!(
526
+ "Not in a ostree container, this command only verifies ostree containers."
527
+ ) ;
528
+ }
529
+
530
+ let root = cap_std:: fs:: Dir :: open_ambient_dir ( "/" , cap_std:: ambient_authority ( ) ) ?;
531
+ ostree_ext:: bootabletree:: find_kernel_dir_fs ( & root) ?;
532
+ return Ok ( ( ) ) ;
533
+ }
534
+
514
535
/// Parse the provided arguments and execute.
515
536
/// Calls [`structopt::clap::Error::exit`] on failure, printing the error message and aborting the program.
516
537
pub async fn run_from_iter < I > ( args : I ) -> Result < ( ) >
@@ -528,6 +549,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
528
549
Opt :: Switch ( opts) => switch ( opts) . await ,
529
550
Opt :: Edit ( opts) => edit ( opts) . await ,
530
551
Opt :: UsrOverlay => usroverlay ( ) . await ,
552
+ Opt :: BuildLint => lint ( ) ,
531
553
#[ cfg( feature = "install" ) ]
532
554
Opt :: Install ( opts) => match opts {
533
555
InstallOpts :: ToDisk ( opts) => crate :: install:: install_to_disk ( opts) . await ,
0 commit comments