test: check for binariers in [usr/][s]bin

The image build function greps for ExecStart lines in unit files, but some
of them (eg: systemd-firstboot) do not use a full path.
It then falls back to 'type -P' but that only works if you have the binary
installed. For optional binaries like systemd-firstboot, the installation
can then fail.

Manually check if the binary already exists in /[usr/][s]bin.
This commit is contained in:
Luca Boccassi 2020-12-22 17:50:34 +00:00
parent 53a1c94480
commit 0515e4c17d
1 changed files with 1 additions and 1 deletions

View File

@ -1575,7 +1575,7 @@ inst_binary() {
# In such cases, let's check if the binary indeed exists in the image
# before doing any other chcecks. If it does, immediately return with
# success.
[[ $# -eq 1 && -e $initdir/$1 ]] && return 0
[[ $# -eq 1 && -e $initdir/$1 || -e $initdir/bin/$1 || -e $initdir/sbin/$1 || -e $initdir/usr/bin/$1 || -e $initdir/usr/sbin/$1 ]] && return 0
_bin=$(find_binary "$1") || return 1
_target=${2:-$_bin}