This copies the hostname file from the bootstrap OS to the target OS,
which should presumably be the Right Thing because the p2v-target
instance will be created with its proper hostname.

Signed-off-by: Ben Lipton <[email protected]>
---
 instance-p2v-target/Makefile.am            |    3 ++-
 instance-p2v-target/fixes/40_copy_hostname |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)
 create mode 100755 instance-p2v-target/fixes/40_copy_hostname

diff --git a/instance-p2v-target/Makefile.am b/instance-p2v-target/Makefile.am
index b7e5650..b83ccab 100644
--- a/instance-p2v-target/Makefile.am
+++ b/instance-p2v-target/Makefile.am
@@ -22,7 +22,8 @@ dist_sbin_SCRIPTS = scripts/make_ramboot_initrd.py
 dist_fixes_SCRIPTS = \
        fixes/10_fix_fstab \
        fixes/20_remove_persistent_rules \
-       fixes/30_add_console_inittab
+       fixes/30_add_console_inittab \
+       fixes/40_copy_hostname
 
 dist_fixlib_DATA = \
        fixes/fixlib/fix_fstab.py \
diff --git a/instance-p2v-target/fixes/40_copy_hostname 
b/instance-p2v-target/fixes/40_copy_hostname
new file mode 100755
index 0000000..7b8c7a0
--- /dev/null
+++ b/instance-p2v-target/fixes/40_copy_hostname
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 Google Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+if [ -f "/etc/hostname" -a -d "/target/etc" ]; then
+  cp /etc/hostname /target/etc/hostname
+fi
-- 
1.7.3.1

Reply via email to