1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-27 16:11:58 +00:00

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:
aszlig 2016-02-03 17:13:50 +01:00
commit 9807acb3ee
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961

View file

@ -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