diff --git a/script/bootstrap b/script/bootstrap index 67d194b1ca7..8eef4f3e9e4 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -57,7 +57,12 @@ install_packages_apt() sudo apt-get install --no-install-recommends -y libdbus-1-dev # mDNS - sudo apt-get install --no-install-recommends -y libavahi-client3 libavahi-common-dev libavahi-client-dev avahi-daemon + sudo apt-get install --no-install-recommends -y libavahi-client3 libavahi-common-dev libavahi-client-dev + + if [[ ${OTBR_MDNS} == "avahi" ]];then + sudo apt-get install --no-install-recommends -y avahi-daemon + fi + (MDNS_RESPONDER_SOURCE_NAME=mDNSResponder-1790.80.10 \ && MDNS_RESPONDER_PATCH_PATH=$(realpath "$(dirname "$0")"/../third_party/mDNSResponder) \ && cd /tmp \ diff --git a/script/server b/script/server index b4eaedfb9ac..13ab3d164b4 100755 --- a/script/server +++ b/script/server @@ -47,7 +47,10 @@ startup() if have systemctl; then systemctl is-active rsyslog || sudo systemctl start rsyslog || die 'Failed to start rsyslog!' systemctl is-active dbus || sudo systemctl start dbus || die 'Failed to start dbus!' - systemctl is-active avahi-daemon || sudo systemctl start avahi-daemon || die 'Failed to start avahi!' + sudo service mdns status || sudo service mdns start || echo "service mdns is not available!" + if [[ ${OTBR_MDNS} == "avahi" ]];then + systemctl is-active avahi-daemon || sudo systemctl start avahi-daemon || die 'Failed to start avahi!' + fi without WEB_GUI || systemctl is-active otbr-web || sudo systemctl start otbr-web || die 'Failed to start otbr-web!' systemctl is-active otbr-agent || sudo systemctl start otbr-agent || die 'Failed to start otbr-agent!' elif have service; then @@ -55,7 +58,9 @@ startup() sudo service dbus status || sudo service dbus start || die 'Failed to start dbus!' # Tolerate the mdns failure as it is installed for only CI docker. sudo service mdns status || sudo service mdns start || echo "service mdns is not available!" - sudo service avahi-daemon status || sudo service avahi-daemon start || die 'Failed to start avahi!' + if [[ ${OTBR_MDNS} == "avahi" ]];then + sudo service avahi-daemon status || sudo service avahi-daemon start || die 'Failed to start avahi!' + fi sudo service otbr-agent status || sudo service otbr-agent start || die 'Failed to start otbr-agent!' without WEB_GUI || sudo service otbr-web status || sudo service otbr-web start || die 'Failed to start otbr-web!' else @@ -73,14 +78,18 @@ shutdown() if have systemctl; then systemctl is-active rsyslog && sudo systemctl stop rsyslog || echo 'Failed to stop rsyslog!' systemctl is-active dbus && sudo systemctl stop dbus || echo 'Failed to stop dbus!' - systemctl is-active avahi-daemon && sudo systemctl stop avahi-daemon || echo 'Failed to stop avahi!' + if [[ ${OTBR_MDNS} == "avahi" ]];then + systemctl is-active avahi-daemon && sudo systemctl stop avahi-daemon || echo 'Failed to stop avahi!' + fi without WEB_GUI || systemctl is-active otbr-web && sudo systemctl stop otbr-web || echo 'Failed to stop otbr-web!' systemctl is-active otbr-agent && sudo systemctl stop otbr-agent || echo 'Failed to stop otbr-agent!' elif have service; then sudo service rsyslog status && sudo service rsyslog stop || echo 'Failed to stop rsyslog!' sudo service dbus status && sudo service dbus stop || echo 'Failed to stop dbus!' sudo service mdns status && sudo service mdns stop || echo "service mdns is not available!" - sudo service avahi-daemon status && sudo service avahi-daemon stop || echo 'Failed to stop avahi!' + if [[ ${OTBR_MDNS} =="avahi" ]];then + sudo service avahi-daemon status && sudo service avahi-daemon stop || echo 'Failed to stop avahi!' + fi sudo service otbr-agent status && sudo service otbr-agent stop || echo 'Failed to stop otbr-agent!' without WEB_GUI || sudo service otbr-web status && sudo service otbr-web stop || echo 'Failed to stop otbr-web!' else