blob: f1f94f48902ab7c877341c4025ae224a4e53fe91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend()
{
need localmount
keyword -vserver -lxc
}
dir_writeable()
{
touch "$1"/.test.$$ 2>/dev/null && rm "$1"/.test.$$
}
# store persistent-rules that got created while booting
# when / was still read-only
store_persistent_rules()
{
# create /etc/udev/rules.d if it does not exist and /etc/udev is writable
[ -d /etc/udev/rules.d ] || \
dir_writeable /etc/udev && \
mkdir -p /etc/udev/rules.d
# only continue if rules-directory is writable
dir_writeable /etc/udev/rules.d || return 0
local file dest
for file in /run/udev/tmp-rules--*; do
dest=${file##*tmp-rules--}
[ "$dest" = '*' ] && break
type=${dest##70-persistent-}
type=${type%%.rules}
ebegin "Saving udev persistent ${type} rules to /etc/udev/rules.d"
cat "$file" >> /etc/udev/rules.d/"$dest" && rm -f "$file"
eend $? "Failed moving persistent rules!"
done
}
start()
{
# check if this system uses udev
[ -d /run/udev ] || return 0
# store persistent-rules that got created while booting
# when / was still read-only
store_persistent_rules
}
stop()
{
return 0
}
# vim:ts=4
|