Merge pull request from abbradar/modprobe-fix

modprobe: wrap all of kmod
This commit is contained in:
Domen Kožar 2015-01-24 07:11:16 +01:00
commit cb7cd012df
1 changed files with 11 additions and 4 deletions
nixos/modules/system/boot

View File

@ -10,10 +10,18 @@ with lib;
system.sbin.modprobe = mkOption { system.sbin.modprobe = mkOption {
internal = true; internal = true;
default = pkgs.writeTextFile { default = pkgs.stdenv.mkDerivation {
name = "modprobe"; name = "modprobe";
destination = "/sbin/modprobe"; buildCommand = ''
executable = true; mkdir -p $out/bin
for i in ${pkgs.kmod}/sbin/*; do
name=$(basename $i)
echo "$text" > $out/bin/$name
echo 'exec '$i' "$@"' >> $out/bin/$name
chmod +x $out/bin/$name
done
ln -s bin $out/sbin
'';
text = text =
'' ''
#! ${pkgs.stdenv.shell} #! ${pkgs.stdenv.shell}
@ -26,7 +34,6 @@ with lib;
MODULE_DIR=/run/booted-system/kernel-modules/lib/modules/ MODULE_DIR=/run/booted-system/kernel-modules/lib/modules/
fi fi
exec ${pkgs.kmod}/sbin/modprobe "$@"
''; '';
}; };
description = '' description = ''