# Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ # The most current version has a "-a" at the end, which screws up Portage if # it's included in the file name, so we'll just fudge it here. MY_P="${P}-a" MY_KV="`echo $KV | sed 's/[^0-9.].*//'`" DESCRIPTION="A file system for Linux systems that exports all tracks and boot images on a CD as normal files." HOMEPAGE="http://www.elis.rug.ac.be/~ronsse/cdfs/" SRC_URI="http://www.elis.rug.ac.be/~ronsse/cdfs/download/${MY_P}.tar.bz2" LICENSE="GPL-2" SLOT="${KV}" KEYWORDS="~x86" IUSE="" DEPEND="virtual/kernel" #RDEPEND="" S=${WORKDIR}/${MY_P} pkg_setup () { # Check to see if we are in sync with kernel version. if [ ${MY_KV} != ${PV} ] then eerror eerror "Portage detected kernel version ${MY_KV} on this system." eerror "This module is intended for a $PV kernel only!!!" eerror die fi # Check to see if cdfs.o is inserted into kernel, otherwise, build fails if [ "`lsmod | sed '/^cdfs/!d'`" ] then eerror eerror "Module is in use by the kernel!!!" eerror "Attempting to unload..." # Checking if mounted (seem to load automatic at mount)... M_P="`sed '/cdfs/!d;s/[^ ]*\ //;s/\ cdfs.*//' /etc/mtab`" if [ "$M_P" ] then # Unmounting eerror eerror " cdfs filesystem mounted at $M_P!!!" eerror " Attempting to unmount..." umount ${M_P} 2>/dev/null || ( eerror " Failed! Please unmount $M_P manually and emerge again." eerror exit 1 ) || die einfo " Succesfuly unmounted $M_P..." eerror fi # Unloading module... rmmod cdfs 2>/dev/null || ( eerror "Failed to unload modules from kernel!!!" eerror "Please manualy remove the module from the kernel and emerge again." eerror exit 1 ) || die einfo "Successfuly removed module from memory. Resuming emerge." einfo fi } src_unpack() { # Something inside portage sets $O for some reason, this screws up # the build. Fortunately it looks like Makefile.in really shouldn't # have been using it to begin with. unpack ${A} cd ${S} sed -i -e 's/$(O)//' Makefile.in } src_compile() { econf || die emake || die } src_install() { # The driver goes in the standarn modules location insinto /lib/modules/${KV}/kernel/fs/cdfs # make DESTDIR=${D} install || die doins cdfs.o dodoc CHANGES COPYING INSTALL } pkg_postinst() { # ebegin "Running depmod -a" # depmod -a && eend 0 || eend 1 einfo "Module name is cdfs.o, located in /lib/modules/${KV}/fs/cdfs" einfo "To use it, simply do \"insmod cdfs\"" einfo "Optionaly, you can add it into your kernel's /etc/modules.autoload.d file" einfo "so it get loaded automatically at each boot." einfo "Read the /usr/share/doc/cdfs/INSTALL for options." einfo "One's can put this into the fstab so all users can read audio files:" einfo einfo " # " einfo " /dev/cdroms/cdrom0 /mnt/cda cdfs noauto,ro,users 0 0" einfo einfo "You will need to re-emerge the package each time you will rebuild your" einfo "kernel modules with \"make modules_install\" (just like alsa and nvidia)" einfo }