frr-migration.sh
· 1.6 KiB · Bash
Ham
# cp /usr/share/doc/quagga-core/examples/ospfd.conf.sample /etc/quagga/ospfd.conf && cp /usr/share/doc/quagga-core/examples/zebra.conf.sample /etc/quagga/zebra.conf && cp /usr/share/doc/quagga-core/examples/vtysh.conf.sample /etc/quagga/vtysh.conf
QUAGGA_USRGRP="frr:frr"
RELEASE="$(lsb_release -c -s)"
SERVICES=$(grep quagga /lib/systemd/system/*.service | cut -f1 -d: | uniq);
[ ! -f "/etc/apt/sources.list.d/${RELEASE}-backports-cyconet.list" ] && \
printf "deb http://ftp.cyconet.org/debian ${RELEASE}-backports main non-free contrib\ndeb-src http://ftp.cyconet.org/debian ${RELEASE}-backports main non-free contrib\n" > /etc/apt/sources.list.d/${RELEASE}-backports-cyconet.list; \
apt update && \
apt-get install -t ${RELEASE}-backports -y frr; \
[ -f /etc/frr/frr.conf ] && mv /etc/frr/frr.conf /etc/frr/frr.conf.orig; \
for SERVICE in $SERVICES; do
DAEMON=$(basename -s .service $SERVICE);
cp -a /etc/quagga/$DAEMON.conf /etc/frr/;
sed -i "/^log file/d" /etc/quagga/$DAEMON.conf;
sed -i "/^hostname/a log file \/var\/log\/frr\/$DAEMON.log" /etc/frr/$DAEMON.conf;
chown ${QUAGGA_USRGRP} /etc/frr/$DAEMON.conf;
sed -i "s/^$DAEMON=no/$DAEMON=yes/" /etc/frr/daemons;
done ; \
grep -E "^(hostname|password|log file|line)" /etc/frr/zebra.conf | sed s/zebra.log/staticd.log/g > /etc/frr/staticd.conf && \
grep "^ip route" /etc/frr/zebra.conf >> /etc/frr/staticd.conf && \
sed -i "/^ip route.*/d" /etc/frr/zebra.conf && \
[ -f /etc/frr/ospfd.conf ] && sed -i "s/ translate-candidate no-summary//" /etc/frr/ospfd.conf; \
chown ${QUAGGA_USRGRP} /etc/frr/staticd.conf && \
systemctl restart frr
| 1 | # cp /usr/share/doc/quagga-core/examples/ospfd.conf.sample /etc/quagga/ospfd.conf && cp /usr/share/doc/quagga-core/examples/zebra.conf.sample /etc/quagga/zebra.conf && cp /usr/share/doc/quagga-core/examples/vtysh.conf.sample /etc/quagga/vtysh.conf |
| 2 | QUAGGA_USRGRP="frr:frr" |
| 3 | RELEASE="$(lsb_release -c -s)" |
| 4 | SERVICES=$(grep quagga /lib/systemd/system/*.service | cut -f1 -d: | uniq); |
| 5 | [ ! -f "/etc/apt/sources.list.d/${RELEASE}-backports-cyconet.list" ] && \ |
| 6 | printf "deb http://ftp.cyconet.org/debian ${RELEASE}-backports main non-free contrib\ndeb-src http://ftp.cyconet.org/debian ${RELEASE}-backports main non-free contrib\n" > /etc/apt/sources.list.d/${RELEASE}-backports-cyconet.list; \ |
| 7 | apt update && \ |
| 8 | apt-get install -t ${RELEASE}-backports -y frr; \ |
| 9 | [ -f /etc/frr/frr.conf ] && mv /etc/frr/frr.conf /etc/frr/frr.conf.orig; \ |
| 10 | for SERVICE in $SERVICES; do |
| 11 | DAEMON=$(basename -s .service $SERVICE); |
| 12 | cp -a /etc/quagga/$DAEMON.conf /etc/frr/; |
| 13 | sed -i "/^log file/d" /etc/quagga/$DAEMON.conf; |
| 14 | sed -i "/^hostname/a log file \/var\/log\/frr\/$DAEMON.log" /etc/frr/$DAEMON.conf; |
| 15 | chown ${QUAGGA_USRGRP} /etc/frr/$DAEMON.conf; |
| 16 | sed -i "s/^$DAEMON=no/$DAEMON=yes/" /etc/frr/daemons; |
| 17 | done ; \ |
| 18 | grep -E "^(hostname|password|log file|line)" /etc/frr/zebra.conf | sed s/zebra.log/staticd.log/g > /etc/frr/staticd.conf && \ |
| 19 | grep "^ip route" /etc/frr/zebra.conf >> /etc/frr/staticd.conf && \ |
| 20 | sed -i "/^ip route.*/d" /etc/frr/zebra.conf && \ |
| 21 | [ -f /etc/frr/ospfd.conf ] && sed -i "s/ translate-candidate no-summary//" /etc/frr/ospfd.conf; \ |
| 22 | chown ${QUAGGA_USRGRP} /etc/frr/staticd.conf && \ |
| 23 | systemctl restart frr |
| 24 |