Conversation
utils/ixbin
Outdated
| ensuredeps() | ||
| { | ||
| DEPS="fakeroot mksquashfs unsquashfs awk env mkimage truncate dtc fdtget rauc" | ||
| which -s $DEPS && return 0 |
There was a problem hiding this comment.
I get error about -s flag for which on Ubuntu 22.
Illegal option -s
Usage: /usr/bin/which [-a] args
Maybe something about the version for which changing between Ubuntu 22 and Ubuntu 24...?
which is mostly just an alias for type with some flags on some distros. I would probably use type here for better portability.
There was a problem hiding this comment.
Good catch! Here's another alternative I often use myself, example from another (POSIX shell compliant) script:
error()
{
printf "\033[1;31mError: %s\033[0m\n" "$*" >&2
}
fatal()
{
error "$*"
exit 1
}
# Check for required programs
for proggy in $DEPS; do
if ! command -v $proggy >/dev/null 2>&1; then
fatal "$proggy not found, required."
fi
doneThere was a problem hiding this comment.
TIL: which is not in POSIX.
The shame, the absolute SHAME! 😆
Updated the script to use command -v instead.
@abbenteprizer is it working as expected otherwise?
There was a problem hiding this comment.
The horror! Yes nice, great! Yes, the script seems to work. Just want to verify that it works as expected when on real hardware before +1.
Description
Checklist
Tick relevant boxes, this PR is-a or has-a: