diff --git a/image_creator/os_type/unix.py b/image_creator/os_type/unix.py index f2abd0ebc120aa7e089ca9112fc314f30f798689..b0b3ae62e56ebe40d609048467e2cd5ca100ccfb 100644 --- a/image_creator/os_type/unix.py +++ b/image_creator/os_type/unix.py @@ -85,7 +85,9 @@ class Unix(OSBase): if print_header: self.out.output('Removing files under /var/mail & /var/spool/mail') - self.foreach_file('/var/spool/mail', self.g.rm_rf, maxdepth=1) + if self.g.is_dir('/var/spool/mail'): + self.foreach_file('/var/spool/mail', self.g.rm_rf, maxdepth=1) + self.foreach_file('/var/mail', self.g.rm_rf, maxdepth=1) @sysprep()