Exit non-zero on error / how to detect failure?
Scott Moser <[email protected]> Thu, 24 Feb 2022 12:57:35 -0500
| Newsgroups | org.kernel.vger.initramfs |
|---|---|
| Message-ID | <CAKxE60w22VmhWMrfN2y=MTEH+EniWn02R6a3+ynE6vPK5GjyBA@mail.gmail.com> |
I recently built a initramfs with dracut in debian (051-1), but
it seems this is still a problem on mainline.
I have a config in /etc/dracut/dracut.conf.d that said:
install_items+="/etc/usermode-helper.conf usermode-helper"
An error elsewhere meant that those items were missing from the filesystem.
dracut exited 0 with emitted messages like:
dracut-install: ERROR: installing '/etc/usermode-helper.conf'
dracut-install: ERROR: installing 'usermode-helper'
dracut: FAILED: /usr/lib/dracut/dracut-install -D <dir> \
-a -l /etc/usermode-helper.conf usermode-helper
In my usage, this is a FATAL error, and failure to catch it here meant lost
time down the road. I "solved" it by capturing output and grepping
for "ERROR:" or "FAILED:", but that is less than desirable.
Is there a way to tell dracut to exit non-zero on errors like this?
Scott