File: 60-remove-cloud-image-interfaces

package info (click to toggle)
python-diskimage-builder 3.2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,616 kB
  • sloc: sh: 7,689; python: 3,933; makefile: 34
file content (34 lines) | stat: -rwxr-xr-x 849 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

# Cloud images may hard code the eth0 interfaces so they
# boot with DHCP.

# Fedora
rm -f /etc/sysconfig/network-scripts/ifcfg-eth*

# Ubuntu
rm -f /etc/network/interfaces.d/eth*.cfg

# Debian
rm -f /etc/network/interfaces.d/eth*

# Gentoo
rm -f /etc/conf.d/net*

# /etc/network/interfaces distributions
if [ -f "/etc/network/interfaces" ]; then
    printf "auto lo\niface lo inet loopback\n\n" > /etc/network/interfaces
    if [ -d "/etc/network/interfaces.d/" ]; then
        if [ "$DISTRO_NAME" == "ubuntu" ] && [ "$DIB_RELEASE" == "trusty" ]; then
            printf "source-directory interfaces.d\n\n" >> /etc/network/interfaces
        else
            printf "source /etc/network/interfaces.d/*\n\n" >> /etc/network/interfaces
        fi
    fi
fi