update: make sure mp-build checks build-essential as a depend

This commit is contained in:
ngn 2024-08-19 00:50:31 +03:00
parent bcda53b383
commit bfd7db3136
3 changed files with 41 additions and 21 deletions

View File

@ -8,7 +8,6 @@ Following dependencies are required for these scripts and tools:
- bash
- coreutils
- gcc
- make
- GRUB (please see matter-iso warning)
- gnupg

View File

@ -78,8 +78,8 @@ check_iso_vars() {
if ! type "grub-mkrescue" > /dev/null; then
error "You need to install GRUB to create ISO files with grub-mkrescue"
set_indent
info "If you want to create UEFI ISO files make sure you install x64 GRUB or grub-efi"
info "If you want to create BIOS ISO files make sure you install x86 GRUB or grub-bios"
warn "If you want to create UEFI ISO files make sure you install x64 GRUB or grub-efi"
warn "If you want to create BIOS ISO files make sure you install x86 GRUB or grub-bios"
exit 1
fi

View File

@ -105,26 +105,32 @@ clean_dist() {
rm -f "${distpath}/files.tar.gz"
}
# checks/installs a list of depends
check_depends() {
local list=("$@")
if [ "${#list[@]}" == "0" ]; then
info "Got zero depends, skipping depend check"
return 0
fi
# install a list of packages with matt
matt_install(){
if [ "$EUID" -ne 0 ]; then
if type doas > /dev/null; then
DOAS="doas"
elif type sudo > /dev/null; then
DOAS="sudo"
else
error "Failed to find doas or sudo, skipping depend check"
return 0
error "Failed to find doas or sudo, cannot run the install command"
return 1
fi
fi
$DOAS matt install --yes --skip --ignore-none $@
return $?
}
# checks and installs a list of depends
check_depends() {
local list=("$@")
if [ "${#list[@]}" == "0" ]; then
info "Got zero depends, skipping depend check"
return 0
fi
for dep in "${list[@]}"; do
if [ -z "${depends_str}" ]; then
depends_str="${dep}"
@ -133,12 +139,12 @@ check_depends() {
fi
done
depends_uniq=$(echo "${depends_str}" | tr ' ' '\n' | sort | uniq)
depends_count=$(echo "${depends_uniq}" | wc -l)
depends_uniq=$(echo "${depends_uniq}" | tr '\n' ' ')
depends_uniq="$(echo "${depends_str}" | tr ' ' '\n' | sort | uniq)"
depends_count="$(echo "${depends_uniq}" | wc -l)"
depends_uniq="$(echo "${depends_uniq}" | tr '\n' ' ')"
info "Installing ${depends_count} depends"
$DOAS matt install --yes --skip --ignore-none $depends_uniq
matt_install $depends_uniq
return $?
}
@ -202,10 +208,12 @@ if [ ! -d "${TARGET}" ]; then
fi
if [ $OPT_NO_DEPEND -eq 0 ] && ! command -v matt &> /dev/null; then
error "!!! BUILD ON MATTERLINUX !!!"
error "matt is not installed, please build on a MatterLinux system"
error "Do NOT create bug reports if build fails on non-MatterLinux systems"
error "BUILD ON MATTERLINUX!"
set_indent
warn "matt is not installed, please build on a MatterLinux system"
warn "Do NOT create bug reports if build fails on non-MatterLinux systems"
info "Auto enabling NO_DEPEND as depend check will fail without matt"
unset_indent
OPT_NO_DEPEND=1
fi
@ -277,8 +285,21 @@ all_depends+=("${DEPENDS[@]}")
all_depends+=("${BUILD[@]}")
if [ $OPT_NO_DEPEND -eq 0 ]; then
info "Checking all the dependencies"
set_indent
is_essential_installed="$(matt info build-essential --grep | grep INSTALLED)"
is_essential_installed="$(echo "${is_essential_installed}" | cut -d: -f2)"
if [ "${is_essential_installed}" == "0" ]; then
info "Installing build-essential (required for every build)"
matt_install build-essential
check_ret "Failed to install build-essential package"
fi
check_depends "${all_depends[@]}"
check_ret "Failed to check all the dependencies"
unset_indent
fi
# make sure file count and the hash count is the same