LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] a first pass at a virtual cd jukebox...

[ILUG] a first pass at a virtual cd jukebox...

kevin lyda kevin at ie.suberic.net
Mon Sep 19 23:46:53 IST 2005


ok, i have a series of cd images that i'd like to be able to access.
however mounting them by hand is a pain in the arse.  so i configured
automount to do it for me.  the steps i took are as follows:

first, i installed autofs.  on ubuntu this can be done via

    apt-get autofs

i added this line to /etc/auto.master:

    /.jukebox /etc/auto.jukebox --timeout=60

this goes into /etc/auto.jukebox:

    #!/bin/sh

    key=$1
    opts="-fstype=iso9660,ro,nosuid,nodev,loop"
    juke=/jukebox
    duke=/.jukebox
    cdroms=/var/cdroms

    if [ x"$key" = x-link ]; then
        if [ ! -d $juke ]; then
            mkdir $juke
            ln -s $duke/-link $juke/-link
        fi
        find $cdroms -type f -name '*.iso' -maxdepth 1 | \
            sed "s-$cdroms"'/--;s/.iso$//' | \
            xargs -i \
                sh -c "rm -f $juke/{}; ln -s $duke/{} $juke/{}" \
            > /dev/null
        exit 1
    else
        if [ -f $cdroms/$1.iso ]; then
            echo "$opts :$cdroms/$key.iso"
            exit 0
        else
            echo "auto.jukebox: $cdroms/$key.iso does not exist" >&2
            exit 2
        fi
    fi

note that an ls /.jukebox/-link will refresh the links in /jukebox.
done once an ls /jukebox/-link will also work.

the downside i see are that there are only 8 loop devices in the basic
install of ubuntu so an ls in /jukebox will generate a load of bad links.
so either autofs needs to cull links quicker or i need to boost the
number of loop devices (er, how?).  but it works for tabbing out, so i'm
happy with it.

on #linux there were some other suggestions.  the --ghost option and the
use of hotplug.  perhaps more detail on those ideas might be handy to
others?

kevin

-- 
Kevin Lyda        -=-=-=-=-=-         Who do you have to blow to get a
kevin at ie.suberic.net     -=-=-=-      president impeached around here?!



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell