Hi,
Le dimanche 6 janvier 2008 20:18, vous avez écrit :
Stephane wrote:
[...]
But there is an error:
When launching
cd /proc/ide
I see
/proc/ide: bad directory
And script stops.
Solution:
If I comment line used to eject CD, it is OK.
My script runs.
Maybe it would be possible to do something
using /proc/sys/dev/cdrom/info or /proc/sys/dev/cdrom/autoeject
# grep "drive name" /proc/sys/dev/cdrom/info
drive name: hdc
#
But
# grep "drive name" /proc/sys/dev/cdrom/info | sed -e "s/ //g"
#
Troubles with redirections?
I would like to do something like:
# grep "drive name" /proc/sys/dev/cdrom/info | tr "\t" " "
| sed -e "s/
//g" | cut -d ":" -f2
Regards.
Indeed, in order to save space, I compiled the kernel without /proc/ide
support:
config IDE_PROC_FS
bool "legacy /proc/ide/ support"
depends on IDE && PROC_FS
default y
help
This option enables support for the various files in
/proc/ide. In Linux 2.6 this has been superseded by
files in sysfs but many legacy applications rely on this.
If unsure say Y.
As you noted, you can still achieve the same functionality using /sys
One way would for instance be the following command:
fgrep -l cdrom /sys/block/*/device/media |
sed 's/\/sys\/block\/\(.*\)\/device\/media/\1/'
To be run with today's version, in order to avoid the
__libc_atexit/--gc-sections bug...
I get this version but it doesn't solve trouble.
# fgrep -l cdrom /sys/block/*/device/media
returns
/sys/block/hdc/device/media
It could be fine but
# fgrep -l cdrom /sys/block/*/device/media |
sed 's/\/sys\/block\/\(.*\)\/device\/media/\1/'
returns blank
# fgrep -l cdrom /sys/block/*/device/media | cut -d"/" -f4
returns blank
Regards.
--
Stephane