@@ -646,13 +646,7 @@ pub(crate) fn finalize_filesystem(fs: &Utf8Path) -> Result<()> {
646
646
Ok ( ( ) )
647
647
}
648
648
649
- /// Preparation for an install; validates and prepares some (thereafter immutable) global state.
650
- async fn prepare_install (
651
- config_opts : InstallConfigOpts ,
652
- target_opts : InstallTargetOpts ,
653
- ) -> Result < Arc < State > > {
654
- // We need full root privileges, i.e. --privileged in podman
655
- crate :: cli:: require_root ( ) ?;
649
+ fn require_systemd_pid1 ( ) -> Result < ( ) > {
656
650
// We require --pid=host
657
651
let pid = std:: fs:: read_link ( "/proc/1/exe" ) . context ( "reading /proc/1/exe" ) ?;
658
652
let pid = pid
@@ -661,6 +655,17 @@ async fn prepare_install(
661
655
if !pid. contains ( "systemd" ) {
662
656
anyhow:: bail!( "This command must be run with --pid=host" )
663
657
}
658
+ Ok ( ( ) )
659
+ }
660
+
661
+ /// Preparation for an install; validates and prepares some (thereafter immutable) global state.
662
+ async fn prepare_install (
663
+ config_opts : InstallConfigOpts ,
664
+ target_opts : InstallTargetOpts ,
665
+ ) -> Result < Arc < State > > {
666
+ // We need full root privileges, i.e. --privileged in podman
667
+ crate :: cli:: require_root ( ) ?;
668
+ require_systemd_pid1 ( ) ?;
664
669
665
670
// This command currently *must* be run inside a privileged container.
666
671
let container_info = crate :: containerenv:: get_container_execution_info ( ) ?;
0 commit comments