Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

systemd-git: "adjustments" for udev merger

  • Loading branch information...
commit ab60feda20c3eadb49abe27a8df60d07bdc0d2cb 1 parent a0d0160
@falconindy authored
View
79 systemd-git/0001-udev-support-reading-from-split-usr-setup.patch
@@ -0,0 +1,79 @@
+From c1d144df648e469f703eda4da911e19ec54d6211 Mon Sep 17 00:00:00 2001
+From: Dave Reisner <dreisner@archlinux.org>
+Date: Wed, 4 Apr 2012 01:15:33 -0400
+Subject: [PATCH] udev: support reading from split usr setup
+
+---
+ src/udev/libudev.c | 27 +++++++++++++++++----------
+ 1 file changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/src/udev/libudev.c b/src/udev/libudev.c
+index dcba15d..5c3c375 100644
+--- a/src/udev/libudev.c
++++ b/src/udev/libudev.c
+@@ -43,8 +43,8 @@ struct udev {
+ void *userdata;
+ char *sys_path;
+ char *dev_path;
+- char *rules_path[4];
+- unsigned long long rules_path_ts[4];
++ char *rules_path[5];
++ unsigned long long rules_path_ts[5];
+ int rules_path_count;
+ char *run_path;
+ struct udev_list properties_list;
+@@ -255,21 +255,26 @@ UDEV_EXPORT struct udev *udev_new(void)
+ goto err;
+
+ if (udev->rules_path[0] == NULL) {
+- /* /usr/lib/udev -- system rules */
+- udev->rules_path[0] = strdup(UDEVLIBEXECDIR "/rules.d");
++ /* /lib/udev -- compat for system rules */
++ udev->rules_path[0] = strdup("/lib/udev/rules.d");
+ if (!udev->rules_path[0])
+ goto err;
+
+- /* /run/udev -- runtime rules */
+- if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0)
++ /* /usr/lib/udev -- system rules */
++ udev->rules_path[1] = strdup(UDEVLIBEXECDIR "/rules.d");
++ if (!udev->rules_path[1])
+ goto err;
+
+ /* /etc/udev -- local administration rules */
+- udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d");
+- if (!udev->rules_path[1])
++ udev->rules_path[2] = strdup(SYSCONFDIR "/udev/rules.d");
++ if (!udev->rules_path[2])
++ goto err;
++
++ /* /run/udev -- runtime rules */
++ if (asprintf(&udev->rules_path[4], "%s/rules.d", udev->run_path) < 0)
+ goto err;
+
+- udev->rules_path_count = 3;
++ udev->rules_path_count = 4;
+ }
+
+ dbg(udev, "context %p created\n", udev);
+@@ -278,7 +283,8 @@ UDEV_EXPORT struct udev *udev_new(void)
+ dbg(udev, "dev_path='%s'\n", udev->dev_path);
+ dbg(udev, "sys_path='%s'\n", udev->sys_path);
+ dbg(udev, "run_path='%s'\n", udev->run_path);
+- dbg(udev, "rules_path='%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1], udev->rules_path[2]);
++ dbg(udev, "rules_path='%s':'%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1],
++ udev->rules_path[2], udev->rules_path[3]);
+ free(config_file);
+ return udev;
+ err:
+@@ -325,6 +331,7 @@ UDEV_EXPORT void udev_unref(struct udev *udev)
+ free(udev->rules_path[0]);
+ free(udev->rules_path[1]);
+ free(udev->rules_path[2]);
++ free(udev->rules_path[3]);
+ free(udev->run_path);
+ dbg(udev, "context %p released\n", udev);
+ free(udev);
+--
+1.7.9.6
+
View
132 systemd-git/0002-reinstate-TIMEOUT-handling.patch
@@ -0,0 +1,132 @@
+From 0a581062ee3e31e0c2aedc5eb64c60f52868b17f Mon Sep 17 00:00:00 2001
+From: Tom Gundersen <teg@jklm.no>
+Date: Thu, 15 Mar 2012 02:12:43 +0100
+Subject: [PATCH 2/2] reinstate TIMEOUT= handling
+
+Without treating events with timeouts specially some drivers would cause a
+30 seconds stall on boot: .
+
+I also received reports of some drivers not working at all, even after the
+timeout.
+
+We will remove this patch when more drivers have been fixed in the kernel (3.4?).
+
+This reverts 43d5c5f03645c4b842659f9b5bd0ae465e885e92 and
+57c6f8ae5f52a6e8ffc66a54966346f733dded39.
+---
+ src/libudev-device.c | 19 +++++++++++++++++++
+ src/libudev-private.h | 1 +
+ src/udevd.c | 13 ++++++++++---
+ 4 files changed, 32 insertions(+), 3 deletions(-)
+
+diff --git a/src/libudev-device.c b/src/libudev-device.c
+index 10f28b8..639c367 100644
+--- a/src/udev/libudev-device.c
++++ b/src/udev/libudev-device.c
+@@ -68,6 +68,7 @@ struct udev_device {
+ struct udev_list tags_list;
+ unsigned long long int seqnum;
+ unsigned long long int usec_initialized;
++ int timeout;
+ int devlink_priority;
+ int refcount;
+ dev_t devnum;
+@@ -160,6 +161,21 @@ static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
+ return 0;
+ }
+
++int udev_device_get_timeout(struct udev_device *udev_device)
++{
++ return udev_device->timeout;
++}
++
++static int udev_device_set_timeout(struct udev_device *udev_device, int timeout)
++{
++ char num[32];
++
++ udev_device->timeout = timeout;
++ snprintf(num, sizeof(num), "%u", timeout);
++ udev_device_add_property(udev_device, "TIMEOUT", num);
++ return 0;
++}
++
+ const char *udev_device_get_devpath_old(struct udev_device *udev_device)
+ {
+ return udev_device->devpath_old;
+@@ -414,6 +430,8 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device,
+ udev_device_set_devpath_old(udev_device, &property[12]);
+ } else if (strncmp(property, "SEQNUM=", 7) == 0) {
+ udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10));
++ } else if (strncmp(property, "TIMEOUT=", 8) == 0) {
++ udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10));
+ } else if (strncmp(property, "IFINDEX=", 8) == 0) {
+ udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10));
+ } else if (strncmp(property, "DEVMODE=", 8) == 0) {
+@@ -599,6 +617,7 @@ struct udev_device *udev_device_new(struct udev *udev)
+ udev_list_init(udev, &udev_device->sysattr_value_list, true);
+ udev_list_init(udev, &udev_device->sysattr_list, false);
+ udev_list_init(udev, &udev_device->tags_list, true);
++ udev_device->timeout = -1;
+ udev_device->watch_handle = -1;
+ /* copy global properties */
+ udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev))
+diff --git a/src/libudev-private.h b/src/libudev-private.h
+index 5f5c64a..ec63b67 100644
+--- a/src/udev/libudev-private.h
++++ b/src/udev/libudev-private.h
+@@ -87,6 +87,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device);
+ void udev_device_set_is_initialized(struct udev_device *udev_device);
+ int udev_device_add_tag(struct udev_device *udev_device, const char *tag);
+ void udev_device_cleanup_tags_list(struct udev_device *udev_device);
++int udev_device_get_timeout(struct udev_device *udev_device);
+ unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device);
+ void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized);
+ int udev_device_get_devlink_priority(struct udev_device *udev_device);
+diff --git a/src/udevd.c b/src/udevd.c
+index 1702217..88e9272 100644
+--- a/src/udev/udevd.c
++++ b/src/udev/udevd.c
+@@ -401,7 +401,7 @@ out:
+ }
+ }
+
+-static void event_run(struct event *event)
++static void event_run(struct event *event, bool force)
+ {
+ struct udev_list_node *loop;
+
+@@ -427,7 +427,7 @@ static void event_run(struct event *event)
+ return;
+ }
+
+- if (children >= children_max) {
++ if (!force && children >= children_max) {
+ if (children_max > 1)
+ info(event->udev, "maximum number (%i) of children reached\n", children);
+ return;
+@@ -461,6 +461,13 @@ static int event_queue_insert(struct udev_device *dev)
+
+ event->state = EVENT_QUEUED;
+ udev_list_node_append(&event->node, &event_list);
++
++ /* run all events with a timeout set immediately */
++ if (udev_device_get_timeout(dev) > 0) {
++ event_run(event, true);
++ return 0;
++ }
++
+ return 0;
+ }
+
+@@ -577,7 +584,7 @@ static void event_queue_start(struct udev *udev)
+ continue;
+ }
+
+- event_run(event);
++ event_run(event, false);
+ }
+ }
+
+--
+1.7.9.5
+
View
72 systemd-git/PKGBUILD
@@ -1,25 +1,25 @@
# Maintainer: Dave Reisner <dreisner@archlinux.org>
pkgname=systemd-git
-pkgver=20120320
-pkgrel=1
-pkgdesc="Session and Startup manager"
+pkgver=20120404
+pkgrel=2
+pkgdesc="system and service manager"
arch=('i686' 'x86_64')
url="http://www.freedesktop.org/wiki/Software/systemd"
license=('GPL2')
depends=('acl' 'dbus' 'dbus-core' 'kbd' 'kmod' 'libcap' 'pam' 'udev' 'util-linux' 'xz')
-makedepends=('cryptsetup' 'docbook-xsl' 'git' 'gperf' 'intltool' 'libxslt'
- 'linux-api-headers')
+makedepends=('cryptsetup' 'docbook-xsl' 'git' 'gobject-introspection' 'gperf'
+ 'gtk-doc' 'intltool' 'libxslt')
optdepends=('cryptsetup: required for encrypted block devices'
'dbus-python: systemd-analyze'
'initscripts: legacy hostname, locale, and vconsole support'
'selinux-usr-libselinux: integration with security enhanced Linux'
'systemd-arch-units-git: collection of native unit files for Arch daemon/init scripts'
'tcp_wrappers: filter remote access to services')
-provides=('systemd' 'libsystemd')
-conflicts=('systemd' 'libsystemd')
+provides=('systemd' 'libsystemd' 'udev=182')
+conflicts=('systemd' 'libsystemd' 'udev')
groups=('systemd')
-options=(!libtool)
+options=('!libtool')
backup=(etc/dbus-1/system.d/org.freedesktop.systemd1.conf
etc/dbus-1/system.d/org.freedesktop.hostname1.conf
etc/dbus-1/system.d/org.freedesktop.login1.conf
@@ -27,11 +27,20 @@ backup=(etc/dbus-1/system.d/org.freedesktop.systemd1.conf
etc/dbus-1/system.d/org.freedesktop.timedate1.conf
etc/systemd/system.conf
etc/systemd/user.conf
- etc/systemd/systemd-logind.conf
- etc/systemd/systemd-journald.conf)
-install=systemd.install
-source=('os-release')
-md5sums=('752636def0db3c03f121f8b4f44a63cd')
+ etc/systemd/logind.conf
+ etc/systemd/journald.conf
+ etc/udev/udev.conf)
+install='systemd.install'
+source=('os-release'
+ 'initcpio-hooks-udev'
+ 'initcpio-install-udev'
+ 0001-udev-support-reading-from-split-usr-setup.patch
+ 0002-reinstate-TIMEOUT-handling.patch)
+md5sums=('752636def0db3c03f121f8b4f44a63cd'
+ 'a4dd853050bf2e0ae6b2e3d2c75499c2'
+ 'd2b16edc6d806b5dafdbbad43ae5a3de'
+ 'b2f1827cfe9035df20b2a05550f35188'
+ 'f6f942e0241b848763cad7bfd00f6757')
_gitroot="git://anongit.freedesktop.org/systemd/systemd.git"
_gitname="systemd"
@@ -53,15 +62,19 @@ build() {
git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
cd "$srcdir/$_gitname-build"
+ patch -Np1 <"$srcdir/0001-udev-support-reading-from-split-usr-setup.patch"
+ patch -Np1 <"$srcdir/0002-reinstate-TIMEOUT-handling.patch"
+
./autogen.sh
- ./configure --with-rootprefix= \
- --with-pamlibdir=/lib/security \
- --libdir=/usr/lib \
- --libexecdir=/usr/lib \
+ ./configure --libexecdir=/usr/lib \
--localstatedir=/var \
--sysconfdir=/etc \
+ --enable-split-usr \
--disable-audit \
- --with-distro=arch
+ --with-pamlibdir=/lib/security \
+ --with-distro=arch \
+ --with-sysvinit-path= \
+ --with-sysvrcd-path=
make
}
@@ -79,7 +92,9 @@ package() {
src/sd-daemon.[ch] \
src/readahead/sd-readahead.[ch]
- ln -s ../lib/systemd/systemd "$pkgdir/bin/systemd"
+ install -dm755 "$pkgdir/bin" "$pkgdir/lib/systemd"
+ ln -s ../usr/lib/systemd/systemd "$pkgdir/bin/systemd"
+ ln -s ../../usr/lib/systemd/systemd "$pkgdir/lib/systemd/systemd"
# fix systemd-analyze for python2
sed -i '1s/python$/python2/' "$pkgdir/usr/bin/systemd-analyze"
@@ -98,4 +113,23 @@ package() {
IFS='/' read section page <<< "$manpage"
mv "$manpage" "$section/systemd.$page"
done
+
+ # move bash-completion and symlink for loginctl
+ install -Dm644 "$pkgdir/etc/bash_completion.d/systemd-bash-completion.sh" \
+ "$pkgdir/usr/share/bash-completion/completions/systemctl"
+ ln -s systemctl "$pkgdir/usr/share/bash-completion/completions/loginctl"
+ rm -rf "$pkgdir/etc/bash_completion.d"
+
+ # the path to udevadm is hardcoded in some places
+ install -d "$pkgdir/sbin"
+ ln -s ../usr/bin/udevadm "$pkgdir/sbin/udevadm"
+
+ # Replace dialout/tape/cdrom group in rules with uucp/storage/optical group
+ sed -i -e 's#GROUP="dialout"#GROUP="uucp"#g;
+ s#GROUP="tape"#GROUP="storage"#g;
+ s#GROUP="cdrom"#GROUP="optical"#g' "$pkgdir"/usr/lib/udev/rules.d/*.rules
+
+ # add mkinitcpio hooks for udev
+ install -Dm644 "$srcdir/initcpio-install-udev" "$pkgdir/usr/lib/initcpio/install/udev"
+ install -Dm644 "$srcdir/initcpio-hooks-udev" "$pkgdir/usr/lib/initcpio/hooks/udev"
}
View
9 systemd-git/initcpio-hooks-udev
@@ -0,0 +1,9 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ msg -n ":: Triggering uevents..."
+ udevadm trigger --action=add --type=subsystems
+ udevadm trigger --action=add --type=devices
+ udevadm settle
+ msg "done."
+}
View
26 systemd-git/initcpio-install-udev
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+build() {
+ FILES="/etc/udev/udev.conf"
+ SCRIPT="udev"
+
+ add_binary /usr/lib/udev/udevd
+ add_binary /usr/bin/udevadm
+
+ for rules in 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do
+ add_file "/usr/lib/udev/rules.d/$rules"
+ done
+ for tool in ata_id scsi_id; do
+ add_file "/usr/lib/udev/$tool"
+ done
+}
+
+help() {
+ cat <<HELPEOF
+This hook will use udev to create your root device node and detect the needed
+modules for your root device. It is also required for firmware loading in
+initramfs. It is recommended to use this hook.
+HELPEOF
+}
+
+# vim: set ft=sh ts=4 sw=4 et:
View
31 systemd-git/systemd.install
@@ -1,41 +1,28 @@
#!/bin/sh
-checkgroups() {
- if ! getent group lock >/dev/null; then
- groupadd -g 54 lock
- fi
-}
-
sd_booted() {
- [ -e sys/fs/cgroups/systemd ]
+ [ -e sys/fs/cgroup/systemd ]
}
-post_install() {
- checkgroups
-
+machine_id_setup() {
if [ ! -f etc/machine-id ]; then
systemd-machine-id-setup
fi
+}
+
+post_install() {
+ machine_id_setup
echo "systemd has been installed to /bin/systemd. Please ensure you append"
echo "init=/bin/systemd to your kernel command line in your bootloader."
}
post_upgrade() {
- checkgroups
-
- if [ ! -f etc/machine-id ]; then
- systemd-machine-id-setup
- fi
+ machine_id_setup
if sd_booted; then
- systemctl daemon-reexec >/dev/null
- fi
-}
-
-post_remove() {
- if getent group lock >/dev/null; then
- groupdel lock
+ kill -1 1
+ kill -15 1
fi
}
Please sign in to comment.
Something went wrong with that request. Please try again.