dirty but fully functional card reader mounting script

Discussion in 'Linux' started by anso, Aug 23, 2008.

  1. anso

    anso

    Joined:
    Aug 3, 2008
    Messages:
    11
    Likes Received:
    0
    First of all sorry for my english, I'm spanish and i'll make many mistakes on my writing.

    What I did is a very dirty and simple script to mount my SDcard reader (expansion or multi, but not both at the same time) after suspending my AAO or just not having the card inside when booting.

    Please read each comment of the script to change values depending of your system or preferences.

    Firs of all make sure you have gksu installed on your system:
    Code:
    sudo apt-get install gksu
    then open a console and create the script with your favorite editor (nano in my case)
    Code:
    nano /home/username/mountcardreader
    now we'll paste the following script changing the values as comments suggest

    Code:
    #!/bin/bash
    
    setpci -d 197b:2381 AE=47
    
    device=`ls /dev/mmcblk* | grep -E *p1`
    
    ##change the mountpoint to your favorite path for the SD mount
    mpoint=/media/sdcard
    
    mkdir $mpoint
    
    ##if your sd's card file system is NTFS write ntfs-3g instead of vfat, for fat32 or fat16 don't edit.
    ##change the X on uid option to your UID number (see /etc/passwd to check it)
    mount -t vfat $device $mpoint -o uid=10XX
    
    
    Now open a menu entry on your desktop menu and create a option called as you want, with the following code to be executed: (ask me if you don't know how to do that)
    Code:
    gksu sh /home/username/mountcardreader
    Permission problems with UID parameter are solved, now just open the directory with your file browser and that's it!


    P.S. Checked that after several mounts (about 10) cardreader stops to be mounted
     
    anso, Aug 23, 2008
    #1
  2. anso

    qball

    Joined:
    Aug 14, 2008
    Messages:
    42
    Likes Received:
    0
    you can pass options to mount, telling it to mount it as user X .
    see man mount.
     
    qball, Aug 23, 2008
    #2
  3. anso

    anso

    Joined:
    Aug 3, 2008
    Messages:
    11
    Likes Received:
    0
    Ok thanks! found solution and editing
     
    anso, Aug 24, 2008
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.