From 556739406c4091dab0e483b14c1de3335550e3d8 Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Fri, 15 May 2020 17:35:47 +0200 Subject: [PATCH] ALT Linux support (#207) * F #159: Support ALT Linux * F #159: Support ALT Linux * F #159: Support ALT Linux * F #159: add support for alias context Co-authored-by: Alejandro Huertas --- generate-all.sh | 2 +- generate.sh | 3 + ...ne => loc-10-network##network-scripts.one} | 0 ...#arch.one => loc-10-network##networkd.one} | 69 ++++++++++++++++++- targets.sh | 34 ++++++--- 5 files changed, 95 insertions(+), 13 deletions(-) rename src/etc/one-context.d/{loc-10-network##rpm.one => loc-10-network##network-scripts.one} (100%) rename src/etc/one-context.d/{loc-10-network##arch.one => loc-10-network##networkd.one} (78%) diff --git a/generate-all.sh b/generate-all.sh index 6911a7c..fe76cba 100755 --- a/generate-all.sh +++ b/generate-all.sh @@ -3,7 +3,7 @@ set -e export DATE=$(date +%Y%m%d) -TARGETS='el6 el7 el7_ec2 el8 el8_ec2 suse deb deb_ec2 alpine freebsd iso' +TARGETS='el6 el7 el7_ec2 el8 el8_ec2 alt suse deb deb_ec2 alpine freebsd iso' for TARGET in $TARGETS; do TARGET="${TARGET}" ./generate.sh diff --git a/generate.sh b/generate.sh index 3bc0cce..44d725d 100755 --- a/generate.sh +++ b/generate.sh @@ -68,6 +68,9 @@ elif [ "${TARGET}" = 'arch' ]; then FILENAME="${NAME}-${VERSION}-${RELEASE_FULL}-any.${EXT}" elif [ "${TARGET}" = 'freebsd' ]; then FILENAME="${NAME}-${VERSION}_${RELEASE_FULL}.${EXT}" +elif [ "${TARGET}" = 'alt' ]; then + RELEASE_FULL="${RELSUFFIX}${RELEASE}" + FILENAME="${NAME}-${VERSION}-${RELEASE_FULL}.noarch.${EXT}" elif [ "${TYPE}" = 'iso' ]; then LABEL="${NAME}-${VERSION}" FILENAME="${NAME}-${VERSION}-${RELEASE_FULL}.${EXT}" diff --git a/src/etc/one-context.d/loc-10-network##rpm.one b/src/etc/one-context.d/loc-10-network##network-scripts.one similarity index 100% rename from src/etc/one-context.d/loc-10-network##rpm.one rename to src/etc/one-context.d/loc-10-network##network-scripts.one diff --git a/src/etc/one-context.d/loc-10-network##arch.one b/src/etc/one-context.d/loc-10-network##networkd.one similarity index 78% rename from src/etc/one-context.d/loc-10-network##arch.one rename to src/etc/one-context.d/loc-10-network##networkd.one index 5b24f65..e96ec25 100755 --- a/src/etc/one-context.d/loc-10-network##arch.one +++ b/src/etc/one-context.d/loc-10-network##networkd.one @@ -16,6 +16,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +COMMAND=${1} + # Gets IP address from a given MAC mac2ip() { mac=$1 @@ -145,6 +147,27 @@ gen_iface_conf() { [Network] Address=$IP/$CIDR EOT + INDEX=${interface: -1} + ALIAS=$(get_interface_alias) + + for nic_alias in $ALIAS; do + UPCASE_DEV="ETH${INDEX}_${nic_alias}" + IP=$(get_ip) + MASK=$(get_mask) + CIDR=$(mask2cidr "$MASK") + + EXTERNAL=$(get_iface_var "EXTERNAL") + EXTERNAL=${EXTERNAL^^} + DETACH=$(get_iface_var "DETACH") + + if [ -z "${DETACH}" ]; then + if [ -z "${EXTERNAL}" ] || [ $EXTERNAL = "NO" ]; then + if [ -n "${IP}" ]; then + echo "Address=$IP/$CIDR" + fi + fi + fi + done if [ -n "$GATEWAY" ]; then echo "Gateway=$GATEWAY" @@ -169,9 +192,33 @@ gen_iface6_conf() { cat <