diff options
author | Sören Tempel <soeren+git@soeren-tempel.net> | 2016-03-09 12:31:29 +0100 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-04-06 19:58:22 +0000 |
commit | 23f8cfc9a8aab476eb97c6ec252fcdb6577220d7 (patch) | |
tree | 387c52e8e4764829a081dd01dae6289d1cf95f24 /testing/nldev | |
parent | 11949c75677ef1619799f96485a8599eb81415f3 (diff) | |
download | aports-23f8cfc9a8aab476eb97c6ec252fcdb6577220d7.tar.bz2 aports-23f8cfc9a8aab476eb97c6ec252fcdb6577220d7.tar.xz |
testing/nldev: new aport
Diffstat (limited to 'testing/nldev')
-rw-r--r-- | testing/nldev/0001-Revert-nldev-set-kernel-buffer-to-16kb.patch | 26 | ||||
-rw-r--r-- | testing/nldev/0002-Preserve-the-PATH-environment-variable.patch | 46 | ||||
-rw-r--r-- | testing/nldev/0003-Change-the-default-mdev-path-to-sbin-mdev.patch | 41 | ||||
-rw-r--r-- | testing/nldev/APKBUILD | 84 | ||||
-rw-r--r-- | testing/nldev/nldev-trigger.initd | 13 | ||||
-rw-r--r-- | testing/nldev/nldev.initd | 14 |
6 files changed, 224 insertions, 0 deletions
diff --git a/testing/nldev/0001-Revert-nldev-set-kernel-buffer-to-16kb.patch b/testing/nldev/0001-Revert-nldev-set-kernel-buffer-to-16kb.patch new file mode 100644 index 0000000000..3b8456e664 --- /dev/null +++ b/testing/nldev/0001-Revert-nldev-set-kernel-buffer-to-16kb.patch @@ -0,0 +1,26 @@ +From 6df459de208c7f148f2c0f06b0712ea1708ed614 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> +Date: Wed, 10 Feb 2016 22:57:13 +0100 +Subject: [PATCH 1/4] Revert "nldev: set kernel buffer to 16kb" + +This reverts commit 025a4aef1a05cf523fbdf98ed71fd2e7b902d7fd. +--- + nldev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nldev.c b/nldev.c +index 018ed86..9153fd2 100644 +--- a/nldev.c ++++ b/nldev.c +@@ -161,7 +161,7 @@ init_netlink_socket(void) + if (fd < 0) + edie("socket"); + +- slen = 16*1024; ++ slen = 128*1024*1024; + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUFFORCE, &slen, + sizeof(slen)) < 0) { + edie("setsockopt"); +-- +2.7.2 + diff --git a/testing/nldev/0002-Preserve-the-PATH-environment-variable.patch b/testing/nldev/0002-Preserve-the-PATH-environment-variable.patch new file mode 100644 index 0000000000..d6c4ffec67 --- /dev/null +++ b/testing/nldev/0002-Preserve-the-PATH-environment-variable.patch @@ -0,0 +1,46 @@ +From 980c9181b9bf44be6007462ef54568759aabbc5a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> +Date: Wed, 10 Feb 2016 23:26:23 +0100 +Subject: [PATCH 2/4] Preserve the PATH environment variable + +No idea why this wasn't done before... +--- + nldev.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/nldev.c b/nldev.c +index 9153fd2..deabf10 100644 +--- a/nldev.c ++++ b/nldev.c +@@ -193,7 +193,7 @@ main(int argc, char *argv[]) + struct msghdr hdr; + struct iovec iov; + char buf[4097], *subsystem, *runpath, *key, *value, +- cbuf[CMSG_SPACE(sizeof(struct ucred))]; ++ *origpath, cbuf[CMSG_SPACE(sizeof(struct ucred))]; + struct cmsghdr *chdr; + struct ucred *cred; + int i, len, slen, showudev, showkernel; +@@ -203,6 +203,10 @@ main(int argc, char *argv[]) + subsystem = NULL; + runpath = "/bin/mdev"; + ++ origpath = getenv("PATH"); ++ if (!origpath || strlen(origpath) <= 0) ++ origpath = "/sbin:/bin"; ++ + ARGBEGIN { + case 'b': + dofork = 1; +@@ -242,7 +246,7 @@ main(int argc, char *argv[]) + buf[sizeof(buf)-1] = '\0'; + while (poll(&fds, 1, -1) > -1) { + clearenv(); +- setenv("PATH", "/sbin:/bin", 1); ++ setenv("PATH", origpath, 1); + + iov.iov_base = &buf; + iov.iov_len = sizeof(buf); +-- +2.7.2 + diff --git a/testing/nldev/0003-Change-the-default-mdev-path-to-sbin-mdev.patch b/testing/nldev/0003-Change-the-default-mdev-path-to-sbin-mdev.patch new file mode 100644 index 0000000000..395f674c86 --- /dev/null +++ b/testing/nldev/0003-Change-the-default-mdev-path-to-sbin-mdev.patch @@ -0,0 +1,41 @@ +From 5a979c33e4859d07660fad54d253c91202cf2a37 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> +Date: Wed, 10 Feb 2016 23:29:04 +0100 +Subject: [PATCH 3/4] Change the default mdev path to /sbin/mdev + +You can set it using the -r command line flag but I prefer it when +things work out of the box (the flag is nice to have non the less). +--- + nldev.8 | 2 +- + nldev.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/nldev.8 b/nldev.8 +index b1c18db..45c307b 100644 +--- a/nldev.8 ++++ b/nldev.8 +@@ -56,7 +56,7 @@ Only show netlink messages from libudev. + . + .It Fl r Ar runpath + This option specifies the runpath for the helper that is launched +-on every received netlink event (default: /bin/mdev). ++on every received netlink event (default: /sbin/mdev). + .El + . + .Sh AUTHORS +diff --git a/nldev.c b/nldev.c +index deabf10..a1d529a 100644 +--- a/nldev.c ++++ b/nldev.c +@@ -201,7 +201,7 @@ main(int argc, char *argv[]) + showkernel = 1; + showudev = 1; + subsystem = NULL; +- runpath = "/bin/mdev"; ++ runpath = "/sbin/mdev"; + + origpath = getenv("PATH"); + if (!origpath || strlen(origpath) <= 0) +-- +2.7.2 + diff --git a/testing/nldev/APKBUILD b/testing/nldev/APKBUILD new file mode 100644 index 0000000000..52cdcad58e --- /dev/null +++ b/testing/nldev/APKBUILD @@ -0,0 +1,84 @@ +# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net> +# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net> +pkgname=nldev +pkgver=0.3_git20160309 +pkgrel=0 +verbase=0.3 +pkgdesc="A simple netlink device manager" +url="http://git.r-36.net/nldev/" +arch="all" +license="MIT" +depends="" +depends_dev="" +makedepends="linux-headers" +install="" +subpackages="$pkgname-doc" +source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.gz + ${pkgname}.initd + ${pkgname}-trigger.initd + + 0001-Revert-nldev-set-kernel-buffer-to-16kb.patch + 0002-Preserve-the-PATH-environment-variable.patch + 0003-Change-the-default-mdev-path-to-sbin-mdev.patch" + +disturl="dev.alpinelinux.org:/archive/$pkgname" +reporev="d2974b64d4e8bab0e08c6395c2925c94e13a3ca5" +giturl="git://git.r-36.net/$pkgname" + +_builddir="$srcdir"/$pkgname-$pkgver +build() { + make CFLAGS="$CFLAGS \${INCS} \${CPPFLAGS}" \ + LDFLAGS="$LDFLAGS \${LIBS}" CC="${CC:-gcc}" \ + -C "$_builddir" || return 1 +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" PREFIX=/ \ + MANPREFIX=/usr/share/man install || return 1 + + # Move nldev to /sbin + mkdir -p "$pkgdir"/sbin/ + mv "$pkgdir"/bin/$pkgname "$pkgdir"/sbin/ || return 1 + + # We don't need run_nldev, use the init script instead + rm -f "$pkgdir"/bin/run_$pkgname + + # Install OpenRC service files + for service in ${pkgname} ${pkgname}-trigger; do + install -Dm755 "$srcdir"/$service.initd \ + "$pkgdir"/etc/init.d/$service || return 1 + done + + # Install utility scripts + mkdir -p "$pkgdir"/lib/$pkgname || return 1 + install -m755 mdev/lib/* "$pkgdir"/lib/$pkgname/ || return 1 + + # Install additional documentation + mkdir -p "$pkgdir"/usr/share/doc/$pkgname/examples/ + install -m644 FIXES.md README.md \ + "$pkgdir"/usr/share/doc/$pkgname/ || return 1 + install -m644 mdev/etc/* \ + "$pkgdir"/usr/share/doc/$pkgname/examples || return 1 + install -m755 mdev/lib/* \ + "$pkgdir"/usr/share/doc/$pkgname/examples || return 1 +} + +md5sums="2a9b7645cf5e73638766c9737365561c nldev-0.3_git20160309.tar.gz +3bc9f761fe7b57c538089bb3875cb1cd nldev.initd +f57e754d52f06529e82979db8bd3106e nldev-trigger.initd +e565d056ea4dd5c74b308c397e7e27e5 0001-Revert-nldev-set-kernel-buffer-to-16kb.patch +a921cc18e879114a1c8009d2f9cfb552 0002-Preserve-the-PATH-environment-variable.patch +bfc26b861b96d253b89defb14697523a 0003-Change-the-default-mdev-path-to-sbin-mdev.patch" +sha256sums="81939fa83bd0fe27f4f5e59fff102615eb5050110f0140e1765636bbe034fee1 nldev-0.3_git20160309.tar.gz +3e88e5a53b0db3724f03fb4b9ec90b42b2c9734516db6d9f11d125ed2b365776 nldev.initd +1ab6163a350a7c7e377f0e6ea9070c736c434c9a55c3ef28438af552effa1714 nldev-trigger.initd +22e295e2f3391c139b735098f11c8dfabf835373ad80a1d12f0df3d4ee4ffc7d 0001-Revert-nldev-set-kernel-buffer-to-16kb.patch +7d47ff02a42273446fed0774658d0f9f199e4d9b1ede3e02143985db6fab3d0f 0002-Preserve-the-PATH-environment-variable.patch +a861166721ecae633bffa91a6ac055c23f3ad5a1070cb7c9a303816326328619 0003-Change-the-default-mdev-path-to-sbin-mdev.patch" +sha512sums="3afdc0e20d560721a4447e9e5e13393280a35d97161893ec930016697ec2048ec1557f46bdad116be8fe594fbc4ee02dea89464630c38a65adc74bd069432a7c nldev-0.3_git20160309.tar.gz +1e2b4ca1f7b6c9a6d36ac659acf5ef8fb0aef49c7db69dc3f94ef54bfd024a34ce849092c23f67934ea36e19df3b76b01eb347daa423a8eaf63b556077d2af64 nldev.initd +0e34e2db640bcfe7ba8b8e2a07a681906e7e6a2fe267f255a216c36e93db5096b7ed4865935ef448aabc8c4c130a786e555113d8ba90bed58f4ae3450890a1ea nldev-trigger.initd +7821f54b0eeab13355d0a534bafc7c07250b91dcd43e334ffe9bcd9ee601680489ade4aa97b45543d38be93279c3cb11357d58497a3fb7e66052bf743917088f 0001-Revert-nldev-set-kernel-buffer-to-16kb.patch +3d592c4f5a8ae1081aa3780d099b98e3c9869cecc1a3d06dff096e8ee1ea00059c8d5c702fdbb6c5829a429a813f37deab7de7164d38887834d62c0da6165173 0002-Preserve-the-PATH-environment-variable.patch +b9128249077981718d34477b5b81655f256f0a28a549099ed20a611d5aeb54e0d837debe623d6f65071a036fd31322454bb99906058e6309b18c0178c5ce3e5e 0003-Change-the-default-mdev-path-to-sbin-mdev.patch" diff --git a/testing/nldev/nldev-trigger.initd b/testing/nldev/nldev-trigger.initd new file mode 100644 index 0000000000..65482d8cba --- /dev/null +++ b/testing/nldev/nldev-trigger.initd @@ -0,0 +1,13 @@ +#!/sbin/openrc-run + +depend() { + need nldev + provide dev + keyword -lxc -vserver +} + +start() { + ebegin "Populating /dev with existing devices through uevents" + /bin/nltrigger add all + eend $? +} diff --git a/testing/nldev/nldev.initd b/testing/nldev/nldev.initd new file mode 100644 index 0000000000..ed6f1e21ba --- /dev/null +++ b/testing/nldev/nldev.initd @@ -0,0 +1,14 @@ +#!/sbin/openrc-run + +name="$SVCNAME" +command="/sbin/$SVCNAME" +command_args="${NLDEV_OPTS:--k}" +pidfile="/var/run/$SVCNAME.pid" +command_background="yes" + +depend() { + provide dev + need sysfs dev-mount + before checkfs fsck + keyword -lxc -vserver +} |