mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
sysprep: remove also hidden files/dirs in temporary dirs
List manually and remove the content left (hidden files/directories) in temporary directories after the glob listing & removal.
This commit is contained in:
@@ -24,15 +24,22 @@ module G = Guestfs
|
||||
let tmp_files_perform ~debug ~quiet g root side_effects =
|
||||
let typ = g#inspect_get_type root in
|
||||
if typ <> "windows" then (
|
||||
let paths = [ "/tmp/*";
|
||||
"/var/tmp/*"; ] in
|
||||
let paths = [ "/tmp";
|
||||
"/var/tmp"; ] in
|
||||
List.iter (
|
||||
fun path ->
|
||||
let files = g#glob_expand path in
|
||||
let files = g#glob_expand (path ^ "/*") in
|
||||
Array.iter (
|
||||
fun file ->
|
||||
g#rm_rf file;
|
||||
) files;
|
||||
(try
|
||||
let files = g#ls path in
|
||||
Array.iter (
|
||||
fun file ->
|
||||
g#rm_rf (path ^ "/" ^ file);
|
||||
) files
|
||||
with G.Error _ -> ());
|
||||
) paths
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user