<commit_before>#!/bin/bash

# Warewulf doesn't support network interface aliases (e.g. ib0:1).
# So create the ifcfg- files and bring up the Lustre networks here
# instead, and launch from a systemd unit.

parent=$1

parent_ip=$(ip a show dev ${parent} scope global | awk '{if ($1 == "inet") {print $2}}' | awk -F/ '{print $1}')

shift
while (( "$#" )); do
# Alias IP
aip=$(echo $parent_ip | awk -v aname=$1 'BEGIN {FS="."; OFS="."} {print $1, 10 + aname, $3, $4}')

alias_full="${parent}:$1"

cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-${alias_full}<commit_msg>fix ifcfg syntax if already multiple IPs present<commit_after>#!/bin/bash

# Warewulf doesn't support network interface aliases (e.g. ib0:1).
# So create the ifcfg- files and bring up the Lustre networks here
# instead, and launch from a systemd unit.

parent=$1

parent_ip=$(ip a show dev ${parent} scope global | awk '{if ($1 == "inet") {print $2}}' | awk -F/ '{print $1}' | head -1 )

shift
while (( "$#" )); do
# Alias IP
aip=$(echo $parent_ip | awk -v aname=$1 'BEGIN {FS="."; OFS="."} {print $1, 10 + aname, $3, $4}')

alias_full="${parent}:$1"

cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-${alias_full}
{'fraction_non_alphanumeric': 0.19289340101522842, 'fraction_numerical': 0.02284263959390863, 'mean_word_length': 4.304932735426009, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5274844', 'n_tokens_mistral': 448, 'n_tokens_neox': 430, 'n_words': 146}