#!/bin/bash # # Copyright (c) 2017, The OpenThread Authors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the copyright holder nor the # names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # Description: # This script resolves all dependencies. # # shellcheck source=script/_initrc . "$(dirname "$0")"/_initrc NAT64_SERVICE="${NAT64_SERVICE:-openthread}" FIREWALL="${FIREWALL:-1}" OTBR_MDNS="${OTBR_MDNS:-mDNSResponder}" OT_BACKBONE_CI="${OT_BACKBONE_CI:-0}" REFERENCE_DEVICE="${REFERENCE_DEVICE:-0}" install_packages_apt() { sudo apt-get update sudo apt-get install --no-install-recommends -y \ wget \ iproute2 \ iputils-ping \ libreadline-dev \ libncurses-dev sudo apt-get install --no-install-recommends -y build-essential ninja-build cmake sudo apt-get install --no-install-recommends -y rsyslog # For DBus server sudo apt-get install --no-install-recommends -y dbus libdbus-1-dev # mDNS sudo apt-get install --no-install-recommends -y libavahi-client3 libavahi-common-dev libavahi-client-dev # Thread Certification tests require Avahi to publish records for tests. Since the # same image is used for all tests this needs to be installed here. Additionally # Avahi should be included for reference device builds. if [[ ${OTBR_MDNS} == "avahi" || ${OT_BACKBONE_CI} == 1 || ${REFERENCE_DEVICE} == 1 ]]; then sudo apt-get install --no-install-recommends -y avahi-daemon # Increase the object number limit to rid of 'Too many objects' error sudo sed -i 's/^#objects-per-client-max=[0-9]\+/objects-per-client-max=30000/' /etc/avahi/avahi-daemon.conf fi (MDNS_RESPONDER_SOURCE_NAME=mDNSResponder-1790.80.10 \ && MDNS_RESPONDER_PATCH_PATH=$(realpath "$(dirname "$0")"/../third_party/mDNSResponder) \ && cd /tmp \ && wget --no-check-certificate https://github.com/apple-oss-distributions/mDNSResponder/archive/refs/tags/$MDNS_RESPONDER_SOURCE_NAME.tar.gz \ && mkdir -p $MDNS_RESPONDER_SOURCE_NAME \ && tar xvf $MDNS_RESPONDER_SOURCE_NAME.tar.gz -C $MDNS_RESPONDER_SOURCE_NAME --strip-components=1 \ && cd /tmp/"$MDNS_RESPONDER_SOURCE_NAME" \ && ( for patch in "$MDNS_RESPONDER_PATCH_PATH"/*.patch; do patch -p1 <"$patch" done ) \ && cd mDNSPosix \ && make os=linux tls=no && sudo make install os=linux tls=no) # nat64 without NAT64 || { [ "$NAT64_SERVICE" != "tayga" ] || sudo apt-get install --no-install-recommends -y tayga sudo apt-get install --no-install-recommends -y iptables } # dns64 without DNS64 || { if [ "$PLATFORM" = "beagleboneblack" ]; then # dnsmasq needs to be stopped before bind9 is installed sudo systemctl disable dnsmasq sudo systemctl stop dnsmasq fi sudo apt-get install --no-install-recommends -y bind9 # Resolvconf cannot be installed inside docker environment if without DOCKER; then sudo apt-get install --no-install-recommends -y resolvconf fi } # dhcpv6-pd without DHCPV6_PD_REF || { sudo apt-get install --no-install-recommends -y dhcpcd sudo mkdir -p /etc/systemd/system/dhcpcd.service.d # allow edit system config file eg. /etc/radvd.conf sudo tee /etc/systemd/system/dhcpcd.service.d/custom.conf >/dev/null <