PVE::Tools::file_set_contents($hostname_fn, "$hostname\n");
} else {
my $data = PVE::Tools::file_get_contents($sysconfig_network);
- if ($data !~ s/^HOSTNAME=\s*(\S+)\s*$/HOSTNAME=$hostname/m) {
+ if ($data !~ s/^HOSTNAME=\s*(\S+)\s*$/HOSTNAME=$hostname\n/m) {
$data .= "HOSTNAME=$hostname\n";
}
PVE::Tools::file_set_contents($sysconfig_network, $data);
$lxc_setup->post_create_hook('$TEST$ABCDEF');
- my @testfiles = qw(/etc/hostname /etc/hosts /etc/inittab /etc/network/interfaces /etc/resolv.conf /etc/passwd /etc/shadow);
+ my @testfiles = qw(/etc/hostname /etc/hosts /etc/inittab /etc/network/interfaces /etc/resolv.conf /etc/passwd /etc/shadow /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth2 /etc/sysconfig/network-scripts/ifcfg-eth3 /etc/init/start-ttys.conf /etc/init/tty.conf);
foreach my $fn (@testfiles) {
next if !-f "$testdir/$fn.exp";
test_file("$testdir/$fn.exp", "$rootfs/$fn");
--- /dev/null
+lxc.utsname = test1
+lxc.network.type = veth
+pve.network.bridge = vmbr0
+lxc.network.name = eth0
+lxc.network.veth.pair = veth100i0
+pve.network.ip = 1.2.3.4/24
+pve.network.gw = 1.2.3.1
+lxc.network.type = veth
+pve.network.bridge = vmbr0
+lxc.network.name = eth1
+lxc.network.veth.pair = veth100i1
+pve.network.ip = 10.2.3.4/24
+lxc.network.type = veth
+pve.network.bridge = vmbr0
+lxc.network.name = eth2
+lxc.network.veth.pair = veth100i2
--- /dev/null
+127.0.0.1 localhost.localnet localhost
+1.2.3.4 test1.promxox.com test1
--- /dev/null
+#
+# This service starts the configured number of gettys.
+#
+# Do not edit this file directly. If you want to change the behaviour,
+# please create a file start-ttys.override and put your changes there.
+
+start on stopped rc RUNLEVEL=[2345]
+
+env ACTIVE_CONSOLES=/dev/tty[1-6]
+env X_TTY=/dev/tty1
+task
+script
+ . /etc/sysconfig/init
+ for tty in $(echo $ACTIVE_CONSOLES) ; do
+ [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue
+ initctl start tty TTY=$tty
+ done
+end script
--- /dev/null
+# tty - getty
+#
+# This service maintains a getty on the specified device.
+#
+# Do not edit this file directly. If you want to change the behaviour,
+# please create a file tty.override and put your changes there.
+
+stop on runlevel [S016]
+
+respawn
+instance $TTY
+exec /sbin/agetty -8 $TTY 38400
+usage 'tty TTY=/dev/ttyX - where X is console id'
--- /dev/null
+CentOS release 6.3 (Final)
--- /dev/null
+search promxox.com
+nameserver 8.8.8.8
+nameserver 8.8.8.9
--- /dev/null
+DEVICE=eth0
+ONBOOT=yes
+BOOTPROTO=none
+IPADDR=1.2.3.4
+NETMASK=255.255.255.0
+GATEWAY=1.2.3.1
--- /dev/null
+DEVICE=eth1
+ONBOOT=yes
+BOOTPROTO=none
+IPADDR=10.2.3.4
+NETMASK=255.255.255.0
--- /dev/null
+DEVICE=eth2
+ONBOOT=yes
+BOOTPROTO=none
--- /dev/null
+HOSTNAME=test1