From d6821af04773649dcac3abbb0aa31763655abed6 Mon Sep 17 00:00:00 2001 From: Daniel Ding Date: Wed, 3 Sep 2025 10:47:59 +0800 Subject: [PATCH] fix: frr start filed. --- .../openlan => usr/share}/frr/bgpip4.conf.1 | 0 .../openlan => usr/share}/frr/bgpip4.conf.2 | 0 .../{var/openlan => usr/share}/frr/daemons | 0 .../{var/openlan => usr/share}/frr/frr.conf | 0 .../{var/openlan => usr/share}/frr/vtysh.conf | 0 dist/rootfs/var/openlan/script/frr.sh | 24 ++++++++++++++++--- dist/rootfs/var/openlan/script/switch.sh | 4 ++-- 7 files changed, 23 insertions(+), 5 deletions(-) rename dist/rootfs/{var/openlan => usr/share}/frr/bgpip4.conf.1 (100%) rename dist/rootfs/{var/openlan => usr/share}/frr/bgpip4.conf.2 (100%) rename dist/rootfs/{var/openlan => usr/share}/frr/daemons (100%) rename dist/rootfs/{var/openlan => usr/share}/frr/frr.conf (100%) rename dist/rootfs/{var/openlan => usr/share}/frr/vtysh.conf (100%) diff --git a/dist/rootfs/var/openlan/frr/bgpip4.conf.1 b/dist/rootfs/usr/share/frr/bgpip4.conf.1 similarity index 100% rename from dist/rootfs/var/openlan/frr/bgpip4.conf.1 rename to dist/rootfs/usr/share/frr/bgpip4.conf.1 diff --git a/dist/rootfs/var/openlan/frr/bgpip4.conf.2 b/dist/rootfs/usr/share/frr/bgpip4.conf.2 similarity index 100% rename from dist/rootfs/var/openlan/frr/bgpip4.conf.2 rename to dist/rootfs/usr/share/frr/bgpip4.conf.2 diff --git a/dist/rootfs/var/openlan/frr/daemons b/dist/rootfs/usr/share/frr/daemons similarity index 100% rename from dist/rootfs/var/openlan/frr/daemons rename to dist/rootfs/usr/share/frr/daemons diff --git a/dist/rootfs/var/openlan/frr/frr.conf b/dist/rootfs/usr/share/frr/frr.conf similarity index 100% rename from dist/rootfs/var/openlan/frr/frr.conf rename to dist/rootfs/usr/share/frr/frr.conf diff --git a/dist/rootfs/var/openlan/frr/vtysh.conf b/dist/rootfs/usr/share/frr/vtysh.conf similarity index 100% rename from dist/rootfs/var/openlan/frr/vtysh.conf rename to dist/rootfs/usr/share/frr/vtysh.conf diff --git a/dist/rootfs/var/openlan/script/frr.sh b/dist/rootfs/var/openlan/script/frr.sh index 338b3e8..81c8ec8 100755 --- a/dist/rootfs/var/openlan/script/frr.sh +++ b/dist/rootfs/var/openlan/script/frr.sh @@ -1,8 +1,24 @@ #!/bin/bash +if [ -r "/lib/lsb/init-functions" ]; then + . /lib/lsb/init-functions +else + log_success_msg() { + echo "$@" + } + log_warning_msg() { + echo "$@" >&2 + } + log_failure_msg() { + echo "$@" >&2 + } +fi + +set -ex + sed -i 's/is\ not\ "/\!=\ "/' /usr/lib/frr/frr-reload.py -if [ ! -e /var/run/frr ]; then +if [ ! -e "/var/run/frr" ]; then mkdir -p /var/run/frr chown frr:frr /var/run/frr fi @@ -11,14 +27,16 @@ for file in daemons frr.conf vtysh.conf; do if [ -e "/etc/frr/$file" ]; then continue fi - if [ -e "/var/openlan/frr/$file" ]; then - cp -rvf /var/openlan/frr/$file /etc/frr/$file + if [ -e "/usr/share/frr/$file" ]; then + cp -rf "/usr/share/frr/$file" "/etc/frr/$file" fi done # Start reloader server for FRR exec /var/openlan/script/frr-server & +set +x + # Start daemons source /usr/lib/frr/frrcommon.sh /usr/lib/frr/watchfrr $(daemon_list) \ No newline at end of file diff --git a/dist/rootfs/var/openlan/script/switch.sh b/dist/rootfs/var/openlan/script/switch.sh index c967a67..e9ed89d 100755 --- a/dist/rootfs/var/openlan/script/switch.sh +++ b/dist/rootfs/var/openlan/script/switch.sh @@ -40,10 +40,10 @@ EOF fi for dir in acl findhop link output route network qos; do - if [ -e /etc/openlan/switch/$dir ]; then + if [ -e "/etc/openlan/switch/$dir" ]; then continue fi - mkdir -p /etc/openlan/switch/$dir + mkdir -p "/etc/openlan/switch/$dir" done # wait ipsec service