File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -267,16 +267,13 @@ pub fn overlay_file(src: &str, dest: &str) -> Result<()> {
267267 . with_context ( || format ! ( "Failed to move_mount {src:?} to {dest:?}" ) )
268268}
269269
270- pub fn place_etc ( file : & str , contents : Option < & str > ) -> Result < ( ) > {
271- let tmp = "/tmp/" . to_string ( ) + file;
272- let etc = "/etc/" . to_string ( ) + file;
273-
270+ pub fn place_file ( backing : & str , dest : & str , contents : Option < & str > ) -> Result < ( ) > {
274271 {
275272 let mut file = File :: options ( )
276273 . write ( true )
277274 . create ( true )
278275 . truncate ( true )
279- . open ( & tmp )
276+ . open ( backing )
280277 . context ( "Failed to create temp backing of an etc file" ) ?;
281278
282279 if let Some ( content) = contents {
@@ -285,13 +282,13 @@ pub fn place_etc(file: &str, contents: Option<&str>) -> Result<()> {
285282 }
286283 }
287284
288- overlay_file ( & tmp , & etc )
285+ overlay_file ( backing , dest )
289286}
290287
291288pub fn mount_filesystems ( ) -> Result < ( ) > {
292289 make_tmpfs ( "/var/run" ) ?;
293290
294- place_etc ( " resolv.conf", None ) ?;
291+ place_file ( "/run/resolv.conf" , "/etc/ resolv.conf", None ) ?;
295292
296293 mount2 (
297294 Some ( "binfmt_misc" ) ,
You can’t perform that action at this time.
0 commit comments