Displaying 18 results from an estimated 18 matches for "edit_file".
2014 Jun 23
2
[PATCH] edit: add -m option
...+++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 5 deletions(-)
diff --git a/edit/edit.c b/edit/edit.c
index 07790be..7a2603c 100644
--- a/edit/edit.c
+++ b/edit/edit.c
@@ -53,6 +53,7 @@ static const char *backup_extension = NULL;
static const char *perl_expr = NULL;
static void edit_files (int argc, char *argv[]);
+static void edit_files_simple (int argc, char *argv[]);
static void edit (const char *filename, const char *root);
static char *edit_interactively (const char *tmpfile);
static char *edit_non_interactively (const char *tmpfile);
@@ -84,6 +85,8 @@ usage (int status)...
2016 Apr 11
0
[PATCH] customize/perl_edit-c.c: Don't use internal APIs.
...the guestfs handle, and raising errors); hopefully this should be safe,
- * as long as it's kept internal within the libguestfs sources.
- */
-#include "../ocaml/guestfs-c.h"
-
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
value
@@ -43,12 +37,12 @@ virt_customize_edit_file_perl (value verbosev, value gv, value filev,
{
CAMLparam4 (verbosev, gv, filev, exprv);
int r;
- guestfs_h *g = Guestfs_val (gv);
+ guestfs_h *g = (guestfs_h *) Int64_val (gv);
r = edit_file_perl (g, String_val (filev), String_val (exprv), NULL,
Bool_val (verbos...
2016 Apr 12
0
[PATCH v2] customize/perl_edit-c.c: Don't use internal APIs.
...for extracting
- * the guestfs handle, and raising errors); hopefully this should be safe,
- * as long as it's kept internal within the libguestfs sources.
- */
-#include "../ocaml/guestfs-c.h"
-
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
value
-virt_customize_edit_file_perl (value verbosev, value gv, value filev,
- value exprv)
+virt_customize_edit_file_perl (value verbosev, value gv, value gpv,
+ value filev, value exprv)
{
- CAMLparam4 (verbosev, gv, filev, exprv);
+ CAMLparam5 (verbosev, gv, gpv, f...
2015 Nov 09
2
[PATCH 1/2] customize: check for file existence with --edit (RHBZ#1275806)
Check that a path provided to --edit exists already; while the is_file
call later will fail for non-existing files, with an explicit check a
better error message can be provided.
---
customize/customize_run.ml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index ff7bd0d..054ee53 100644
--- a/customize/customize_run.ml
+++
2014 Feb 12
2
[PATCH 1/2] mllib: hostname: replace the hostname on Debian also in /etc/hosts (RHBZ#953907).
...hen (
+ let lines = Array.to_list (g#read_lines filename) in
+ match lines with
+ | hd :: _ -> Some hd
+ | [] -> None
+ ) else
+ None
+
+and replace_host_in_etc_hosts g oldhost newhost =
+ let filename = "/etc/hosts" in
+ if g#is_file filename then (
+ Perl_edit.edit_file ~debug:false g filename
+ ("s,(\\s)" ^ (Str.quote oldhost) ^ "(\\s|\\$),\\1" ^ (Str.quote newhost) ^ "\\2, if ($_ !~ /^#/)")
+ )
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 4c03c7f..25cdaa5 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile....
2016 Apr 12
3
[PATCH v2] customize/perl_edit-c.c: Don't use internal APIs.
In v1 of this patch, there was the (small) possibility that 'g' might
have been garbage collected while we were in the C function.
Avoid this by passing 'g' to the function as well as the C pointer, so
that 'g' is pinned as a garbage collector root [by CAMLparam5] so it
cannot be collected while we're in the function.
Rich.
2014 Jan 14
0
[PATCH] builder, edit, fish: use copy-attributes
...fish/edit.c | 54 ++--------------------------------------------------
3 files changed, 5 insertions(+), 127 deletions(-)
diff --git a/builder/perl_edit.ml b/builder/perl_edit.ml
index aa4c2e6..28e5dea 100644
--- a/builder/perl_edit.ml
+++ b/builder/perl_edit.ml
@@ -42,7 +42,7 @@ let rec edit_file ~debug (g : Guestfs.guestfs) file expr =
g#upload tmpfile file;
(* However like virt-edit we do need to copy attributes. *)
- copy_attributes g file_old file;
+ g#copy_attributes ~all:true file_old file;
g#rm file_old
and do_perl_edit ~debug g file expr =
@@ -76,30 +76,3 @@ and do_p...
2014 Jun 23
2
Re: [PATCH] edit: add -m option
On Mon, Jun 23, 2014 at 12:30:07PM +0100, Richard W.M. Jones wrote:
>
> Same comment about do_edit_simple as I previously posted about
> do_cat_simple.
I mean edit_files_simple ...
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
htt...
2015 Nov 09
0
[PATCH 2/2] customize: allow editing symlinked files
...;&1
if not (g#exists path) then
error (f_"%s does not exist in the guest") path;
- if not (g#is_file path) then
+ if not (g#is_file ~followsymlinks:true path) then
error (f_"%s is not a regular file in the guest") path;
Perl_edit.edit_file g#ocaml_handle path expr
--
2.1.0
2014 Jan 07
8
RFC: copy-attributes command
Hi,
attached there is a prototype of patch for adding a new copy-attributes
command. Such command would allow copy the attributes of a "file" to
another, so for example in guestfish:
copy-attributes foo bar permissions:true xattributes:false
would only copy the permissions of foo to bar, not copying its extended
attributes too.
Just few notes:
- my first daemon command, so
2014 Aug 28
14
[PATCH 00/13] code refactorings for tools
Hi,
this series does a couple of code reorganizations/refactoring in code
used by tools: the windows path handling code, and the two types of
file editing (using editor, and using perl expression).
There's still a code duplication between the two variants of file
editing, but it is just within a single source, and can be easily
solved now (planning as next step).
Pino Toscano (13):
edit:
2015 Feb 27
5
[PATCH 0/4] firstboot: assorted enhancements
This patchset attempts to address a number of shortcomings in the
firstboot infrastructure I came across while working with v2v conversion
of various Windows VMs.
Roman Kagan (4):
firstboot: consolidate line ending conversion
firstboot: enhance firstboot driver script for Windows
firstboot: make script naming descriptive
convert_windows: split firstboot into steps
2015 May 15
0
[PATCH 3/4] ocaml tools: Use global variables to store trace (-x) and verbose (-v) flags.
...then printf "running command:\n%s\n%!" cmd;
try ignore (g#sh cmd)
with
Guestfs.Error msg ->
@@ -206,7 +206,7 @@ exec >>%s 2>&1
if not (g#is_file path) then
error (f_"%s is not a regular file in the guest") path;
- Perl_edit.edit_file ~verbose g#ocaml_handle path expr
+ Perl_edit.edit_file g#ocaml_handle path expr
| `FirstbootCommand cmd ->
msg (f_"Installing firstboot command: %s") cmd;
@@ -358,7 +358,7 @@ exec >>%s 2>&1
* If debugging, dump out the log file.
* Then if asked,...
2015 May 15
5
[PATCH 0/4] Only tell people to use -v -x when reporting bugs if they're not using those flags.
.. and a lot of refactoring.
https://bugzilla.redhat.com/show_bug.cgi?id=1167623
Rich.
2015 May 15
6
[PATCH v2 0/4] Only tell people to use -v -x when reporting bugs if they're not using those flags.
https://bugzilla.redhat.com/show_bug.cgi?id=1167623
2014 Mar 18
2
[PATCH] customize: Move virt-customize-related code to a separate
There's not going to be an easy way to present this patch. It's huge
and interconnected.
Anyway, what it does is lay the groundwork for a new tool which I'm
calling 'virt-customize'. virt-customize is virt-builder, but without
the part where it downloads a template from a respository. Just the
part where it customizes the template, that is, installing packages,
editing
2018 Sep 19
0
[PATCH 2/2] Introduce a --key option in tools that accept keys
...;
} else
error (EXIT_FAILURE, 0,
_("unknown long option: %s (%d)"),
@@ -274,6 +279,7 @@ main (int argc, char *argv[])
/* Free up data structures, no longer needed after this point. */
free_drives (drvs);
free_mps (mps);
+ free_key_store (ks);
edit_files (argc - optind, &argv[optind]);
diff --git a/edit/virt-edit.pod b/edit/virt-edit.pod
index 509473a0f..8f222d379 100644
--- a/edit/virt-edit.pod
+++ b/edit/virt-edit.pod
@@ -153,6 +153,23 @@ If you have untrusted raw-format guest disk images, you should use
this option to specify the disk fo...
2018 Sep 19
5
[PATCH 0/2] RFC: --key option for tools
Hi,
the following series adds a --key option in the majority of tools: this
makes it possible to pass LUKS credentials programmatically, avoid the
need to manually input them, or unsafely pass them via stdin.
Thanks,
Pino Toscano (2):
mltools: create a cmdline_options struct
Introduce a --key option in tools that accept keys
builder/cmdline.ml | 2 +-