svn path=/nixpkgs/branches/kmod-lib-modules/; revision=33623
This commit is contained in:
Yury G. Kudryashov 2012-04-05 14:50:31 +00:00
parent 0fe84d6eed
commit 0bb35d5d4f
3 changed files with 44 additions and 99 deletions

View File

@ -1,23 +1,23 @@
{ stdenv, fetchurl, gperf, pkgconfig, glib, acl
, libusb, usbutils, pciutils }:
, libusb, usbutils, pciutils, libuuid, kmod }:
assert stdenv ? glibc;
stdenv.mkDerivation rec {
name = "udev-173";
name = "udev-182";
src = fetchurl {
url = "mirror://kernel/linux/utils/kernel/hotplug/${name}.tar.bz2";
sha256 = "1bxadi4bi11v8ipzj22wknv8hsb0wgdb99bx3w9w33rgl4aq78bh";
sha256 = "143qvm0kij26j2l5icnch4x38fajys6li7j0c5mpwi6kqmc8hqx0";
};
buildInputs = [ gperf pkgconfig glib acl libusb usbutils ];
buildInputs = [ gperf pkgconfig glib acl libusb usbutils libuuid kmod ];
configureFlags =
''
--with-pci-ids-path=${pciutils}/share/pci.ids
--enable-udev_acl --enable-edd
--disable-introspection --libexecdir=$(out)/lib/udev
--enable-rule_generator
--disable-introspection --libexecdir=$(out)/lib
--with-firmware-path=/root/test-firmware:/var/run/current-system/firmware
'';
@ -45,10 +45,6 @@ stdenv.mkDerivation rec {
'';
patches = [ ./custom-rules.patch ] ++
[(fetchurl {
url = https://bugs.archlinux.org/task/25356?getfile=7281;
sha256 = "01xib1pfdbwacgx8dqxgrf67a0mwkpm4kxy9f9v3df93v0m4pmbm";
})] ++
stdenv.lib.optional (stdenv.system == "armv5tel-linux") ./pre-accept4-kernel.patch;
meta = {

View File

@ -1,91 +1,40 @@
commit c49ec33ba0f1a7f11b188913bb4895360ced67f8
Author: Yury G. Kudryashov <urkud.urkud@gmail.com>
Date: Tue Aug 16 16:28:56 2011 +0400
Upstream considers presence of rules_dir=... in udev.conf as a very special case.
In particular, they disable /dev/.udev/*. Re-enable it.
diff --git a/udev/udev-rules.c b/udev/udev-rules.c
index 6bf2726..c1ae1f3 100644
--- a/udev/udev-rules.c
+++ b/udev/udev-rules.c
@@ -1812,6 +1812,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
struct udev_list file_list;
struct udev_list_entry *file_loop;
struct token end_token;
+ char runpathrules[UTIL_PATH_SIZE];
diff --git a/src/libudev.c b/src/libudev.c
index d954dae..d663160 100644
--- a/src/libudev.c
+++ b/src/libudev.c
@@ -229,7 +229,6 @@ UDEV_EXPORT struct udev *udev_new(void)
}
if (strcmp(key, "udev_rules") == 0) {
set_value(&udev->rules_path[0], val);
- udev->rules_path_count = 1;
continue;
}
}
@@ -259,18 +258,18 @@ UDEV_EXPORT struct udev *udev_new(void)
udev->rules_path[0] = strdup(PKGLIBEXECDIR "/rules.d");
if (!udev->rules_path[0])
goto err;
+ }
rules = calloc(1, sizeof(struct udev_rules));
if (rules == NULL)
@@ -1854,22 +1855,21 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
rules->trie_nodes_cur = 1;
- /* /run/udev -- runtime rules */
- if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0)
- goto err;
+ /* /run/udev -- runtime rules */
+ if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0)
+ goto err;
if (udev_get_rules_path(udev) == NULL) {
- char filename[UTIL_PATH_SIZE];
- /* /etc/udev -- local administration rules */
- udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d");
- if (!udev->rules_path[1])
- goto err;
+ /* /etc/udev -- local administration rules */
+ udev->rules_path[1] = strdup("/etc/udev/rules.d");
+ if (!udev->rules_path[1])
+ goto err;
/* /lib/udev -- default/package rules */
add_matching_files(udev, &file_list, LIBEXECDIR "/rules.d", ".rules");
- udev->rules_path_count = 3;
- }
+ udev->rules_path_count = 3;
/* /etc/udev -- system-specific/user/admin rules */
add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules");
-
- /* /run/udev -- throw-away/temporary rules */
- util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL);
- add_matching_files(udev, &file_list, filename, ".rules");
} else {
/* custom rules files location for testing */
add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules");
}
+ /* /run/udev -- throw-away/temporary rules */
+ util_strscpyl(runpathrules, sizeof(runpathrules), udev_get_run_path(udev), "/rules.d", NULL);
+ add_matching_files(udev, &file_list, runpathrules, ".rules");
+
/* add all filenames to the string buffer */
udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) {
const char *filename = udev_list_entry_get_value(file_loop);
diff --git a/udev/udevd.c b/udev/udevd.c
index f1a31e7..45d10b6 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -1198,6 +1198,8 @@ int main(int argc, char *argv[])
struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker;
struct udev_ctrl_connection *ctrl_conn = NULL;
int rc = 1;
+ char filename[UTIL_PATH_SIZE];
+ struct stat statbuf;
udev = udev_new();
if (udev == NULL)
@@ -1480,23 +1482,21 @@ int main(int argc, char *argv[])
inotify_add_watch(fd_inotify, udev_get_rules_path(udev),
IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
} else {
- char filename[UTIL_PATH_SIZE];
- struct stat statbuf;
inotify_add_watch(fd_inotify, LIBEXECDIR "/rules.d",
IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
inotify_add_watch(fd_inotify, SYSCONFDIR "/udev/rules.d",
IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
+ }
- /* watch dynamic rules directory */
- util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL);
- if (stat(filename, &statbuf) != 0) {
- util_create_path(udev, filename);
- mkdir(filename, 0755);
- }
- inotify_add_watch(fd_inotify, filename,
- IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
+ /* watch dynamic rules directory */
+ util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL);
+ if (stat(filename, &statbuf) != 0) {
+ util_create_path(udev, filename);
+ mkdir(filename, 0755);
}
+ inotify_add_watch(fd_inotify, filename,
+ IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
udev_watch_restore(udev);
/* block and listen to all signals on signalfd */
dbg(udev, "context %p created\n", udev);
dbg(udev, "log_priority=%d\n", udev->log_priority);

View File

@ -5996,8 +5996,8 @@ let
};
udev145 = callPackage ../os-specific/linux/udev/145.nix { };
udev173 = callPackage ../os-specific/linux/udev/173.nix { };
udev = pkgs.udev173;
udev182 = callPackage ../os-specific/linux/udev/182.nix { };
udev = pkgs.udev182;
udisks = callPackage ../os-specific/linux/udisks { };