Commit f9e60b5b authored by Guido Gunther's avatar Guido Gunther
Browse files

root.sh: Check for parameters

This makes shellcheck more happy and the code more robust towards
changes.
parent 6c7e6532
......@@ -5,6 +5,20 @@
# SPDX-License-Identifier: GPL-3.0+
#
# Parmeters passed in via image builder:
# Mandatory
: "${apt_sources:?'apt_sources' not set}"
: "${distro:?'distro' not set}"
: "${packages:?'packages' not set}"
: "${pureos_board:?'pureos_board' not set}"
# Optional
: "${build_tarball:-}"
: "${ci_pkgs:-}"
: "${fdt_file:-}"
: "${kernel_deb:-}"
: "${patched:-}"
: "${qemu:-}"
# distro and basedir set by calling script
basedir="$1"
......@@ -201,8 +215,11 @@ function setup_locale()
function install_pkgs()
{
chroot "${basedir}" apt-get -y update
# Need to split package list
# shellcheck disable=SC2086
if ! chroot "${basedir}" apt -y install ${packages}; then
echo "Package installation failed, this might help to diagnose the problem:"
# shellcheck disable=SC2086
chroot "${basedir}" apt -y -o Debug::pkgProblemResolver=yes install -y --simulate ${packages}
fi
}
......@@ -210,6 +227,7 @@ function install_pkgs()
function setup_apt()
{
# shellcheck disable=SC2001
echo "${apt_sources}" | sed 's/|/\n/g' > "${basedir}/etc/apt/sources.list"
echo "Set sources list to:"
cat "${basedir}/etc/apt/sources.list"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment