@@ -418,12 +418,6 @@ impl FinalInstallationState {
418418 crate :: cmd!( "umount" [ [ "-R" ] , [ tmproot] ] => |_| bail!( "umount -R {tmproot:?} failed" ) ) ;
419419 }
420420
421- if let DetailedInstallationType :: ChromebookInstall = inst_type {
422- // FIXME: don't dd?
423- Self :: flash_submarine ( blockdev) ?;
424- InstallationType :: set_cgpt_flags ( blockdev) ?;
425- }
426-
427421 tracing:: info!( "Cleaning up state..." ) ;
428422
429423 if self . encrypts . is_some ( ) {
@@ -660,74 +654,6 @@ impl FinalInstallationState {
660654 . try_collect ( )
661655 }
662656
663- #[ tracing:: instrument]
664- fn flash_submarine ( blockdev : & Path ) -> Result < ( ) > {
665- tracing:: debug!( "Flashing submarine…" ) ;
666-
667- // Find target submarine partition
668- let target_partition = lsblk:: BlockDevice :: list ( ) ?
669- . into_iter ( )
670- . find ( |d| {
671- d. is_part ( )
672- && d. disk_name ( ) . ok ( ) . as_deref ( )
673- == blockdev
674- . strip_prefix ( "/dev/" )
675- . unwrap_or ( & PathBuf :: from ( "" ) )
676- . to_str ( )
677- && d. name . ends_with ( '2' )
678- } )
679- . ok_or_else ( || eyre ! ( "Failed to find submarine partition" ) ) ?;
680-
681- let source_path = Path :: new ( "/usr/share/submarine/submarine.kpart" ) ;
682- let target_path = Path :: new ( "/dev" ) . join ( & target_partition. name ) ;
683-
684- let mut source_file = std:: fs:: File :: open ( source_path) ?;
685- let mut target_file = std:: fs:: OpenOptions :: new ( ) . write ( true ) . open ( target_path) ?;
686-
687- std:: io:: copy ( & mut source_file, & mut target_file) ?;
688- target_file. sync_all ( ) ?;
689-
690- Ok ( ( ) )
691- }
692- // As of February 14, 2025, I have disabled the `dd` method for flashing the submarine partition,
693- // because we shouldn't really be dropping to shell commands for this kind of thing.
694- //
695- // The `dd` method is still here for reference if we ever need to use it again.
696- //
697- // See above for the new method of flashing the submarine partition,
698- // programmatically copying the submarine partition to the target disk.
699- //
700- // - Cappy
701- /*
702- #[tracing::instrument]
703- fn dd_submarine(blockdev: &Path) -> Result<()> {
704- tracing::debug!("dd-ing submarine…");
705- if !Command::new("dd")
706- .arg("if=/usr/share/submarine/submarine.kpart")
707- .arg(format!(
708- "of=/dev/{}",
709- lsblk::BlockDevice::list()?
710- .into_iter()
711- .find(|d| d.is_part()
712- && d.disk_name().ok().as_deref()
713- == blockdev
714- .strip_prefix("/dev/")
715- .unwrap_or(&PathBuf::from(""))
716- .to_str()
717- && d.name.ends_with('2'))
718- .ok_or_else(|| eyre!("Failed to find submarine partition"))?
719- .name
720- ))
721- .arg("status=progress")
722- .status()?
723- .success()
724- {
725- return Err(eyre!("Failed to dd submarine, non-zero exit code"));
726- }
727- Ok(())
728- }
729- */
730-
731657 /// Mount a device or file to /mnt/live-base
732658 fn mount_dev ( dev : & str ) -> std:: io:: Result < sys_mount:: Mount > {
733659 const MOUNTPOINT : & str = "/mnt/live-base" ;
@@ -891,15 +817,6 @@ impl InstallationType {
891817 Self :: Custom => unreachable ! ( ) ,
892818 }
893819 }
894-
895- fn set_cgpt_flags ( blockdev : & Path ) -> Result < ( ) > {
896- tracing:: debug!( "Setting cgpt flags" ) ;
897- crate :: cmd!( "cgpt" [
898- [ "add" , "-i" , "2" , "-t" , "kernel" , "-P" , "15" , "-T" , "1" , "-S" , "1" ] ,
899- [ blockdev]
900- ] => |r| bail!( "cgpt command failed with exit code {:?}" , r. code( ) ) ) ;
901- Ok ( ( ) )
902- }
903820}
904821
905822#[ cfg( test) ]
0 commit comments