Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/udev-gentoo-scripts:master commit in: init.d/
Date: Sat, 30 Nov 2019 20:09:02
Message-Id: 1575144464.efdd416d20966196cf0ac8dd3231c5919b984ae8.williamh@gentoo
1 commit: efdd416d20966196cf0ac8dd3231c5919b984ae8
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 30 20:07:34 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 30 20:07:44 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/udev-gentoo-scripts.git/commit/?id=efdd416d
7
8 init.d: style fixes
9
10 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
11
12 init.d/udev | 20 +++++++++-----------
13 init.d/udev-settle | 8 +++-----
14 init.d/udev-trigger | 23 +++++++++--------------
15 3 files changed, 21 insertions(+), 30 deletions(-)
16
17 diff --git a/init.d/udev b/init.d/udev
18 index d0f9d61..6aea5a5 100644
19 --- a/init.d/udev
20 +++ b/init.d/udev
21 @@ -9,17 +9,17 @@ description="udev manages device permissions and symbolic links in /dev"
22 extra_started_commands="reload"
23 description_reload="Reload the udev rules and databases"
24
25 -depend()
26 -{
27 +depend() {
28 need sysfs dev-mount
29 before checkfs fsck
30 keyword -lxc -systemd-nspawn -vserver
31 }
32
33 get_udevd_binary() {
34 - local bins="/sbin/udevd /lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd"
35 + local bins
36 + bins="/sbin/udevd /lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd"
37 for f in ${bins}; do
38 - if [ -x "$f" -a ! -L "$f" ]; then
39 + if [ -x "$f" ] && [ ! -L "$f" ]; then
40 command="$f"
41 fi
42 done
43 @@ -29,8 +29,7 @@ get_udevd_binary() {
44 fi
45 }
46
47 -start_pre()
48 -{
49 +start_pre() {
50 # make sure devtmpfs is in the kernel
51 if ! grep -qs devtmpfs /proc/filesystems; then
52 eerror "CONFIG_DEVTMPFS=y is required in your kernel configuration"
53 @@ -73,9 +72,9 @@ start_pre()
54 return 0
55 }
56
57 -stop()
58 -{
59 - local rc=0
60 +stop() {
61 + local rc
62 + rc=0
63 ebegin "Stopping ${name:-$RC_SVCNAME}"
64 udevadm control --exit
65 rc=$?
66 @@ -89,8 +88,7 @@ stop()
67 eend $rc "Failed to stop $RC_SVCNAME"
68 }
69
70 -reload()
71 -{
72 +reload() {
73 ebegin "reloading udev rules and databases"
74 udevadm control --reload
75 eend $?
76
77 diff --git a/init.d/udev-settle b/init.d/udev-settle
78 index c495769..f6e0707 100644
79 --- a/init.d/udev-settle
80 +++ b/init.d/udev-settle
81 @@ -2,18 +2,16 @@
82 # Copyright 2014 Gentoo Foundation
83 # Distributed under the terms of the GNU General Public License v2
84
85 -depend()
86 -{
87 +depend() {
88 need udev
89 after udev-trigger
90 provide dev-settle
91 keyword -lxc -systemd-nspawn -vserver
92 }
93
94 -start()
95 -{
96 +start() {
97 ebegin "Waiting for uevents to be processed"
98 udevadm settle \
99 - ${udev_settle_timeout:+--timeout=}$udev_settle_timeout
100 + ${udev_settle_timeout:+--timeout=}"${udev_settle_timeout}"
101 eend $?
102 }
103
104 diff --git a/init.d/udev-trigger b/init.d/udev-trigger
105 index bdd4884..dfca873 100644
106 --- a/init.d/udev-trigger
107 +++ b/init.d/udev-trigger
108 @@ -7,15 +7,13 @@ description="udev Coldplug all Devices"
109 udevmonitor_log=/run/udevmonitor.log
110 udevmonitor_pid=/run/udevmonitor.pid
111
112 -depend()
113 -{
114 +depend() {
115 need udev
116 provide dev
117 keyword -lxc -systemd-nspawn -vserver
118 }
119
120 -start_pre()
121 -{
122 +start_pre() {
123 if yesno "${udev_monitor:-no}"; then
124 einfo "Running udevadm monitor ${udev_monitor_opts} to log all events"
125 start-stop-daemon --start --stdout "${udevmonitor_log}" \
126 @@ -25,9 +23,8 @@ start_pre()
127 return 0
128 }
129
130 -display_hotplugged_services()
131 -{
132 - local svcfile= svc= services=
133 +display_hotplugged_services() {
134 + local svcfile svc services
135 for svcfile in "${RC_SVCDIR}"/hotplugged/*; do
136 svc="${svcfile##*/}"
137 [ -x "${svcfile}" ] || continue
138 @@ -38,8 +35,7 @@ display_hotplugged_services()
139 return 0
140 }
141
142 -start_post()
143 -{
144 +start_post() {
145 if yesno "${udev_monitor:-no}"; then
146 if yesno "${udev_monitor_keep_running:-no}"; then
147 ewarn "udevmonitor is still writing into ${udevmonitor_log}"
148 @@ -56,9 +52,9 @@ start_post()
149 # This is here because some software expects /dev/root to exist.
150 # For more information, see this bug:
151 # https://bugs.gentoo.org/show_bug.cgi?id=438380
152 -dev_root_link()
153 -{
154 - local RULESDIR=/run/udev/rules.d
155 +dev_root_link() {
156 + local RULESDIR
157 + RULESDIR=/run/udev/rules.d
158 [ -d $RULESDIR ] || mkdir -p $RULESDIR
159 eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ||
160 true)
161 @@ -71,8 +67,7 @@ dev_root_link()
162 return 0
163 }
164
165 -start()
166 -{
167 +start() {
168 if yesno ${rc_dev_root_symlink:-yes}; then
169 ebegin "Generating a rule to create a /dev/root symlink"
170 dev_root_link