forked from mirrors/nixpkgs
Merge pull request #12804
Currently the check against FHS paths in the rule files is only checking against the original paths from in services.udev.packages. However we do fix up some of these paths in the udev rules generator and the warning is against the unfixed rule files and therefore prints a lot of false positives. This pull request not only improves this warning but also makes the rules generator fail if there are FHS still left in one of the rules file. Addresses #12722 as well so we can assure that this won't happen again in the future.
This commit is contained in:
commit
9807acb3ee
|
@ -94,10 +94,30 @@ let
|
|||
done
|
||||
echo "OK"
|
||||
|
||||
echo "Consider fixing the following udev rules:"
|
||||
for i in ${toString cfg.packages}; do
|
||||
grep -l '\(RUN+\|IMPORT{program}\)="\(/usr\)\?/s\?bin' $i/*/udev/rules.d/* || true
|
||||
done
|
||||
filesToFixup="$(for i in "$out"/*; do
|
||||
grep -l '\B\(/usr\)\?/s\?bin' "$i" || :
|
||||
done)"
|
||||
|
||||
if [ -n "$filesToFixup" ]; then
|
||||
echo "Consider fixing the following udev rules:"
|
||||
echo "$filesToFixup" | while read localFile; do
|
||||
remoteFile="origin unknown"
|
||||
for i in ${toString cfg.packages}; do
|
||||
for j in "$i"/*/udev/rules.d/*; do
|
||||
if [ -e "$out/$(basename "$j")" ]; then
|
||||
remoteFile="originally from $j"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
refs="$(
|
||||
grep -o '\B\(/usr\)\?/s\?bin/[^ "]\+' "$localFile" \
|
||||
| sed -e ':r;N;''${s/\n/ and /;br};s/\n/, /g;br'
|
||||
)"
|
||||
echo "$localFile ($remoteFile) contains references to $refs."
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
${optionalString config.networking.usePredictableInterfaceNames ''
|
||||
cp ${./80-net-setup-link.rules} $out/80-net-setup-link.rules
|
||||
|
|
Loading…
Reference in a new issue