forked from mirrors/nixpkgs
Merge with udev-173
The only conflict was the addition of two different options at the same place. svn path=/nixos/trunk/; revision=28801
This commit is contained in:
parent
1aa1c86afc
commit
e5917ea6fc
|
@ -34,9 +34,6 @@ let
|
|||
ensureDir $out
|
||||
shopt -s nullglob
|
||||
|
||||
# Use all the default udev rules.
|
||||
cp -v ${udev}/libexec/rules.d/*.rules $out/
|
||||
|
||||
# Set a reasonable $PATH for programs called by udev rules.
|
||||
echo 'ENV{PATH}="${udevPath}/bin:${udevPath}/sbin"' > $out/00-path.rules
|
||||
|
||||
|
@ -48,19 +45,19 @@ let
|
|||
for i in ${toString cfg.packages}; do
|
||||
echo "Adding rules for package $i"
|
||||
for j in $i/*/udev/rules.d/*; do
|
||||
ln -sv $j $out/$(basename $j)
|
||||
echo "Copying $j to $out/$(basename $j)"
|
||||
echo "# Copied from $j" > $out/$(basename $j)
|
||||
cat $j >> $out/$(basename $j)
|
||||
done
|
||||
done
|
||||
|
||||
# Fix some paths in the standard udev rules. Hacky.
|
||||
for i in $out/*.rules; do
|
||||
substituteInPlace $i \
|
||||
--replace /sbin/modprobe ${modprobe}/sbin/modprobe \
|
||||
--replace /sbin/blkid ${pkgs.utillinux}/sbin/blkid \
|
||||
--replace /sbin/mdadm ${pkgs.mdadm}/sbin/mdadm \
|
||||
--replace '$env{DM_SBIN_PATH}/blkid' ${pkgs.utillinux}/sbin/blkid \
|
||||
--replace 'ENV{DM_SBIN_PATH}="/sbin"' 'ENV{DM_SBIN_PATH}="${pkgs.lvm2}/sbin"' \
|
||||
--replace /bin/mount ${pkgs.utillinux}/bin/mount
|
||||
--replace \"/sbin/modprobe \"${modprobe}/sbin/modprobe \
|
||||
--replace \"/sbin/mdadm \"${pkgs.mdadm}/sbin/mdadm \
|
||||
--replace \"/sbin/blkid \"${pkgs.utillinux}/sbin/blkid \
|
||||
--replace \"/bin/mount \"${pkgs.utillinux}/bin/mount
|
||||
done
|
||||
|
||||
# If auto-configuration is disabled, then remove
|
||||
|
@ -68,6 +65,39 @@ let
|
|||
# automatically calling modprobe.
|
||||
${if !config.boot.hardwareScan then "rm $out/80-drivers.rules" else ""}
|
||||
|
||||
echo -n "Checking that all programs called by relative paths in udev rules exist in ${udev}/lib/udev ... "
|
||||
import_progs=$(grep 'IMPORT{program}="[^/$]' $out/* |
|
||||
sed -e 's/.*IMPORT{program}="\([^ "]*\)[ "].*/\1/' | uniq)
|
||||
run_progs=$(grep 'RUN+="[^/$]' $out/* |
|
||||
sed -e 's/.*RUN+="\([^ "]*\)[ "].*/\1/' | uniq)
|
||||
for i in $import_progs $run_progs; do
|
||||
if [[ ! -x ${pkgs.udev}/lib/udev/$i ]]; then
|
||||
echo "FAIL"
|
||||
echo "$i is called in udev rules but not installed by udev"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "OK"
|
||||
|
||||
echo -n "Checking that all programs call by absolute paths in udev rules exist ... "
|
||||
import_progs=$(grep 'IMPORT{program}="/' $out/* |
|
||||
sed -e 's/.*IMPORT{program}="\([^ "]*\)[ "].*/\1/' | uniq)
|
||||
run_progs=$(grep 'RUN+="/' $out/* |
|
||||
sed -e 's/.*RUN+="\([^ "]*\)[ "].*/\1/' | uniq)
|
||||
for i in $import_progs $run_progs; do
|
||||
if [[ ! -x $i ]]; then
|
||||
echo "FAIL"
|
||||
echo "$i is called in udev rules but not installed by udev"
|
||||
exit 1
|
||||
fi
|
||||
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
|
||||
|
||||
# Use the persistent device rules (naming for CD/DVD and
|
||||
# network devices) stored in
|
||||
# /var/lib/udev/rules.d/70-persistent-{cd,net}.rules. These are
|
||||
|
@ -178,7 +208,7 @@ in
|
|||
|
||||
services.udev.extraRules = nixosRules;
|
||||
|
||||
services.udev.packages = [ extraUdevRules ];
|
||||
services.udev.packages = [ pkgs.udev extraUdevRules ];
|
||||
|
||||
services.udev.path = [ pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.utillinux pkgs.udev ];
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ with pkgs.lib;
|
|||
mkdir -m 0755 -p /var/lib/udisks
|
||||
'';
|
||||
|
||||
services.udev.packages = [ pkgs.udisks ];
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ with pkgs.lib;
|
|||
|
||||
services.dbus.packages = [ pkgs.upower ];
|
||||
|
||||
services.udev.packages = [ pkgs.upower ];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ let
|
|||
buildCommand = ''
|
||||
ensureDir $out
|
||||
|
||||
cp ${dbus}/etc/dbus-1/system.conf $out/system.conf
|
||||
cp -v ${dbus}/etc/dbus-1/system.conf $out/system.conf
|
||||
|
||||
# !!! Hm, these `sed' calls are rather error-prone...
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ let
|
|||
default = "";
|
||||
example = "0:0";
|
||||
description = "
|
||||
Device for manual resume attempt during boot. Looks like
|
||||
Device for manual resume attempt during boot. Looks like
|
||||
major:minor. ls -l /dev/SWAP_PARTION shows them.
|
||||
";
|
||||
};
|
||||
|
@ -74,7 +74,7 @@ let
|
|||
";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -107,7 +107,7 @@ let
|
|||
''
|
||||
ensureDir $out/bin
|
||||
ensureDir $out/lib
|
||||
|
||||
|
||||
# Copy what we need from Glibc.
|
||||
cp -pv ${pkgs.glibc}/lib/ld*.so.? $out/lib
|
||||
cp -pv ${pkgs.glibc}/lib/libc.so.* $out/lib
|
||||
|
@ -133,7 +133,7 @@ let
|
|||
cp -v ${pkgs.coreutils}/bin/sleep $out/bin
|
||||
cp -v ${pkgs.coreutils}/bin/ln $out/bin
|
||||
|
||||
# Copy e2fsck and friends.
|
||||
# Copy e2fsck and friends.
|
||||
cp -v ${pkgs.e2fsprogs}/sbin/e2fsck $out/bin
|
||||
cp -v ${pkgs.e2fsprogs}/sbin/tune2fs $out/bin
|
||||
cp -v ${pkgs.reiserfsprogs}/sbin/reiserfsck $out/bin
|
||||
|
@ -154,9 +154,9 @@ let
|
|||
|
||||
# Copy udev.
|
||||
cp -v ${pkgs.udev}/sbin/udevd ${pkgs.udev}/sbin/udevadm $out/bin
|
||||
cp -v ${pkgs.udev}/libexec/*_id $out/bin
|
||||
cp -v ${pkgs.udev}/lib/udev/*_id $out/bin
|
||||
cp -pdv ${pkgs.udev}/lib/libudev.so.* $out/lib
|
||||
|
||||
|
||||
# Copy bash.
|
||||
cp -v ${pkgs.bash}/bin/bash $out/bin
|
||||
ln -sv bash $out/bin/sh
|
||||
|
@ -191,7 +191,7 @@ let
|
|||
exec $out/bin/modprobe.real "\$@"
|
||||
EOF
|
||||
chmod u+x $out/bin/modprobe
|
||||
|
||||
|
||||
# Make sure that the patchelf'ed binaries still work.
|
||||
echo "testing patched programs..."
|
||||
$out/bin/bash --version | grep "bash, version"
|
||||
|
@ -209,7 +209,7 @@ let
|
|||
$out/bin/basename --version
|
||||
$out/bin/modprobe --version
|
||||
''; # */
|
||||
|
||||
|
||||
|
||||
# The initrd only has to mount / or any FS marked as necessary for
|
||||
# booting (such as the FS containing /nix/store, or an FS needed for
|
||||
|
@ -225,12 +225,12 @@ let
|
|||
ensureDir $out
|
||||
|
||||
echo 'ENV{LD_LIBRARY_PATH}="${extraUtils}/lib"' > $out/00-env.rules
|
||||
|
||||
cp ${pkgs.udev}/libexec/rules.d/60-cdrom_id.rules $out/
|
||||
cp ${pkgs.udev}/libexec/rules.d/60-persistent-storage.rules $out/
|
||||
cp ${pkgs.udev}/libexec/rules.d/80-drivers.rules $out/
|
||||
cp ${pkgs.lvm2}/lib/udev/rules.d/*.rules $out/
|
||||
cp ${pkgs.mdadm}/lib/udev/rules.d/*.rules $out/
|
||||
|
||||
cp -v ${pkgs.udev}/lib/udev/rules.d/60-cdrom_id.rules $out/
|
||||
cp -v ${pkgs.udev}/lib/udev/rules.d/60-persistent-storage.rules $out/
|
||||
cp -v ${pkgs.udev}/lib/udev/rules.d/80-drivers.rules $out/
|
||||
cp -v ${pkgs.lvm2}/lib/udev/rules.d/*.rules $out/
|
||||
cp -v ${pkgs.mdadm}/lib/udev/rules.d/*.rules $out/
|
||||
|
||||
for i in $out/*.rules; do
|
||||
substituteInPlace $i \
|
||||
|
@ -243,10 +243,9 @@ let
|
|||
--replace /sbin/blkid ${extraUtils}/bin/blkid \
|
||||
--replace /sbin/modprobe ${extraUtils}/bin/modprobe \
|
||||
--replace '$env{DM_SBIN_PATH}/blkid' ${extraUtils}/bin/blkid \
|
||||
--replace 'ENV{DM_SBIN_PATH}="/sbin"' 'ENV{DM_SBIN_PATH}="${extraUtils}/bin"' \
|
||||
--replace 'ENV{DM_SBIN_PATH}="${pkgs.lvm2}/sbin"' 'ENV{DM_SBIN_PATH}="${extraUtils}/bin"' \
|
||||
--replace /sbin/mdadm ${extraUtils}/bin/mdadm
|
||||
done
|
||||
|
||||
# !!! Remove this after merging the x-updates branch:
|
||||
|
||||
# Work around a bug in QEMU, which doesn't implement the "READ
|
||||
|
@ -264,13 +263,13 @@ let
|
|||
''; # */
|
||||
};
|
||||
|
||||
|
||||
|
||||
# The udev configuration file for in the initrd.
|
||||
udevConf = pkgs.writeText "udev-initrd.conf" ''
|
||||
udev_rules="${udevRules}"
|
||||
#udev_log="debug"
|
||||
'';
|
||||
|
||||
|
||||
|
||||
# The init script of boot stage 1 (loading kernel modules for
|
||||
# mounting the root FS).
|
||||
|
@ -319,7 +318,7 @@ let
|
|||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
in {
|
||||
|
||||
require = [options];
|
||||
|
|
Loading…
Reference in a new issue