diff options
author | Harald Hoyer <harald@redhat.com> | 2012-03-02 14:53:22 +0100 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2012-03-08 11:00:29 +0100 |
commit | 74db72dd0b22973cfd9f3cbe832b09096c4e7ab9 (patch) | |
tree | bc44a39fd16b7875c6db383abd34cf6127544e72 /modules.d | |
parent | 4fed3ddf16431524f07fc8bbad6aec913b6c0777 (diff) | |
download | dracut-74db72dd0b22973cfd9f3cbe832b09096c4e7ab9.tar.gz dracut-74db72dd0b22973cfd9f3cbe832b09096c4e7ab9.tar.bz2 dracut-74db72dd0b22973cfd9f3cbe832b09096c4e7ab9.zip |
98pollcdrom: factored out the ugly cdrom polling in the main loop
Diffstat (limited to 'modules.d')
-rwxr-xr-x | modules.d/98pollcdrom/module-setup.sh | 16 | ||||
-rw-r--r-- | modules.d/98pollcdrom/pollcdrom.sh | 23 | ||||
-rwxr-xr-x | modules.d/99base/init.sh | 14 |
3 files changed, 39 insertions, 14 deletions
diff --git a/modules.d/98pollcdrom/module-setup.sh b/modules.d/98pollcdrom/module-setup.sh new file mode 100755 index 00000000..e80ae16f --- /dev/null +++ b/modules.d/98pollcdrom/module-setup.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +check() { + return 255 +} + +depends() { + return 0 +} + +install() { + inst_hook initqueue/settled 99 "$moddir/pollcdrom.sh" +} + diff --git a/modules.d/98pollcdrom/pollcdrom.sh b/modules.d/98pollcdrom/pollcdrom.sh new file mode 100644 index 00000000..4abc9d70 --- /dev/null +++ b/modules.d/98pollcdrom/pollcdrom.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh +# +# Licensed under the GPLv2 +# +# Copyright 2008-2012, Red Hat, Inc. +# Harald Hoyer <harald@redhat.com> + +if [ ! -e /sys/module/block/parameters/events_dfl_poll_msecs ]; then + # if the kernel does not support autopolling + # then we have to do a + # dirty hack for some cdrom drives, + # which report no medium for quiet + # some time. + for cdrom in /sys/block/sr*; do + [ -e "$cdrom" ] || continue + # skip, if cdrom medium was already found + strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \ + ID_CDROM_MEDIA && continue + echo change > "$cdrom/uevent" + done +fi diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh index 96fd5f22..f6e40272 100755 --- a/modules.d/99base/init.sh +++ b/modules.d/99base/init.sh @@ -199,20 +199,6 @@ while :; do # no more udev jobs and queues empty. sleep 0.5 - if [ ! -e /sys/module/block/parameters/events_dfl_poll_msecs ]; then - # if the kernel does not support autopolling - # then we have to do a - # dirty hack for some cdrom drives, - # which report no medium for quiet - # some time. - for cdrom in /sys/block/sr*; do - [ -e "$cdrom" ] || continue - # skip, if cdrom medium was already found - strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \ - ID_CDROM_MEDIA && continue - echo change > "$cdrom/uevent" - done - fi if [ $main_loop -gt $(($RDRETRY/2)) ]; then for job in $hookdir/initqueue/timeout/*.sh; do |