NetworkManager/tools/meson-post-install.sh
Thomas Haller 69f048bf0c cloud-setup: add tool for automatic IP configuration in cloud
This is a tool for automatically configuring networking in a cloud
environment.

Currently it only supports IPv4 on EC2, but it's intended for extending
to other cloud providers (Azure). See [1] and [2] for how to configure
secondary IP addresses on EC2. This is what the tool currently aims to
do (but in the future it might do more).

[1] https://aws.amazon.com/premiumsupport/knowledge-center/ec2-ubuntu-secondary-network-interface/

It is inspired by SuSE's cloud-netconfig ([1], [2]) and ec2-net-utils
package on Amazon Linux ([3], [4]).

[1] https://www.suse.com/c/multi-nic-cloud-netconfig-ec2-azure/
[2] https://github.com/SUSE-Enceladus/cloud-netconfig
[3] https://github.com/aws/ec2-net-utils
[4] https://github.com/lorengordon/ec2-net-utils.git

It is also intended to work without configuration. The main point is
that you boot an image with NetworkManager and nm-cloud-setup enabled,
and it just works.
2019-11-28 19:52:18 +01:00

65 lines
2 KiB
Bash
Executable file

#!/bin/sh
nm_datadir="$1"
nm_bindir="$2"
nm_pkgconfdir="$3"
nm_pkglibdir="$4"
nm_pkgstatedir="$5"
nm_mandir="$6"
nm_sysconfdir="$7"
enable_docs="$8"
enable_ifcfg_rh="$9"
enable_nm_cloud_setup="${10}"
install_systemdunitdir="${11}"
[ -n "$DESTDIR" ] && DESTDIR="${DESTDIR%%/}/"
if [ -f "${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli-completion" ]; then
mv "${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli-completion" \
"${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli"
fi
if [ -x "${DESTDIR}${nm_bindir}/nmtui" ]; then
for alias in nmtui-connect nmtui-edit nmtui-hostname; do
ln -sf nmtui "${DESTDIR}${nm_bindir}/$alias"
done
fi
for dir in "${nm_pkgconfdir}/conf.d" \
"${nm_pkgconfdir}/system-connections" \
"${nm_pkgconfdir}/dispatcher.d/no-wait.d" \
"${nm_pkgconfdir}/dispatcher.d/pre-down.d" \
"${nm_pkgconfdir}/dispatcher.d/pre-up.d" \
"${nm_pkgconfdir}/dnsmasq.d" \
"${nm_pkgconfdir}/dnsmasq-shared.d" \
"${nm_pkglibdir}/conf.d" \
"${nm_pkglibdir}/dispatcher.d/no-wait.d" \
"${nm_pkglibdir}/dispatcher.d/pre-down.d" \
"${nm_pkglibdir}/dispatcher.d/pre-up.d" \
"${nm_pkglibdir}/system-connections" \
"${nm_pkglibdir}/VPN"; do
mkdir -p "${DESTDIR}${dir}"
chmod 0755 "${DESTDIR}${dir}"
done
mkdir -p "${DESTDIR}${nm_pkgstatedir}"
chmod 0700 "${DESTDIR}${nm_pkgstatedir}"
if [ "$enable_docs" = 1 ]; then
for alias in nmtui-connect nmtui-edit nmtui-hostname; do
ln -f "${DESTDIR}${nm_mandir}/man1/nmtui.1" "${DESTDIR}${nm_mandir}/man1/${alias}.1"
done
ln -f "${DESTDIR}${nm_mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${nm_mandir}/man5/nm-system-settings.conf.5"
fi
if [ "$enable_ifcfg_rh" = 1 ]; then
mkdir -p "${DESTDIR}${nm_sysconfdir}/sysconfig/network-scripts"
fi
if [ "$enable_nm_cloud_setup" = 1 -a "$install_systemdunitdir" = 1 ]; then
ln -s 'no-wait.d/90-nm-cloud-setup.sh' "${DESTDIR}${nm_pkglibdir}/dispatcher.d/90-nm-cloud-setup.sh"
fi