[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [p2v PATCH] make-disk: set p2v.local as hostname



Set p2v.local as hostname for the p2v disk image, so it will be fixed,
instead of whatever is set in the used templates.  This is also somewhat
important during the distribution update, and installation of our
packages: there may be distribution packages actually using the hostname
to initialize stuff (e.g. configuration values), and thus the unset
value "(none)" triggers errors.

The additional command to set the hostname is for the appliance itself:
the hostname will be set on the running kernel, which is the appliance
own, so getting it later on with hostname(1) works.
---
 virt-p2v-make-disk.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/virt-p2v-make-disk.in b/virt-p2v-make-disk.in
index 1bec4e3..132211d 100644
--- a/virt-p2v-make-disk.in
+++ b/virt-p2v-make-disk.in
@@ -233,11 +233,16 @@ fi
 
 # Run virt-builder.  Note we controversially assume systemd here.  We
 # could provide a sysvinit fallback if required.
+# The manual 'hostname' invocation is needed to set the hostname
+# also for the appliance itself, so scriptlets can properly use
+# the hostname we want.
 virt-builder "$osversion"                                       \
     $verbose_option						\
     --output "$output"                                          \
     $arch_option						\
     $preinstall_args                                            \
+    --hostname p2v.local                                        \
+    --run-command 'hostname p2v.local'                          \
     --update                                                    \
     --install "$install"                                        \
     --root-password password:p2v                                \
-- 
2.21.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]