Annotation of /trunk/udev/patches/udev-166-r2-store-persistent-rules.patch
Parent Directory | Revision Log
Revision 2427 -
(hide annotations)
(download)
Tue Apr 22 10:40:03 2014 UTC (10 years, 5 months ago) by niro
File size: 1817 byte(s)
Tue Apr 22 10:40:03 2014 UTC (10 years, 5 months ago) by niro
File size: 1817 byte(s)
-store persistent device rules
1 | niro | 2427 | diff -Naur config-udev-166-r2/Makefile config-udev-166-r2-honor-persistent/Makefile |
2 | --- config-udev-166-r2/Makefile 2012-04-03 14:50:54.000000000 +0000 | ||
3 | +++ config-udev-166-r2-honor-persistent/Makefile 2014-04-22 11:35:32.156000000 +0000 | ||
4 | @@ -23,6 +23,7 @@ | ||
5 | install-files: | ||
6 | # install rc-script | ||
7 | install -m 0755 udev.rc $(DESTDIR)${rcscriptdir}/udev | ||
8 | + install -m 0755 udev-postmount.rc $(DESTDIR)${rcscriptdir}/udev | ||
9 | |||
10 | # our config file | ||
11 | install -m 0644 udev.conf $(DESTDIR)${udevconfdir}/ | ||
12 | diff -Naur config-udev-166-r2/udev-postmount.rc config-udev-166-r2-honor-persistent/udev-postmount.rc | ||
13 | --- config-udev-166-r2/udev-postmount.rc 1970-01-01 00:00:00.000000000 +0000 | ||
14 | +++ config-udev-166-r2-honor-persistent/udev-postmount.rc 2014-04-22 11:50:53.856000000 +0000 | ||
15 | @@ -0,0 +1,52 @@ | ||
16 | +#!/bin/sh | ||
17 | +# $Id$ | ||
18 | + | ||
19 | +# start this after mountfs to have a writeable rootfs | ||
20 | +#%rlevels: 7:s | ||
21 | +#%start: 50 | ||
22 | +#%stop: | ||
23 | + | ||
24 | +#deps | ||
25 | +#%needs: | ||
26 | +#%before: | ||
27 | +#%after: | ||
28 | + | ||
29 | +source /etc/conf.d/rc | ||
30 | +source ${rc_functions} | ||
31 | + | ||
32 | +# store persistent-rules that got created while booting | ||
33 | +# when / was still read-only | ||
34 | +store_persistent_rules() | ||
35 | +{ | ||
36 | + local file dest type | ||
37 | + | ||
38 | + # check if this system uses udev | ||
39 | + [ -d /dev/.udev/ ] || return 0 | ||
40 | + | ||
41 | + # only continue if rules-directory is writable | ||
42 | + [ -w /etc/udev/rules.d ] || return 0 | ||
43 | + | ||
44 | + for file in /dev/.udev/tmp-rules--* | ||
45 | + do | ||
46 | + dest="${file##*tmp-rules--}" | ||
47 | + [ "$dest" = '*' ] && break | ||
48 | + type="${dest##70-persistent-}" | ||
49 | + type=${type%%.rules} | ||
50 | + rc_print "Saving udev persistent ${COLBLUE}${type}${COLDEFAULT} rules to /etc/udev/rules.d" | ||
51 | + cat "$file" >> /etc/udev/rules.d/"$dest" && rm -f "$file" | ||
52 | + evaluate_retval | ||
53 | + done | ||
54 | +} | ||
55 | + | ||
56 | +case "$1" in | ||
57 | + start) | ||
58 | + store_persistent_rules | ||
59 | + | ||
60 | + update_svcstatus $1 | ||
61 | + splash svc_started "$(basename $0)" 0 | ||
62 | + ;; | ||
63 | + *) | ||
64 | + rc_echo "Usage: $0 {start}" | ||
65 | + exit 1 | ||
66 | + ;; | ||
67 | +esac |