cleanup ...

This commit is contained in:
root 2018-07-28 20:52:38 +00:00
parent 27ece3ddea
commit a88beae0e2
2 changed files with 25 additions and 3 deletions

View File

@ -1,2 +1,3 @@
/etc/frr/frr.conf.wit
/etc/ipsec.conf.wit
/etc/ipsec.secrets.wit

View File

@ -21,6 +21,11 @@ set -e
case "$1" in
configure)
### START gather all the info from the box and generate the variabels
[ -z $NODE_ID ] && export NODE_ID=$(ip -4 -br addr | grep 10.0. | awk '{ print $3 }' | awk 'BEGIN{FS="[./]"} { print $4 }')
export MGMT_ID=$(ip -4 -br addr | grep 10.0. | awk '{ print $3 }' | awk 'BEGIN{FS="[./]"} { print $3 }')
@ -54,6 +59,10 @@ case "$1" in
export LOOPBACKv4="10.1.$TIER_ID.$NODE_ID"
export LOOPBACKv6="2604:bbc0::$TIER_ID:$NODE_ID"
## END variables
## START writing config files
echo "auto lo:0" >/etc/network/interfaces.d/lo
@ -68,9 +77,6 @@ case "$1" in
chown frr.frr /etc/frr/frr.conf.wit /etc/frr/daemons.wit
sed -i -e "/.*debcore1/d" -e "/.*${HOSTNAME}/d" -e "$ s/$/\n${LOOPBACKv4} ${HOSTNAME}${DOMAINNAME} ${HOSTNAME}/" /etc/hosts
sed -i -e "s/HOSTNAME\.DOMAINNAME/${HOSTNAME}${DOMAINNAME}/" /etc/ipsec.conf.wit
echo ": RSA ${HOSTNAME}${DOMAINNAME}.key" >/etc/ipsec.secrets
chmod 600 /etc/ipsec.secrets
@ -89,6 +95,18 @@ case "$1" in
sed -i "/$MGMT_MAC.*feth./d" /etc/udev/rules.d/70-persistent-net.rules
sed -i -e "/.*debcore1/d" -e "/.*${HOSTNAME}/d" /etc/hosts
echo -e "${LOOPBACKv4}\t${HOSTNAME}${DOMAINNAME}\t${HOSTNAME}" >>/etc/hosts
sed -i -e '/GRUB_CMDLINE_LINUX_DEFAULT=/d' -e '/GRUB_CMDLINE_LINUX=/d' -e '/GRUB_SERIAL_COMMAND=/d' -e '/GRUB_TERMINAL=/d' /etc/default/grub
echo -e 'GRUB_CMDLINE_LINUX_DEFAULT=""\nGRUB_CMDLINE_LINUX="console=tty0 console=ttyS1,115200n8"\nGRUB_TERMINAL=serial\nGRUB_SERIAL_COMMAND="serial --speed=115200 --unit=1 --word=8 --parity=no --stop=1"' >>/etc/default/grub
## END config file section
## START configuring services as we need it
systemctl stop systemd-networkd.socket
systemctl stop systemd-networkd.service
systemctl stop systemd-networkd-wait-online
@ -104,6 +122,9 @@ case "$1" in
sysctl -p /etc/sysctl.d/10-frr.conf
## END services section
;;
abort-upgrade|abort-remove|abort-deconfigure)