-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy path1.2-install-additional-dependencies.sh
More file actions
executable file
·56 lines (45 loc) · 2.14 KB
/
1.2-install-additional-dependencies.sh
File metadata and controls
executable file
·56 lines (45 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /usr/bin/env bash
#
# Copyright (c) 2025 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
ROOT_DIR=$(realpath $(dirname "$0")/../..)
SCRIPT_DIR="$ROOT_DIR/scripts"
UBUNTU_SCRIPT_DIR="$SCRIPT_DIR/ubuntu"
source "$SCRIPT_DIR/utils.sh"
print_start_of_script
print_script_step "Install additional dependencies"
# Ensure <codename>-updates is present in apt sources.
# On minimal Ubuntu images (e.g. Raspberry Pi), the sources file may only contain
# <codename> and <codename>-security. Security point releases update runtime libraries
# (libmount1, zlib1g, libpcre2-8-0, etc.) to patch versions (e.g. -9ubuntu6.4), but the
# matching -dev packages that accept those versions only exist in <codename>-updates.
# Without this repo, apt-get satisfy fails with "held broken packages" when resolving
# transitive -dev dependencies for libgstreamer1.0-dev.
print_script_step "Ensuring <codename>-updates apt repository is configured"
UBUNTU_CODENAME=$(lsb_release -cs)
SOURCES_FILE="/etc/apt/sources.list.d/ubuntu.sources"
if [ -f "$SOURCES_FILE" ] && grep -q "^Suites:" "$SOURCES_FILE"; then
if ! grep -q "${UBUNTU_CODENAME}-updates" "$SOURCES_FILE"; then
sudo sed -i -E "/^Suites:.*\b${UBUNTU_CODENAME}\b([^-]|$)/ s/$/ ${UBUNTU_CODENAME}-updates/" "$SOURCES_FILE"
fi
fi
sudo DEBIAN_FRONTEND=noninteractive apt-get update
readarray -t packagelist < "$UBUNTU_SCRIPT_DIR/additional-dependency-list.txt"
for package in "${packagelist[@]}"; do
[ -z "$package" ] && continue
print_script_step "Installing additional package: $package"
sudo DEBIAN_FRONTEND=noninteractive apt-get satisfy "$package" -y --allow-downgrades
done
print_end_of_script