From b813adec2a11222748b6fd8976ddda9de1e3da5d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 29 Oct 2009 10:05:42 -0700 Subject: Change how floppy is mounted This fixes several problems: 1) Only try mounting once which avoids several I/O errors 2) Mount floppy with safer options for security 3) Use more optimum methods to reduce boot time This should really be done by better udev support. But the root of the problem lies in the Debian upstream package maintainer. He is hostile to later advancements, and still maintains a static /dev infrastructure as well as devfs compatiablity! Ubuntu, SUSE, and Redhat have all migrated to creating devices via udev; this would allow floppy device to only exist if floppy is present. And then inserting a floppy could cause udev add event to mount /media/floppy... --- etc/init.d/vyatta-ofr | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/etc/init.d/vyatta-ofr b/etc/init.d/vyatta-ofr index a3dbc42..ac8d861 100755 --- a/etc/init.d/vyatta-ofr +++ b/etc/init.d/vyatta-ofr @@ -66,13 +66,17 @@ have_rl_system () { # if necessary, provide initial config init_bootfile () { - if [ ! -d /media/floppy/config ] && grep -q fd /proc/devices + + if [ ! -d /media/floppy/config -a -b /dev/fd0 ] then - mkdir -p /media/floppy - mount /dev/fd0 /media/floppy -o sync || - mount -t ext2 /dev/fd0 /media/floppy -o sync || - mount -t vfat /dev/fd0 /media/floppy - fi 2>/dev/null + [ -d /media/floppy ] || mkdir -p /media/floppy + + # This mount will try ext2 or fat format + # and it will fail if no floppy present + # Note: no good way to test for floppy present without causing I/O error + mount /dev/fd0 /media/floppy \ + -o sync,noexec,nodev,noatime,nosuid 2>/dev/null + fi [ -d /media/floppy/config ] && mount -o bind /media/floppy/config /opt/vyatta/etc/config -- cgit v1.2.3