[pve-devel] [PATCH pve-container 2/5] setup/debian: avoid extra newlines

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Oct 16 08:31:59 CEST 2015


At the beginning of a file or between sections, if there
have been two newlines already we don't need to add another.
---
 src/PVE/LXC/Setup/Debian.pm                         | 2 +-
 src/test/test-debian-002/etc/network/interfaces.exp | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/PVE/LXC/Setup/Debian.pm b/src/PVE/LXC/Setup/Debian.pm
index 752d670..07dccfc 100644
--- a/src/PVE/LXC/Setup/Debian.pm
+++ b/src/PVE/LXC/Setup/Debian.pm
@@ -240,7 +240,7 @@ sub setup_network {
 	
     }
 
-    my $need_separator = 1;
+    my $need_separator = length($interfaces) && ($interfaces !~ /\n\n$/);
     foreach my $ifname (sort keys %$networks) {
 	my $net = $networks->{$ifname};
 	
diff --git a/src/test/test-debian-002/etc/network/interfaces.exp b/src/test/test-debian-002/etc/network/interfaces.exp
index d8f9f5c..9d9dbcc 100644
--- a/src/test/test-debian-002/etc/network/interfaces.exp
+++ b/src/test/test-debian-002/etc/network/interfaces.exp
@@ -1,4 +1,3 @@
-
 auto eth0
 iface eth0 inet static
 	address 1.2.3.4
-- 
2.1.4





More information about the pve-devel mailing list