• Andy Whitcroft's avatar
    UBUNTU: [Debian] hyper-v -- fix comment handing in /etc/network/interfaces · 5795046f
    Andy Whitcroft authored
    We are duplicating the opening comment marker every time we rebuild the
    file, such that we end up with multiple of those comments:
    
        # This file describes the network interfaces available on your system
        # and how to activate them. For more information, see interfaces(5).
    
        # The loopback network interface
        auto lo
        iface lo inet loopback
    
        # The primary network interface
        # The following stanza(s) added by hv_set_ifconfig
        # The following stanza(s) added by hv_set_ifconfig
        # The following stanza(s) added by hv_set_ifconfig
        auto eth0
        iface eth0 inet static
    	    address 10.100.20.108
    	    gateway 10.100.20.1
    	    dns-nameservers 8.8.4.4
    
        #End of hv_set_ifconfig stanzas
    
    Fix handling of these such that we only insert new markers if they do
    not already exist.  Where they do, simply inject the new stanzas at the
    end of the block before the end marker.  At the same time deduplicate
    sequential begin and end markers to clean up previously dammaged files.
    
    BugLink: http://bugs.launchpad.net/bugs/1413020Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
    5795046f
hv_set_ifconfig 5.77 KB