Displaying 8 results from an estimated 8 matches for "replace_line_in_fil".
Did you mean:
replace_line_in_file
2014 Feb 12
1
[PATCH 2/2] mllib: hostname: add a newline in /etc/hostname
...tc/hostname usually has an ending newline, so add it when changing it.
---
mllib/hostname.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mllib/hostname.ml b/mllib/hostname.ml
index e1c5d4b..cffba6b 100644
--- a/mllib/hostname.ml
+++ b/mllib/hostname.ml
@@ -79,7 +79,7 @@ and replace_line_in_file g filename key value =
g#write filename content
and update_etc_hostname g hostname =
- g#write "/etc/hostname" hostname
+ g#write "/etc/hostname" (hostname ^ "\n")
and update_etc_machine_info g hostname =
replace_line_in_file g "/etc/machine-info&qu...
2014 Feb 13
2
Re: [PATCH] mllib: hostname: replace the hostname on Debian also in /etc/hosts (RHBZ#953907).
On Thursday 13 February 2014 13:33:16 Richard W.M. Jones wrote:
> On Thu, Feb 13, 2014 at 02:15:31PM +0100, Pino Toscano wrote:
> > + let expr = "/files/etc/hosts/*[label() != '#comment']/*[label()
> > != 'ipaddr'][. = '" ^ oldhost ^ "']" in
> Quoting? If oldhost contains a ' character + some Augeas code, this
> might be
2014 Feb 12
2
[PATCH 1/2] mllib: hostname: replace the hostname on Debian also in /etc/hosts (RHBZ#953907).
...ame hostname
+ | None -> ()
+ );
true
| "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based"), _ ->
@@ -78,3 +83,20 @@ and update_etc_hostname g hostname =
and update_etc_machine_info g hostname =
replace_line_in_file g "/etc/machine-info" "PRETTY_HOSTNAME" hostname
+
+and read_etc_hostname g =
+ let filename = "/etc/hostname" in
+ if g#is_file filename then (
+ let lines = Array.to_list (g#read_lines filename) in
+ match lines with
+ | hd :: _ -> Some hd
+ | [] -&...
2014 Feb 13
2
[PATCH] mllib: hostname: replace the hostname on Debian also in /etc/hosts (RHBZ#953907).
...ame hostname
+ | None -> ()
+ );
true
| "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based"), _ ->
@@ -78,3 +83,25 @@ and update_etc_hostname g hostname =
and update_etc_machine_info g hostname =
replace_line_in_file g "/etc/machine-info" "PRETTY_HOSTNAME" hostname
+
+and read_etc_hostname g =
+ let filename = "/etc/hostname" in
+ if g#is_file filename then (
+ let lines = Array.to_list (g#read_lines filename) in
+ match lines with
+ | hd :: _ -> Some hd
+ | [] -&...
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
2015 Oct 06
0
[PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...efix mode "0" then "0o" ^ mode else mode in
g#chmod (int_of_string mode) path
| `Command cmd ->
diff --git a/customize/hostname.ml b/customize/hostname.ml
index 5721e1a..621d4f3 100644
--- a/customize/hostname.ml
+++ b/customize/hostname.ml
@@ -69,7 +69,7 @@ and replace_line_in_file g filename key value =
if g#is_file filename then (
let lines = Array.to_list (g#read_lines filename) in
let lines = List.filter (
- fun line -> not (string_prefix line (key ^ "="))
+ fun line -> not (String.is_prefix line (key ^ "="))...
2015 Oct 06
10
[PATCH 0/5] mllib: Hide bad String functions and miscellaneous refactoring.
Hide/prevent the use of bad string functions like String.lowercase.
These are replaced by safe functions that won't break UTF-8 strings.
Other miscellaneous refactoring.
Rich.
2017 Aug 01
2
[PATCH] Add missing oraclelinux cases.
...x", ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based"), _ ->
+ | "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"oraclelinux"|"redhat-based"), _ ->
replace_line_in_file g "/etc/sysconfig/network" "HOSTNAME" hostname;
true
diff --git a/customize/password.ml b/customize/password.ml
index d26b9486590e..dc69b8eb718d 100644
--- a/customize/password.ml
+++ b/customize/password.ml
@@ -144,9 +144,9 @@ and default_crypto g root =
let distro =...