From efdd416d20966196cf0ac8dd3231c5919b984ae8 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sat, 30 Nov 2019 14:07:34 -0600 Subject: [PATCH 1/3] init.d: style fixes Signed-off-by: William Hubbs --- 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