search for: glob_expand

Displaying 20 results from an estimated 84 matches for "glob_expand".

2016 Feb 03
0
[PATCH 2/3] daemon: glob: add option for not returning dirs with trailing slash
...++ po/POTFILES | 1 + 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/daemon/glob.c b/daemon/glob.c index 45fb30f..de615ee 100644 --- a/daemon/glob.c +++ b/daemon/glob.c @@ -26,14 +26,18 @@ #include "actions.h" char ** -do_glob_expand (const char *pattern) +do_glob_expand (const char *pattern, int nodirectoryslash) { int r; glob_t buf = { .gl_pathc = 0, .gl_pathv = NULL, .gl_offs = 0 }; + int flags = GLOB_BRACE; + + if (!nodirectoryslash) + flags |= GLOB_MARK; /* glob(3) in glibc never calls chdir, so this s...
2012 Sep 21
1
[PATCH] sysprep: handle at jobs in cron-spool operation
...cron_spool.ml b/sysprep/sysprep_operation_cron_spool.ml index 5284660..e96832c 100644 --- a/sysprep/sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -23,6 +23,12 @@ module G = Guestfs let cron_spool_perform g root = Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); + Array.iter g#rm (g#glob_expand "/var/spool/atjobs/*"); + Array.iter g#rm (g#glob_expand "/var/spool/atjobs/.SEQ"); + Array.iter g#rm (g#glob_expand "/var/spool/atspool/*&quo...
2016 Feb 04
2
[PATCH v2 1/2] daemon: glob: add optarg to control trailing slash for dirs
...++ po/POTFILES | 1 + 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/daemon/glob.c b/daemon/glob.c index 45fb30f..a22fd33 100644 --- a/daemon/glob.c +++ b/daemon/glob.c @@ -26,14 +26,21 @@ #include "actions.h" char ** -do_glob_expand (const char *pattern) +do_glob_expand (const char *pattern, int directoryslash) { int r; glob_t buf = { .gl_pathc = 0, .gl_pathv = NULL, .gl_offs = 0 }; + int flags = GLOB_BRACE | GLOB_MARK; + + /* GLOB_MARK is default, unless the user explicitly disabled it. */ + if ((optargs_bit...
2016 Feb 03
6
[PATCH 1/3] sysprep, get-kernel: explicit the Guestfs parameter
...b/get-kernel/get_kernel.ml @@ -149,7 +149,7 @@ let rec do_fetch ~transform_fn ~outputdir g root = g#umount_all () -and pick_kernel_files_linux g root = +and pick_kernel_files_linux (g : Guestfs.guestfs) root = (* Get all kernels and initramfses. *) let glob w = Array.to_list (g#glob_expand w) in let kernels = glob "/boot/vmlinuz-*" in diff --git a/sysprep/sysprep_operation_abrt_data.ml b/sysprep/sysprep_operation_abrt_data.ml index d950270..0d94271 100644 --- a/sysprep/sysprep_operation_abrt_data.ml +++ b/sysprep/sysprep_operation_...
2015 Jul 01
0
[PATCH 3/3] sysprep: rework and fix cron-spool operation (RHBZ#1229305)
.../sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -18,19 +18,32 @@ open Sysprep_operation open Common_gettext.Gettext +open Common_utils module G = Guestfs let cron_spool_perform (g : Guestfs.guestfs) root side_effects = - Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); + let is_seq path = + let basename = + try last_part_of path '/' + with Not_found -> path in + basename = ".SEQ" in + let reset f = + if g#is_file f then + (* This should overwrite the file in-place,...
2015 Jul 01
0
[PATCH 2/2] sysprep: rework and fix cron-spool operation (RHBZ#1229305)
.../sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -18,19 +18,33 @@ open Sysprep_operation open Common_gettext.Gettext +open Common_utils module G = Guestfs let cron_spool_perform (g : Guestfs.guestfs) root side_effects = - Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); + let is_seq path = + let basename = + match last_part_of path '/' with + | Some x -> x + | None -> path in + basename = ".SEQ" in + let reset f = + if g#is_file f then + (* This should overwr...
2012 Apr 06
2
[PATCH] virt-sysprep:add logging feature
...on_cron_spool.ml index e67688b..6bd6ec4 100644 --- a/sysprep/sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -17,11 +17,17 @@ *) open Sysprep_operation +open Utils module G = Guestfs -let cron_spool_perform g root = - Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); +let cron_spool_perform g root show_log = + let files = g#glob_expand "/var/spool/cron/*" in + Array.iter ( + fun glob -> + g#rm glob + logging show_log "Deleted %s" glob + ) files; [] let c...
2016 Feb 03
0
Re: [PATCH 1/3] sysprep, get-kernel: explicit the Guestfs parameter
...@@ -149,7 +149,7 @@ let rec do_fetch ~transform_fn ~outputdir g root = > > g#umount_all () > > -and pick_kernel_files_linux g root = > +and pick_kernel_files_linux (g : Guestfs.guestfs) root = > (* Get all kernels and initramfses. *) > let glob w = Array.to_list (g#glob_expand w) in > let kernels = glob "/boot/vmlinuz-*" in > diff --git a/sysprep/sysprep_operation_abrt_data.ml b/sysprep/sysprep_operation_abrt_data.ml > index d950270..0d94271 100644 > --- a/sysprep/sysprep_operation_abrt_data.ml > +++ b/syspr...
2015 Jul 01
4
[PATCH 1/2] mllib: add and use last_part_of
Collect this small snippet to get the part of a string after the last occurrency of a character; replace with it the current snippets doing the same. Should be just code motion. --- customize/password.ml | 5 +++-- mllib/common_utils.ml | 7 +++++++ mllib/common_utils.mli | 3 +++
2015 Jul 01
5
[PATCH 1/3] mllib: add an optional filter for rm_rf_only_files
This way it is possible to use rm_rf_only_files, but not removing specific files. --- mllib/common_utils.ml | 8 +++++++- mllib/common_utils.mli | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index 516cff3..3737b4c 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@
2014 Jan 21
1
[PATCH 1/2] sysprep: Update comments.
--- sysprep/sysprep_operation.mli | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sysprep/sysprep_operation.mli b/sysprep/sysprep_operation.mli index 61dde72..eb89db4 100644 --- a/sysprep/sysprep_operation.mli +++ b/sysprep/sysprep_operation.mli @@ -16,14 +16,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *)
2016 Aug 18
1
[PATCH] v2v: linux: simplify RPM database cleaning
...941750 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -85,9 +85,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps = Linux.augeas_init g; (* Clean RPM database. This must be done early to avoid RHBZ#1143866. *) - let dbfiles = g#glob_expand "/var/lib/rpm/__db.00?" in - let dbfiles = Array.to_list dbfiles in - List.iter g#rm_f dbfiles; + Array.iter g#rm_f (g#glob_expand "/var/lib/rpm/__db.00?"); (* What grub is installed? *) let grub_config, grub = -- 2.7.4
2012 Apr 24
1
[PATCH] sysprep: remove the cache of package manager
...., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + +open Sysprep_operation + +module G = Guestfs + +let package_manager_cache_perform g root = + let packager = g#inspect_get_package_management root in + match packager with + | "yum" -> + let cache = g#glob_expand "/var/cache/yum/*" in + Array.iter ( + fun dir -> + g#rm_rf dir + ) cache; [] + | "apt" -> + let cache = g#glob_expand "/var/cache/apt/archives/*" in + Array.iter ( + fun dir ->...
2017 Sep 22
0
[PATCH v3 13/22] v2v: linux: Properly ignore rpm/dpkg-move-aside kernels.
...file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml index 210cce762..00cb5cd19 100644 --- a/v2v/linux_bootloaders.ml +++ b/v2v/linux_bootloaders.ml @@ -319,9 +319,9 @@ object (self) Array.to_list (g#glob_expand "/boot/kernel-*") @ Array.to_list (g#glob_expand "/boot/vmlinuz-*") @ Array.to_list (g#glob_expand "/vmlinuz-*") in - let rex = Str.regexp ".*\\.\\(dpkg-.*|rpmsave|rpmnew\\)$" in + let rex = PCRE.compile "\\.(?...
2012 Apr 03
1
[PATCH RFC] sysprep:add logging feature
...#47;sysprep_operation_cron_spool.ml +++ b/sysprep/sysprep_operation_cron_spool.ml @@ -16,12 +16,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) +open Printf open Sysprep_operation module G = Guestfs let cron_spool_perform g root = Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*"); + eprintf "Deleted /var/spool/cron/*\n"; [] let cron_spool_op = { diff --git a/sysprep/sysprep_operation_dhcp_client_state.ml b/sysprep/sysprep_operation_dhcp_client_state.ml index e3e87cb..18415c5 1006...
2012 Aug 08
1
[PATCH] sysprep: remove the process accounting log files
...et pacct_log_perform g root = + let typ = g#inspect_get_type root in + let distro = g#inspect_get_distro root in + match typ, distro with + | "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based") -> + let files = g#glob_expand "/var/account/pacct*" in + Array.iter ( + fun file -> + try g#rm file with G.Error _ -> () + ) files; + (try g#touch "/var/account/pacct" with G.Error _ -> ()); + [ `Created_files ] + + | "linux", ("debia...
2012 May 09
2
[PATCH 1/2] sysprep: remove ca certificates in the guest
...;etc/pki/tls/certs/*.crt"; ] in + let excepts = [ "/etc/pki/tls/certs/ca-bundle.crt"; + "/etc/pki/tls/certs/ca-bundle.trust.crt"; ] in + List.iter ( + fun path -> + let files = g#glob_expand path in + Array.iter ( + fun file -> + List.iter ( + fun except -> + if file <> except then ( + try g#rm file with G.Error _ -> () + ) + ) excepts; + ) files; + ) paths; + +...
2016 Aug 15
2
[PATCH v2] v2v: factor out bootloader handling
...ring.sub k 0 (len-1) + else k in + Some (remove_hd_prefix k) + in + + let vmlinuzes = + (match get_default_image () with + | None -> [] + | Some k -> [k]) @ + (* This is how the grub2 config generator enumerates kernels. *) + Array.to_list (g#glob_expand "/boot/kernel-*") @ + Array.to_list (g#glob_expand "/boot/vmlinuz-*") @ + Array.to_list (g#glob_expand "/vmlinuz-*") in + let rex = Str.regexp ".*\\.\\(dpkg-.*|rpmsave|rpmnew\\)$" in + let vmlinuzes = List.filter ( +...
2016 Aug 25
2
[PATCH v2] v2v: factor out bootloader handling
....ml index 2a53315..7829612 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -87,45 +87,9 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps = (* Clean RPM database. This must be done early to avoid RHBZ#1143866. *) Array.iter g#rm_f (g#glob_expand "/var/lib/rpm/__db.00?"); - (* What grub is installed? *) - let grub_config, grub = - let locations = [ - "/boot/grub2/grub.cfg", `Grub2; - "/boot/grub/menu.lst", `Grub1; - "/boot/grub/grub....
2013 Dec 09
2
[PATCH] sysprep: allow to specify globbing for --delete
...n_delete.ml +++ b/sysprep/sysprep_operation_delete.ml @@ -27,7 +27,9 @@ let add_paths path = paths := path :: !paths let path_perform g root = let paths = List.rev !paths in - List.iter g#rm_rf paths; + if paths <> [] then ( + List.iter (fun glob -> Array.iter g#rm_rf (g#glob_expand glob)) paths + ); [] let op = { -- 1.8.3.1