[PATCH] eject -T support

Denis Vlasenko vda.linux at googlemail.com
Sat Oct 7 09:19:25 PDT 2006


On Saturday 07 October 2006 17:47, Tito wrote:
> > I have an idea: remove that code entirely, then:
> > 
> > #!/bin/sh
> > umount /dev/cdrom
> > eject
> > 
> > Would this work?
> 
> I don't think so. One test I did was to use
> 
> umount_main()
> 
> instead of the actual code but this gave me some errors on one
> of the two cases depending if I fed the device or the mount dir 
> as args.

I tested it and it worked for me as shell script.

If "umount /dev/cdrom" errors out where it should work, we need
to fix *that*.

> Also something as
> 
> system("umount  bla")

shell scripts are easier to debug/change than hardcoded stuff.
Clever admin/disctro builder might do, for example:

....
# Unmount dev from ALL mountpoints if needed
# (not just the first!)
i=10
while ! eject "$dev" && test "$i" != 0; do
    umount "$dev"
    let i--  # bash'ism?
done

Imagine how you would do this in C...
--
vda


More information about the busybox mailing list