Page 1 of 18 12311 ... LastLast
Results 1 to 10 of 177

Thread: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

  1. #1
    Join Date
    Jun 2006
    Location
    Germany
    Beans
    Hidden!
    Distro
    Edgy Eft Testing

    Howto: CDemu 0.8 for Edgy

    ATTENTION: THIS HOWTO IS SEVERLY OUTDATED. SEE THIS POST


    old Howto follows:

    Heya,

    Basicly, CDemu is a software that allows you to mount CD-images. 0.7 supported cue/bin, while the new 0.8 has support for:

    .cue (CDRWin)
    .iso (ISO9660)
    .mds (Alchol 120%)
    .ccd (CloneCD)
    .nrg (Nero Burning ROM)

    Sure, you can mount isos with a loop device and convert other images to iso, but that just sucks.
    Sadly, the new version needs a kernel >=2.6.16, so it won't work with Dapper unless you compiled your own newer kernel!
    Since you need Edgy or need to compile your own kernel, I'm assuming you have some basic knowledge of Linux. If not, feel free to post questions!
    Also feel free to post improvements or errors I made!

    We're going to set CDemu up. I also have some scripts to mount them from Nautilus with just a right-click.

    1. Get CDemu:
    http://prdownloads.sourceforge.net/c...mu-0.8.tar.bz2

    2. Extract it somewhere, open a console and cd to the directory you extracted it to

    3. Type make, this should compile CDemu - or not.
    If it complains about missing stuff, try searching Synaptic for packages that end with -dev and have parts of the name needed by make. Repeat 3.
    I would provide a package that can easily be installed, but CDemu seems to be the only app not working with checkinstall :/

    4. Type make install. This installs CDemu on your system. To uninstall it again, type make uninstall from this folder.

    5. CDemu doesn't like udev and the device-creation script supplied screws everything up. Type gksu gedit /usr/bin/create_cdemu_devs.sh and replace everything in that file with this:
    Code:
    #!/bin/bash
    
    #if [ -e /dev/.devfs ] ; then
    #	echo "You have devfs, nodes will be created automagically"
    #	exit 0
    #fi
    #if [ -e /dev/.udev ] || [ -e /dev/.udev.tdb ] ; then
    #	echo "You have udev, nodes will be created automagically"
    #	exit 0
    #fi
    #if [ ! -z "${DESTDIR}" ] ; then
    #	echo "Creating a package, nodes should be created later"
    #	exit 0
    #fi
    
    # find out cdemu device major number
    if [ ! -r /proc/devices ]; then
    	echo "Can't open /proc/devices, make sure /proc is mounted"
    	exit 0
    fi
    
    modprobe cdemu
    if [ -z "$(lsmod | grep ^cdemu)" ]; then
    	echo "Can't load module"
    	exit 0
    fi
    cdemumajor=$(grep "^[[:space:]]*[0-9]\+[[:space:]]\+cdemu$" /proc/devices | grep -o "[0-9]\+")
    if [ -z "$cdemumajor" ]; then
    	echo "Can't find cdemu device number in /proc/devices"
    	exit 0
    fi
    #modprobe -r cdemu
    #
    
    if [ -e /dev/cdemu ]; then
    	rm -rf /dev/cdemu
    fi
    if [ -b /dev/cdemu0 ]; then
    	rm -f /dev/cdemu*
    fi
    mkdir /dev/cdemu
    for drivenumber in `seq -w 0 7` ; do
    	mknod /dev/cdemu/${drivenumber} b ${cdemumajor} ${drivenumber}
    done
    
    #echo "if no error did show up device files created ;-)"
    Save the file and exit. This step is important. If you don't edit this file, the CDEMU module will be unloaded every time the file gets executed!

    Now type gksu gedit /etc/rc.local and add this to the bottom of the file but before any "exit 0" you may encounter:
    Code:
    echo " Creating CDemu devices..."
    create_cdemu_devs.sh
    Save and exit. This will make your system create all the devices at startup.

    6. Activate CDemu for a test run. Type sudo create_cdemu_devs.sh to create the devices and load the kernel module.
    If no errors showed up, everything is fine.
    You don't need to do this everytime you want to mount an image, just this time.
    Get this file and extract it somewhere.
    then type cdemu 0 /path/to/file/mini.cue followed by a sudo mkdir /media/cdemu0 and sudo mount -t iso9660 -o ro /dev/cdemu/0 /media/cdemu0
    This should mount the test file to /media/cdemu0. If this works, move on.

    Information about mounting images with CDemu in text mode will appear when typing cdemu in console. Basicly, it's cdemu X /path/to/image to load an image into cdemu-drive X, whereas X is 0-7. It will be loaded into the device /dev/cdemu/X ready to be mounted. To unload the image (after unmounting first), type cdemu -u X


    7. If you want to be able to mount images without root rights, do this:
    Code:
    sudo mkdir /media/cdemu0
    sudo mkdir /media/cdemu1
    sudo mkdir /media/cdemu2
    sudo mkdir /media/cdemu3
    sudo mkdir /media/cdemu4
    sudo mkdir /media/cdemu5
    sudo mkdir /media/cdemu6
    sudo mkdir /media/cdemu7
    Then do gksu gedit /etc/fstab and add this to the end of the file:
    Code:
    /dev/cdemu/0	/media/cdemu0	iso9660		ro,user,noauto			0	0
    /dev/cdemu/1	/media/cdemu1	iso9660		ro,user,noauto			0	0
    /dev/cdemu/2	/media/cdemu2	iso9660		ro,user,noauto			0	0
    /dev/cdemu/3	/media/cdemu3	iso9660		ro,user,noauto			0	0
    /dev/cdemu/4	/media/cdemu4	iso9660		ro,user,noauto			0	0
    /dev/cdemu/5	/media/cdemu5	iso9660		ro,user,noauto			0	0
    /dev/cdemu/6	/media/cdemu6	iso9660		ro,user,noauto			0	0
    /dev/cdemu/7	/media/cdemu7	iso9660		ro,user,noauto			0	0
    Now, after loading the image into CDemu, you just need to do a mount /media/cdemuX to mount the corresponding drive.

    8. If you want to be able to mount images in Gnome's Nautilus with just a few clicks, create 2 files in /home/*USER*/.gnome2/nautilus-scripts

    cd-mount:
    Code:
    #!/bin/bash
    # Mount CD images
    
    # Get filename extension and make it lower-case
    EXT=`echo $1 | sed -e 's/.*\.//'`
    EXT_LOW=`echo $EXT | tr 'A-Z' 'a-z'`
    
    # Main
    if [ $EXT_LOW == "cue" -o $EXT_LOW == "iso" -o $EXT_LOW == "mds" -o $EXT_LOW == "ccd" -o $EXT_LOW == "nrg" ]; then
    	
    # Find a free DEV to mount
    	DEV=$((`cdemu -s | cut -f 8 -d " " | grep 0 -n -m 1 | cut -c 1`-2))
    	if [ $DEV -lt "0" ]; then
    		zenity --info --text "You can not mount any more images."; exit 1
    	fi
    
    # Only allow mounting an image once
    	MOUNTED="`cdemu -s | grep "$1" | cut -f11- -d " "`"
    	DEVMOUNTED="`cdemu -s | grep "$1" | cut -f3 -d " " | sed -e 's@:@@'`"
    	if [ "$MOUNTED" == "$1" ]; then
    		zenity --info --text "Image already mounted on cdemu$DEVMOUNTED."; exit 1
    	fi
    
    # DEV needs to be between 0 and 7
    	if [ $DEV -ge "0" -a $DEV -le "7" ]; then
    		cdemu $DEV "$1" &&
    		mount "/media/cdemu${DEV}" &&
    		gnome-open "/media/cdemu${DEV}"
    	fi
    
    # If directory is empty, then release cdemu
    	sleep 0.5
    	if [ "$(ls -A /media/cdemu${DEV})" ]; then
    		echo
    		else umount "/media/cdemu${DEV}"
    		cdemu -u $DEV
    		zenity --info --text "Mount failed."; exit 1
    	fi
    
    else zenity --info --text "Selected file is no image."; exit 1
    fi
    cd-unmount:
    Code:
    #!/bin/bash
    # Unmount CD images
    
    # Get filename extension and make it lower-case
    EXT=`echo $1 | sed -e 's/.*\.//'`
    EXT_LOW=`echo $EXT | tr 'A-Z' 'a-z'`
    
    # Main
    if [ $EXT_LOW == "cue" -o $EXT_LOW == "iso" -o $EXT_LOW == "mds" -o $EXT_LOW == "ccd" -o $EXT_LOW == "nrg" ]; then
    	
    # Get the cdemu device-number and filename
    	DEV="`cdemu -s | grep "$1" | cut -f3 -d " " | sed -e 's@:@@'`"
    	MOUNTED="`cdemu -s | grep "$1" | cut -f11- -d " "`"
    
    # Check if mounted
    	if [ "$MOUNTED" == "$1" ]; then
    		umount /media/"cdemu${DEV}"
    		if [ $DEV -ge "0" -a $DEV -le "7" ]; then
    			cdemu -u $DEV
    		fi
    		sleep 0.5
    		if [ "$(ls -A /media/cdemu${DEV})" ]; then
    			zenity --info --text "Unmount failed. Is device busy?"; exit 1
    			else zenity --info --text "Image unmounted."; exit 0
    		fi
    	else zenity --info --text "Image does not appear to be mounted."; exit 1
    	fi
    
    else zenity --info --text "Selected file is no image."; exit 1
    fi
    And if you like to be able to create cue-sheets from files missing one:
    create-cuesheet
    Code:
    #!/bin/bash
    # Create CUE for BIN
    
    # Isolate the filename without the extension.
    BASE=`echo "$1" | sed 's/\.[^.]*$//'` 
    
    cat << EOF > "${BASE}.cue"
    FILE "$1" BINARY
      TRACK 01 MODE1/2352
        INDEX 01 00:00:00
    EOF
    Make all 2/3 files executable! Now right click onto a CD-image in Nautilus, select Scripts and select cd-mount or cd-unmount. Easier than Daemon Tools!

    Credits for about half of the script and a few "templates" I worked from goes to adamkane. I wouldn't have been able to pull this off without using his scripts.

    Bugs/Todo:
    - fixed -- Mounting the same image 2 times renders you unable to unmount them again with those scripts. I'm gonna fix this later. -- fixed
    - fixed -- Unmount didn't work for files with spaces -- fixed
    - Make a working deb-package.
    - .cue files that point to uppercase files which are lowercase in reality won't work and vice versa. You can just open the cuesheet in a text-editor to correct that.

    Have fun!
    Last edited by HAARP; October 2nd, 2008 at 11:53 PM. Reason: Bugfix, typo, more bugfixes

  2. #2
    Join Date
    Nov 2005
    Location
    Poland
    Beans
    202

    Re: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

    thanks for the howto, it's working here

  3. #3
    Join Date
    Oct 2006
    Beans
    1

    Re: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

    Ooooh!!! It's holy great info!!! thanks fot the tip!!

  4. #4
    Join Date
    Jun 2006
    Location
    Germany
    Beans
    Hidden!
    Distro
    Edgy Eft Testing

    Re: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

    Glad its working for you (:

  5. #5
    Join Date
    Nov 2005
    Location
    Grønhøj, Denmark
    Beans
    41
    Distro
    Ubuntu 6.10 Edgy

    Unhappy Re: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

    Hi, I think I might have screwed things up. This is the error I get:

    morten@morten-desktop:~/source/cdemu-0.8$ cdemu 0 /home/morten/Desktop/cdemu_example/mini.cue
    Traceback (most recent call last):
    File "/usr/bin/cdemu", line 132, in ?
    main()
    File "/usr/bin/cdemu", line 124, in main
    device = libcdemu.get_device_from_drive_number(args[0])
    File "/usr/lib/python2.4/site-packages/libcdemu.py", line 755, in get_device_from_drive_number
    raise CDEmu_Error, "Do you have cdemu module loaded? - could't find block device. If you've no devfs/udev make sure you created them."
    libcdemu.CDEmu_Error: Do you have cdemu module loaded? - could't find block device. If you've no devfs/udev make sure you created them.
    Any help greatly appreciated!!!

  6. #6
    Join Date
    Jun 2006
    Location
    Germany
    Beans
    Hidden!
    Distro
    Edgy Eft Testing

    Re: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

    Try executing sudo create_cdemu_devs.sh

  7. #7
    Join Date
    Nov 2005
    Location
    Grønhøj, Denmark
    Beans
    41
    Distro
    Ubuntu 6.10 Edgy

    Re: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

    thanks for your reply, but this doesn't help. The script executes fine, but I get the same errors afterwards.

    I think this might have something to do with an earlier version of cdemu that has been installed.

    Is there anyway to remove every trace of cdemu - including older versions?

    thanks!!!

  8. #8
    Join Date
    Jun 2006
    Location
    Germany
    Beans
    Hidden!
    Distro
    Edgy Eft Testing

    Re: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

    Go to the cdemu directory and type sudo make uninstall

    It seems the kernel moduel isn't being loaded, however it should load after you execute create-devs.
    What does sudo modprobe cdmeu do?

  9. #9
    Join Date
    Nov 2005
    Location
    Grønhøj, Denmark
    Beans
    41
    Distro
    Ubuntu 6.10 Edgy

    Re: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

    thank you so much - that did the job.
    and thanks so much for these wonderful scripts

  10. #10
    Join Date
    Sep 2006
    Location
    Alabama, USA
    Beans
    46
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Howto: CDemu 0.8 for kernel 2.6.16+ (Edgy)

    Hmm.. having a problem that I didn't have when on Dapper.

    bash: make: command not found

    When in the cdemu directory. Any help with this?


    Edit: Nevermind, just needed the build-essential package.
    I do, however, get this error now when trying to make:

    Code:
    Makefile:31: *** You'll need sources for your (at least 2.6.16) kernel.  Stop.
    Not really sure what that means. I have upgraded to Edgy, and from what I see, I don't have the 2.6.16 kernel. Do I need to re-compile my kernel?
    Last edited by Somniis; October 23rd, 2006 at 11:14 PM.
    Love is like a flower, even the most beautiful kind dies. - Till Lindemann

    Ubuntu#9198

Page 1 of 18 12311 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •