aboutsummaryrefslogtreecommitdiffstats
path: root/main/udev-init-scripts/0001-init.d-style-fixes.patch
blob: 378a737774f115ce35016ea8aca815a059a391c5 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
From efdd416d20966196cf0ac8dd3231c5919b984ae8 Mon Sep 17 00:00:00 2001
From: William Hubbs <williamh@gentoo.org>
Date: Sat, 30 Nov 2019 14:07:34 -0600
Subject: [PATCH 1/3] init.d: style fixes

Signed-off-by: William Hubbs <williamh@gentoo.org>
---
 init.d/udev         | 20 +++++++++-----------
 init.d/udev-settle  |  8 +++-----
 init.d/udev-trigger | 23 +++++++++--------------
 3 files changed, 21 insertions(+), 30 deletions(-)

diff --git a/init.d/udev b/init.d/udev
index d0f9d61..6aea5a5 100644
--- a/init.d/udev
+++ b/init.d/udev
@@ -9,17 +9,17 @@ description="udev manages device permissions and symbolic links in /dev"
 extra_started_commands="reload"
 description_reload="Reload the udev rules and databases"
 
-depend()
-{
+depend() {
 	need sysfs dev-mount
 	before checkfs fsck
 	keyword -lxc -systemd-nspawn -vserver
 }
 
 get_udevd_binary() {
-	local bins="/sbin/udevd /lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd"
+	local bins
+	bins="/sbin/udevd /lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd"
 	for f in ${bins}; do
-		if [ -x "$f" -a ! -L "$f" ]; then
+		if [ -x "$f" ] && [ ! -L "$f" ]; then
 			command="$f"
 		fi
 	done
@@ -29,8 +29,7 @@ get_udevd_binary() {
 	fi
 }
 
-start_pre()
-{
+start_pre() {
 	# make sure devtmpfs is in the kernel
 	if ! grep -qs devtmpfs /proc/filesystems; then
 		eerror "CONFIG_DEVTMPFS=y is required in your kernel configuration"
@@ -73,9 +72,9 @@ start_pre()
 	return 0
 }
 
-stop()
-{
-	local rc=0
+stop() {
+	local rc
+	rc=0
 	ebegin "Stopping ${name:-$RC_SVCNAME}"
 	udevadm control --exit
 	rc=$?
@@ -89,8 +88,7 @@ stop()
 	eend $rc "Failed to stop $RC_SVCNAME"
 }
 
-reload()
-{
+reload() {
 	ebegin "reloading udev rules and databases"
 	udevadm control --reload
 	eend $?
diff --git a/init.d/udev-settle b/init.d/udev-settle
index c495769..f6e0707 100644
--- a/init.d/udev-settle
+++ b/init.d/udev-settle
@@ -2,18 +2,16 @@
 # Copyright 2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-depend()
-{
+depend() {
 	need udev
 	after udev-trigger
 	provide dev-settle
 	keyword -lxc -systemd-nspawn -vserver
 }
 
-start()
-{
+start() {
 	ebegin "Waiting for uevents to be processed"
 	udevadm settle \
-		${udev_settle_timeout:+--timeout=}$udev_settle_timeout
+		${udev_settle_timeout:+--timeout=}"${udev_settle_timeout}"
 	eend $?
 }
diff --git a/init.d/udev-trigger b/init.d/udev-trigger
index bdd4884..dfca873 100644
--- a/init.d/udev-trigger
+++ b/init.d/udev-trigger
@@ -7,15 +7,13 @@ description="udev Coldplug all Devices"
 udevmonitor_log=/run/udevmonitor.log
 udevmonitor_pid=/run/udevmonitor.pid
 
-depend()
-{
+depend() {
 	need udev
 	provide dev
 	keyword -lxc -systemd-nspawn -vserver
 }
 
-start_pre()
-{
+start_pre() {
 	if yesno "${udev_monitor:-no}"; then
 		einfo "Running udevadm monitor ${udev_monitor_opts} to log all events"
 		start-stop-daemon --start --stdout "${udevmonitor_log}" \
@@ -25,9 +23,8 @@ start_pre()
 	return 0
 }
 
-display_hotplugged_services()
-{
-	local svcfile= svc= services=
+display_hotplugged_services() {
+	local svcfile svc services
 	for svcfile in "${RC_SVCDIR}"/hotplugged/*; do
 		svc="${svcfile##*/}"
 		[ -x "${svcfile}" ] || continue
@@ -38,8 +35,7 @@ display_hotplugged_services()
 	return 0
 }
 
-start_post()
-{
+start_post() {
 	if yesno "${udev_monitor:-no}"; then
 		if yesno "${udev_monitor_keep_running:-no}"; then
 			ewarn "udevmonitor is still writing into ${udevmonitor_log}"
@@ -56,9 +52,9 @@ start_post()
 # This is here because some software expects /dev/root to exist.
 # For more information, see this bug:
 # https://bugs.gentoo.org/show_bug.cgi?id=438380
-dev_root_link()
-{
-	local RULESDIR=/run/udev/rules.d
+dev_root_link() {
+	local RULESDIR
+	RULESDIR=/run/udev/rules.d
 	[ -d $RULESDIR ] || mkdir -p $RULESDIR
 	eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ||
 		true)
@@ -71,8 +67,7 @@ dev_root_link()
 	return 0
 }
 
-start()
-{
+start() {
 	if yesno ${rc_dev_root_symlink:-yes}; then
 		ebegin "Generating a rule to create a /dev/root symlink"
 		dev_root_link
-- 
2.25.2