You are not logged in.
Pages: 1
I am making a config (Fvwm) to mount different devices. I found a sample config in Fvwm Forums, but I am not sure what device mounting points are applicable in Arch.
http://fvwm.lair.be/viewtopic.php?t=527
I know how to mount cdrom (/dev/cdrom), floppy (/dev/fd0) and thumb drive (/dev/sda1), but not the other devices. If they apply in Arch, how do you mount them? Also fstab seems to be better than mtab.
Partial copy of the config:
#!/bin/bash
floppy=`grep -c floppy < /etc/mtab`
cdrom=`grep -c cdrom < /etc/mtab`
mp3player=`grep -c mp3player < /etc/mtab`
digital_camera=`grep -c digital_camera < /etc/mtab`
removable=`grep -c removable < /etc/mtab`
doc=`grep -c doc < /etc/mtab`
multimedia=`grep -c multimedia < /etc/mtab`
sounds=`grep -c sounds < /etc/mtab`
Markku
Offline
Your best bet is to read the fstab and generate the device list from that. Hard coded lists of devices that you have to maintain is just plain stupid, especially when that is the purpose of fstab in the first place!
Dusty
Offline
Hard coded lists of devices that you have to maintain is just plain stupid, especially when that is the purpose of fstab in the first place!
Fstab doesn't mount a device if the hardware is not plugged in at booting e.g. CD in cdrom or thumb drive in USB port. Do you have an advice how to do?
Markku
Offline
CD in cdrom or thumb drive in USB port. Or do you have an advice how to do?
note I said fstab, not mtab. Both my CDROM and my USB drive are listed in fstab:
/dev/hda /mnt/cd auto ro,user,noauto,unhide 0 0
/dev/sdc1 /mnt/palm vfat user,noauto 0 0
So what I was suggesting was rather than trying to 'guess' which devices might be plugged in from some hardcoded list of devices you might include in your code, read the fstab file to grab the above lines. Perhaps everything with a 'noauto' in it is something you would want to look for.
Unfortunately, even this might not be enough for all devices, since new automounting stuff may or may not use fstab entries (I have no idea one way or the other).
HTH,
Dusty
Offline
.. read the fstab file to grab the above lines. Perhaps everything with a 'noauto' in it is something you would want to look for.
I was also thinking in this line using fstab when noticing mtab is not the place. Thanks for confirming. I will study how fstab works.
EDIT:
Using fstab was an exellant solution. First time in my "linux history" got a mounting what works. 8) ... first click mount, second umount with "<b>mount $0 || umount $0</b>".
Partial copy of the startup script: "MountMenu-Functions"
# First a mount/unmount function
# used in the file MenuMount generated by Mount.sh
DestroyFunc ToggleMount
AddToFunc ToggleMount
+ I PipeRead 'mount $0 || umount $0'
+ I Exec exec $[USERDIR]/etc/rc.s/MountMenu.sh
+ I Read $[USERDIR]/tmp/MenuMount
MountMenu.conf (for user configure)
#Config:MountMenu.conf
#
floppy=`grep -c fl < /etc/fstab`
cdrom=`grep -c cd < /etc/fstab`
dvd=`grep -c dvd < /etc/fstab`
removable=`grep -c sda < /etc/fstab`
multimedia=`grep -c sdc < /etc/fstab`
mp3player=`grep -c mp3 < /etc/fstab`
digital_camera=`grep -c digital < /etc/fstab`
document=`grep -c doc < /etc/fstab`
Mountmenu.sh (the engine)
#!/bin/bash
# Scripts:Mountmenu.sh
# Original from Fvwm Forums by bricem13
# URL: http://fvwm.lair.be/viewtopic.php?t=527
# Edited by Rasat <rasat@user-contributions.org>
# Date: 7-Jan-2006
#
. $HOME/.fvwm/archwd-user/etc/conf.d/MountMenu.conf
TMP="$HOME/.fvwm/archwd-user/tmp"
[ -e $TMP/MenuMount ] && rm $TMP/MenuMount
case $floppy in
1)
echo '+ "Floppy" Function ToggleMount /mnt/fl*' >> $TMP/MenuMount
;;
esac
case $cdrom in
1)
echo '+ "Cdrom" Function ToggleMount /mnt/cd*' >> $TMP/MenuMount
;;
esac
case $dvd in
1)
echo '+ "Dvd" Function ToggleMount /mnt/dvd' >> $TMP/MenuMount
;;
esac
case $removable in
1)
echo '+ "Removable" Function ToggleMount /mnt/usb' >> $TMP/MenuMount
;;
esac
case $multimedia in
1)
echo '+ "Multimedia" Function ToggleMount /mnt/multi*' >> $TMP/MenuMount
;;
esac
case $mp3player in
1)
echo '+ "Mp3player" Function ToggleMount /mnt/mp3*' >> $TMP/MenuMount
;;
esac
case $digital_camera in
1)
echo '+ "Digital camera" Function ToggleMount /mnt/digital*' >> $TMP/MenuMount
;;
esac
case $document in
1)
echo '+ "Document" Function ToggleMount /mnt/doc*' >> $TMP/MenuMount
;;
esac
Markku
Offline
Markku
Offline
Pages: 1