i-t: rewrite hooks

This produces a leaner image, doesn't fail if zdb doesn't exist,
properly handles hostnameless systems, doesn't mention crypto modules
for no reason, doesn't add useless empty executable in hopes an
eight-year-old PR is merged, uses i-t builtins for all copies

Also optimize the checkbashisms filter to spawn one (or a few) awks
instead of one per regular file and remove initramfs/hooks therefrom due
to a command -v false positive

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12017
This commit is contained in:
наб
2021-05-14 06:47:53 +02:00
committed by Brian Behlendorf
parent 019739b6e9
commit d53a6969c1
3 changed files with 40 additions and 106 deletions
+2 -1
View File
@@ -159,9 +159,10 @@ checkbashisms:
-o -name 'paxcheck.sh' -prune \
-o -name 'make_gitrev.sh' -prune \
-o -name '90zfs' -prune \
-o -path '*initramfs/hooks' -prune \
-o -type f ! -name 'config*' \
! -name 'libtool' \
-exec sh -c 'awk "NR==1 && /#!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
-exec awk 'FNR==1 && /^#!.*bin\/sh/ {print FILENAME}' {} \+); \
else \
echo "skipping checkbashisms because checkbashisms is not installed"; \
fi