So someone would use this by then doing something like:
if flash-kernel --supported; then
pkgs=$(flash-kernel --get-machine-required-packages) || fail "failed getting required packages"
apt-get install -qy $pkgs
fi
right ? I'm not sure that the 'check_supported' usage in your addition helps at all, because the user of this somehow has to determine the difference between failure due to "not supported" or other failure. So they end up having to do the above, right?
One thing i might suggest is just changing it to be more generic and allow getting of any field.
if [ "$1" = "--get-machine-field" ]; then
get_machine_field "$machine" "$2"
exit
fi
So someone would use this by then doing something like:
if flash-kernel --supported; then $(flash- kernel --get-machine- required- packages) || fail "failed getting required packages"
pkgs=
apt-get install -qy $pkgs
fi
right ? I'm not sure that the 'check_supported' usage in your addition helps at all, because the user of this somehow has to determine the difference between failure due to "not supported" or other failure. So they end up having to do the above, right?
One thing i might suggest is just changing it to be more generic and allow getting of any field.
if [ "$1" = "--get- machine- field" ]; then machine_ field "$machine" "$2"
get_
exit
fi