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 <ahuertas@opennebula.io>
pull/208/head
Vlastimil Holer 5 years ago committed by GitHub
parent 56bcbbd417
commit 556739406c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,7 @@
set -e set -e
export DATE=$(date +%Y%m%d) 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 for TARGET in $TARGETS; do
TARGET="${TARGET}" ./generate.sh TARGET="${TARGET}" ./generate.sh

@ -68,6 +68,9 @@ elif [ "${TARGET}" = 'arch' ]; then
FILENAME="${NAME}-${VERSION}-${RELEASE_FULL}-any.${EXT}" FILENAME="${NAME}-${VERSION}-${RELEASE_FULL}-any.${EXT}"
elif [ "${TARGET}" = 'freebsd' ]; then elif [ "${TARGET}" = 'freebsd' ]; then
FILENAME="${NAME}-${VERSION}_${RELEASE_FULL}.${EXT}" 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 elif [ "${TYPE}" = 'iso' ]; then
LABEL="${NAME}-${VERSION}" LABEL="${NAME}-${VERSION}"
FILENAME="${NAME}-${VERSION}-${RELEASE_FULL}.${EXT}" FILENAME="${NAME}-${VERSION}-${RELEASE_FULL}.${EXT}"

@ -16,6 +16,8 @@
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
COMMAND=${1}
# Gets IP address from a given MAC # Gets IP address from a given MAC
mac2ip() { mac2ip() {
mac=$1 mac=$1
@ -145,6 +147,27 @@ gen_iface_conf() {
[Network] [Network]
Address=$IP/$CIDR Address=$IP/$CIDR
EOT 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 if [ -n "$GATEWAY" ]; then
echo "Gateway=$GATEWAY" echo "Gateway=$GATEWAY"
@ -169,9 +192,33 @@ gen_iface6_conf() {
cat <<EOT cat <<EOT
[Network] [Network]
Address=$IP6/${IP6_PREFIX_LENGTH:-64} Address=$IP6/${IP6_PREFIX_LENGTH:-64}
IPv6AcceptRA=false
EOT EOT
INDEX=${interface: -1}
ALIAS=$(get_interface_alias)
for nic_alias in $ALIAS; do
UPCASE_DEV="ETH${INDEX}_${nic_alias}"
IP6=$(get_iface_var "IP6")
[[ -z $IP6 ]] && IP6=$(get_iface_var "IPV6")
IP6_PREFIX_LENGTH=$(get_iface_var "IP6_PREFIX_LENGTH")
IP6_ULA=$(get_iface_var "IP6_ULA")
EXTERNAL=$(get_iface_var "EXTERNAL")
EXTERNAL=${EXTERNAL^^}
DETACH=$(get_iface_var "DETACH")
if [ -z "${DETACH}" ]; then
if [ -z "${EXTERNAL}" ] || [ $EXTERNAL = "NO" ]; then
if [ -n "${IP6}" ]; then
echo "Address=$IP6/${IP6_PREFIX_LENGTH:-64}"
fi
fi
fi
done
echo "IPv6AcceptRA=false"
if [ -n "$GATEWAY6" ]; then if [ -n "$GATEWAY6" ]; then
echo "Gateway=$GATEWAY6" echo "Gateway=$GATEWAY6"
fi fi
@ -208,6 +255,11 @@ get_context_interfaces()
env | grep -E "^ETH[0-9]+_MAC=" | sed 's/_.*$//' | sort env | grep -E "^ETH[0-9]+_MAC=" | sed 's/_.*$//' | sort
} }
get_interface_alias()
{
env | grep -E "^ETH${INDEX}_ALIAS[0-9]+_MAC=" | cut -d '_' -f 2 | sort
}
get_dev() get_dev()
{ {
list="$1" list="$1"
@ -271,7 +323,18 @@ EOT
done done
} }
[ -z "$(env | cut -d= -f1 | grep -E '^ETH[0-9]+_IP6*')" ] && exit 0 configure_network()
{
gen_network_configuration gen_network_configuration
if [ "${COMMAND}" = 'reconfigure' ]; then
systemctl restart systemd-networkd.service
fi
sleep 2
}
[ -z "$(env | cut -d= -f1 | grep -E '^ETH[0-9]+_IPV*6*')" ] && exit 0
configure_network

@ -37,7 +37,7 @@ case "${TARGET}" in
NAME=${NAME:-one-context} NAME=${NAME:-one-context}
RELSUFFIX=${RELSUFFIX:-.el6} RELSUFFIX=${RELSUFFIX:-.el6}
TYPE=${TYPE:-rpm} TYPE=${TYPE:-rpm}
TAGS=${TAGS:-rpm sysv one} TAGS=${TAGS:-rpm sysv one network-scripts}
DEPENDS=${DEPENDS:-util-linux-ng bash curl bind-utils cloud-utils-growpart dracut-modules-growroot parted ruby rubygem-json sudo shadow-utils openssh-server open-vm-tools qemu-guest-agent} DEPENDS=${DEPENDS:-util-linux-ng bash curl bind-utils cloud-utils-growpart dracut-modules-growroot parted ruby rubygem-json sudo shadow-utils openssh-server open-vm-tools qemu-guest-agent}
PROVIDES=${PROVIDES:-} PROVIDES=${PROVIDES:-}
REPLACES=${REPLACES:-cloud-init} REPLACES=${REPLACES:-cloud-init}
@ -53,7 +53,7 @@ case "${TARGET}" in
NAME=${NAME:-one-context-ec2} NAME=${NAME:-one-context-ec2}
RELSUFFIX=${RELSUFFIX:-.el6} RELSUFFIX=${RELSUFFIX:-.el6}
TYPE=${TYPE:-rpm} TYPE=${TYPE:-rpm}
TAGS=${TAGS:-rpm sysv ec2} TAGS=${TAGS:-rpm sysv ec2 network-scripts}
DEPENDS=${DEPENDS:-util-linux-ng bash curl bind-utils cloud-utils-growpart dracut-modules-growroot parted ruby rubygem-json sudo shadow-utils openssh-server} DEPENDS=${DEPENDS:-util-linux-ng bash curl bind-utils cloud-utils-growpart dracut-modules-growroot parted ruby rubygem-json sudo shadow-utils openssh-server}
PROVIDES=${PROVIDES:-} PROVIDES=${PROVIDES:-}
REPLACES=${REPLACES:-cloud-init} REPLACES=${REPLACES:-cloud-init}
@ -68,7 +68,7 @@ case "${TARGET}" in
NAME=${NAME:-one-context} NAME=${NAME:-one-context}
RELSUFFIX=${RELSUFFIX:-.el7} RELSUFFIX=${RELSUFFIX:-.el7}
TYPE=${TYPE:-rpm} TYPE=${TYPE:-rpm}
TAGS=${TAGS:-rpm systemd one} TAGS=${TAGS:-rpm systemd one network-scripts}
DEPENDS=${DEPENDS:-util-linux bash curl bind-utils cloud-utils-growpart parted ruby rubygem-json sudo shadow-utils openssh-server open-vm-tools qemu-guest-agent} DEPENDS=${DEPENDS:-util-linux bash curl bind-utils cloud-utils-growpart parted ruby rubygem-json sudo shadow-utils openssh-server open-vm-tools qemu-guest-agent}
PROVIDES=${PROVIDES:-} PROVIDES=${PROVIDES:-}
REPLACES=${REPLACES:-cloud-init} REPLACES=${REPLACES:-cloud-init}
@ -83,7 +83,7 @@ case "${TARGET}" in
NAME=${NAME:-one-context-ec2} NAME=${NAME:-one-context-ec2}
RELSUFFIX=${RELSUFFIX:-.el7} RELSUFFIX=${RELSUFFIX:-.el7}
TYPE=${TYPE:-rpm} TYPE=${TYPE:-rpm}
TAGS=${TAGS:-rpm systemd ec2} TAGS=${TAGS:-rpm systemd ec2 network-scripts}
DEPENDS=${DEPENDS:-util-linux bash curl bind-utils cloud-utils-growpart parted ruby rubygem-json sudo shadow-utils openssh-server} DEPENDS=${DEPENDS:-util-linux bash curl bind-utils cloud-utils-growpart parted ruby rubygem-json sudo shadow-utils openssh-server}
PROVIDES=${PROVIDES:-} PROVIDES=${PROVIDES:-}
REPLACES=${REPLACES:-cloud-init} REPLACES=${REPLACES:-cloud-init}
@ -98,7 +98,7 @@ case "${TARGET}" in
NAME=${NAME:-one-context} NAME=${NAME:-one-context}
RELSUFFIX=${RELSUFFIX:-.el8} RELSUFFIX=${RELSUFFIX:-.el8}
TYPE=${TYPE:-rpm} TYPE=${TYPE:-rpm}
TAGS=${TAGS:-rpm systemd one} TAGS=${TAGS:-rpm systemd one network-scripts}
DEPENDS=${DEPENDS:-util-linux bash curl bind-utils cloud-utils-growpart parted ruby rubygem-json sudo shadow-utils openssh-server open-vm-tools qemu-guest-agent network-scripts} DEPENDS=${DEPENDS:-util-linux bash curl bind-utils cloud-utils-growpart parted ruby rubygem-json sudo shadow-utils openssh-server open-vm-tools qemu-guest-agent network-scripts}
PROVIDES=${PROVIDES:-} PROVIDES=${PROVIDES:-}
REPLACES=${REPLACES:-cloud-init} REPLACES=${REPLACES:-cloud-init}
@ -113,7 +113,7 @@ case "${TARGET}" in
NAME=${NAME:-one-context-ec2} NAME=${NAME:-one-context-ec2}
RELSUFFIX=${RELSUFFIX:-.el8} RELSUFFIX=${RELSUFFIX:-.el8}
TYPE=${TYPE:-rpm} TYPE=${TYPE:-rpm}
TAGS=${TAGS:-rpm systemd ec2} TAGS=${TAGS:-rpm systemd ec2 network-scripts}
DEPENDS=${DEPENDS:-util-linux bash curl bind-utils cloud-utils-growpart parted ruby rubygem-json sudo shadow-utils openssh-server network-scripts} DEPENDS=${DEPENDS:-util-linux bash curl bind-utils cloud-utils-growpart parted ruby rubygem-json sudo shadow-utils openssh-server network-scripts}
PROVIDES=${PROVIDES:-} PROVIDES=${PROVIDES:-}
REPLACES=${REPLACES:-cloud-init} REPLACES=${REPLACES:-cloud-init}
@ -124,11 +124,27 @@ case "${TARGET}" in
POSTUP=${POSTUP:-pkg/postupgrade} POSTUP=${POSTUP:-pkg/postupgrade}
;; ;;
'alt')
NAME=${NAME:-one-context}
RELSUFFIX=${RELSUFFIX:-alt}
TYPE=${TYPE:-rpm}
TAGS=${TAGS:-rpm systemd one networkd}
DEPENDS=${DEPENDS:-bind-utils btrfs-progs cloud-utils-growpart curl e2fsprogs iproute2 openssl parted passwd qemu-guest-agent open-vm-tools ruby-json-pure sudo systemd-services wget which xfsprogs}
PROVIDES=${PROVIDES:-}
REPLACES=${REPLACES:-cloud-init}
CONFLICTS=${CONFLICTS:-${REPLACES} one-context-ec2}
POSTIN=${POSTINST:-pkg/postinstall}
PREUN=${PREUN:-pkg/preuninstall}
POSTUN=${POSTUN:-pkg/postuninstall}
POSTUP=${POSTUP:-pkg/postupgrade}
;;
'suse') 'suse')
NAME=${NAME:-one-context} NAME=${NAME:-one-context}
RELSUFFIX=${RELSUFFIX:-.suse} RELSUFFIX=${RELSUFFIX:-.suse}
TYPE=${TYPE:-rpm} TYPE=${TYPE:-rpm}
TAGS=${TAGS:-rpm systemd one} TAGS=${TAGS:-rpm systemd one network-scripts}
DEPENDS=${DEPENDS:-util-linux bash curl bind-utils growpart parted parted ruby sudo shadow openssh open-vm-tools qemu-guest-agent} # rubygem-json} DEPENDS=${DEPENDS:-util-linux bash curl bind-utils growpart parted parted ruby sudo shadow openssh open-vm-tools qemu-guest-agent} # rubygem-json}
PROVIDES=${PROVIDES:-} PROVIDES=${PROVIDES:-}
REPLACES=${REPLACES:-cloud-init cloud-init-config-suse} REPLACES=${REPLACES:-cloud-init cloud-init-config-suse}
@ -143,7 +159,7 @@ case "${TARGET}" in
NAME=${NAME:-one-context-ec2} NAME=${NAME:-one-context-ec2}
RELSUFFIX=${RELSUFFIX:-.suse} RELSUFFIX=${RELSUFFIX:-.suse}
TYPE=${TYPE:-rpm} TYPE=${TYPE:-rpm}
TAGS=${TAGS:-rpm systemd ec2} TAGS=${TAGS:-rpm systemd ec2 network-scripts}
DEPENDS=${DEPENDS:-util-linux bash curl bind-utils growpart parted ruby sudo shadow openssh} # rubygem-json} DEPENDS=${DEPENDS:-util-linux bash curl bind-utils growpart parted ruby sudo shadow openssh} # rubygem-json}
PROVIDES=${PROVIDES:-} PROVIDES=${PROVIDES:-}
REPLACES=${REPLACES:-cloud-init cloud-init-config-suse} REPLACES=${REPLACES:-cloud-init cloud-init-config-suse}
@ -225,7 +241,7 @@ case "${TARGET}" in
RELSUFFIX=${RELSUFFIX:-} RELSUFFIX=${RELSUFFIX:-}
TYPE=${TYPE:-pacman} TYPE=${TYPE:-pacman}
EXT=${EXT:-pkg.tar.xz} EXT=${EXT:-pkg.tar.xz}
TAGS=${TAGS:-arch systemd one} TAGS=${TAGS:-arch systemd one networkd}
# mkinitcpio-growrootfs ruby-json # mkinitcpio-growrootfs ruby-json
DEPENDS=${DEPENDS:-filesystem util-linux bash curl bind-tools ruby sudo shadow open-vm-tools qemu-guest-agent} DEPENDS=${DEPENDS:-filesystem util-linux bash curl bind-tools ruby sudo shadow open-vm-tools qemu-guest-agent}
PROVIDES=${PROVIDES:-} PROVIDES=${PROVIDES:-}

Loading…
Cancel
Save