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 - bash
- coreutils - coreutils
- gcc
- make - make
- GRUB (please see matter-iso warning) - GRUB (please see matter-iso warning)
- gnupg - gnupg

View File

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

View File

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