#------------------------------------------------------------------------------ # /etc/rc.d/rc030.mountfloppy - mount optional floppy # # Creation: 2005-09-05 lanspezi # Last Update: $Id$ #------------------------------------------------------------------------------ mount_floppy () { sects_1680_flop=`echo -e -n '\x20\x0D'` sects_boot_flop=`dd if="$flop_dev" bs=1 skip=19 count=2 2>/dev/null` if [ "$sects_boot_flop" = "$sects_1680_flop" ] then flop_dev="$flop_dev"u1680 fi is_mounted=`mount | grep $flop_dev` case x$is_mounted in x) echo "$flop_dev $flop_dir vfat defaults,umask=077" >> /etc/fstab mkdir -p $flop_dir mount /floppy 2> /tmp/mountfloppy.$$ case $? in 1) log_error "floppy media is not present; floppy not mounted!" ;; 0) if grep -q read-only /tmp/mountfloppy.$$ then log_error "floppy media is write protected and is mounted read-only" fi ;; esac rm -f /tmp/mountfloppy.* ;; *) set $is_mounted log_error "floppy device $flop_dev is already mounted at $3" ;; esac } case $OPT_MOUNTFLOPPY in first|second) begin_script MOUNT "mounting floppy drive on /floppy ..." flop_dir="/floppy" case $OPT_MOUNTFLOPPY in first) flop_dev=/dev/fd0 mount_floppy ;; second) flop_dev=/dev/fd1 mount_floppy ;; esac end_script ;; esac