75 lines
2.5 KiB
Bash
75 lines
2.5 KiB
Bash
#!/bin/sh
|
|
# postinst script for #PACKAGE#
|
|
#
|
|
# see: dh_installdeb(1)
|
|
|
|
set -e
|
|
|
|
# summary of how this script can be called:
|
|
# * <postinst> `configure' <most-recently-configured-version>
|
|
# * <old-postinst> `abort-upgrade' <new version>
|
|
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
|
# <new-version>
|
|
# * <postinst> `abort-remove'
|
|
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
|
# <failed-install-package> <version> `removing'
|
|
# <conflicting-package> <version>
|
|
# for details, see https://www.debian.org/doc/debian-policy/ or
|
|
# the debian-policy package
|
|
|
|
|
|
case "$1" in
|
|
configure)
|
|
|
|
echo "auto lo:0" >/etc/network/interfaces.d/lo
|
|
echo "iface lo:0 inet static\n address 10.1.$TIER_ID.$NODE_ID/32" >> /etc/network/interfaces.d/lo
|
|
echo "iface lo:0 inet6 static\n address 2604:bbc0::$TIER_ID:$NODE_ID/128" >> /etc/network/interfaces.d/lo
|
|
|
|
sed -e "s/VTEPINDEX/$MYID/" -e "s/TIERID/$TIERID/" -e "s/TIERASN/$(printf "%03d" $TIERID)/" -e "s/VTEPASN/$(printf "%03d" $MYID)/" /usr/share/wit-hypervisor/frr.conf.tmpl >/etc/frr/frr.conf
|
|
|
|
|
|
echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$MGMT_MAC'", ATTR{type}=="1", NAME="mgmt1"' >/etc/udev/rules.d/70-persistent-net.rules
|
|
i=0
|
|
for nic in $(ip -br link | awk '{ print $1 }'); do
|
|
if ethtool $nic | grep -q 10000; then
|
|
i=$((i+1))
|
|
echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$(cat /sys/class/net/$nic/address)'", ATTR{type}=="1", NAME="feth'$i'"' >>/etc/udev/rules.d/70-persistent-net.rules
|
|
fi
|
|
done
|
|
sed -i "/$MGMT_MAC.*feth./d" /etc/udev/rules.d/70-persistent-net.rules
|
|
|
|
|
|
|
|
systemctl stop systemd-networkd.socket
|
|
systemctl stop systemd-networkd.service
|
|
systemctl stop systemd-networkd-wait-online
|
|
systemctl disable systemd-networkd.service
|
|
systemctl disable systemd-networkd.socket
|
|
systemctl disable systemd-networkd-wait-online
|
|
|
|
systemctl enable firewall
|
|
systemctl restart systemd-timesyncd
|
|
systemctl restart strongswan
|
|
|
|
update-grub
|
|
|
|
sysctl -p /etc/sysctl.d/10-frr.conf
|
|
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# dh_installdeb will replace this with shell code automatically
|
|
# generated by other debhelper scripts.
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|