<commit_before>#!/bin/bash
#
# Copyright (C) 2013-2014 eNovance SAS <<EMAIL>>
#
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

ORIG=$(cd $(dirname $0); pwd)

do_fatal_error() {
    echo "$@" 1>&2
    exit 1
}

setup_network() {
if [ "$NETWORK_CONFIG" = "auto" ]; then
    # Fix network to start eth0 in DHCP
    if [ -f "$MDIR/etc/network/interfaces" ]; then
        if [ -r "$MDIR"/etc/network/interfaces ]; then
            cat > "$MDIR"/etc/network/interfaces <<EOF
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

source /etc/network/interfaces.d/*.cfg
EOF
        fi
    else
        cat > "$MDIR"/etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
EOF
        echo "NETWORKING=yes" >> "$MDIR"/etc/sysconfig/network
    fi<commit_msg>create-image: Split xenial network configuration<commit_after>#!/bin/bash
#
# Copyright (C) 2013-2014 eNovance SAS <<EMAIL>>
#
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

ORIG=$(cd $(dirname $0); pwd)

do_fatal_error() {
    echo "$@" 1>&2
    exit 1
}

setup_network() {
if [ "$NETWORK_CONFIG" = "auto" ]; then
    # Fix network to start eth0 in DHCP
    if [ -f "$MDIR/etc/network/interfaces" ]; then
        if [ -r "$MDIR"/etc/network/interfaces ]; then
            cat > "$MDIR"/etc/network/interfaces <<EOF
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
EOF

# Some distro needs a static network configuraiton
# Some needs to rely on cloudinit
# So let's adjust it based on the distro name
            distro=$(do_chroot $MDIR lsb_release -sc)
            case $distro in
                xenial)
                    cat >> "$MDIR"/etc/network/interfaces <<EOF
source /etc/network/interfaces.d/*.cfg
EOF
                ;;
                wheezy|jessie|trusty)
                    cat >> "$MDIR"/etc/network/interfaces <<EOF
auto eth0
iface eth0 inet dhcp
EOF
                ;;
                *)
                echo "Unknown distro : '$distro'"
                ;;
            esac
        fi
    else
        cat > "$MDIR"/etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
EOF
        echo "NETWORKING=yes" >> "$MDIR"/etc/sysconfig/network
    fi
{'fraction_non_alphanumeric': 0.11288380493678507, 'fraction_numerical': 0.014449127031908489, 'mean_word_length': 2.846064814814815, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5133953', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1023, 'n_words': 357}