Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Creating ebuild for usbsrvd, not uninstalling correctly

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
2 posts • Page 1 of 1
Author
Message
VPN-User
n00b
n00b
Posts: 46
Joined: Thu Feb 03, 2005 12:52 am

Creating ebuild for usbsrvd, not uninstalling correctly

  • Quote

Post by VPN-User » Tue Oct 07, 2008 8:45 am

I am trying to create an ebuild for usbsrvd (USB Sharing via LAN). The package installs fine, but it does not uninstall the kernel module when unmerging and therefore produces a warning on next install that the file already exists. Here is what I have so far (initscript not done yet):

Code: Select all

# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit linux-mod

#MY_P=${PN/-ng/}-${PV}
S="${WORKDIR}"/usb-server

DESCRIPTION="Server-Side of USB Port Sharing Solution for Linux from INCENTIVES Pro"
HOMEPAGE="http://www.incentivespro.com/"
SRC_URI="http://incentivespro.com/usb-server.tar.gz"

LICENSE="|| ( GNU GPL-2 )"

SLOT="0"
KEYWORDS="x86"

RDEPEND=""

pkg_setup() {
    linux-mod_pkg_setup

    MODULE_NAMES='tusbd(tusbd:"${S}"/modules/src/tusbd)'

    BUILD_PARAMS="KERNELPATH=${KV_OUT_DIR}"
}

src_unpack() {
    unpack ${A}

    cd "${S}/modules/src/tusbd"
    convert_to_m Makefile
    sed -i 's:default:module:g' Makefile
}

src_install() {
    linux-mod_src_install

    dosbin "${S}/usbsrvd"
    dobin "${S}/usbsrv"
}

pkg_postinst() {
    local moddir="${ROOT}/lib/modules/${KV_FULL}/tusbd/"

    linux-mod_pkg_postinst
}
The error I get when re-merging:

Code: Select all

 * QA Notice: Pre-stripped files found:
 * /var/tmp/portage/media-gfx/usbsrvd-1.7.1/image/usr/bin/usbsrv
/var/tmp/portage/media-gfx/usbsrvd-1.7.1/image/usr/sbin/usbsrvd
strip: i686-pc-linux-gnu-strip --strip-unneeded -R .comment
   lib/modules/2.6.25-gentoo-r8/tusbd/tusbd.ko
* checking 3 files for package collisions
 * This package will overwrite one or more files that may belong to other
 * packages (see list below). Add "collision-protect" to FEATURES in
 * make.conf if you would like the merge to abort in cases like this. You
 * can use a command such as `portageq owners / <filename>` to identify
 * the installed package that owns a file. If portageq reports that only
 * one package owns a file then do NOT file a bug report. A bug report is
 * only useful if it identifies at least two or more packages that are
 * known to install the same file(s). If a collision occurs and you can
 * not explain where the file came from then you should simply ignore the
 * collision since there is not enough information to determine if a real
 * problem exists. Please do NOT file a bug report at
 * http://bugs.gentoo.org unless you report exactly which two packages
 * install the same file(s). Once again, please do NOT file a bug report
 * unless you have completely understood the above message.
 *
 * Detected file collision(s):
 *
 *      /lib/modules/2.6.25-gentoo-r8/tusbd/tusbd.ko
Top
VPN-User
n00b
n00b
Posts: 46
Joined: Thu Feb 03, 2005 12:52 am

  • Quote

Post by VPN-User » Tue Oct 07, 2008 4:05 pm

I'd really like to contribute this ebuild, eventually for addition to portage but I need your help. I've finished most of it so far, but still the kernel module does not get removed on uninstall of package. That causes warning on re-merge because of file-collision.

Here are the files:

usbsrvd-1.7.1.ebuild

Code: Select all

# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit linux-mod

#MY_P=${PN/-ng/}-${PV}
S="${WORKDIR}"/usb-server

DESCRIPTION="Server-Side of USB Port Sharing Solution for Linux from INCENTIVES Pro"
HOMEPAGE="http://www.incentivespro.com/"
SRC_URI="http://incentivespro.com/usb-server.tar.gz"

LICENSE="|| ( GNU GPL-2 )"

SLOT="0"
KEYWORDS="x86"

RDEPEND=""

pkg_setup() {
	linux-mod_pkg_setup

	MODULE_NAMES='tusbd(tusbd:"${S}"/modules/src/tusbd)'

	BUILD_PARAMS="KERNELPATH=${KV_OUT_DIR}"
}

src_unpack() {
	unpack ${A}

	cd "${S}/modules/src/tusbd"
	convert_to_m Makefile
	sed -i 's:default:module:g' Makefile
}

src_install() {
	linux-mod_src_install
	
	dosbin "${S}/usbsrvd"
	dobin "${S}/usbsrv"
	newinitd "${FILESDIR}"/usbsrvd.initd usbsrvd
}

pkg_postinst() {
	local moddir="${ROOT}/lib/modules/${KV_FULL}/tusbd/"

	linux-mod_pkg_postinst
}
files/usbsrvd.initd

Code: Select all

#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
    use net
}

start() {
	ebegin "Starting USB-Server"
	
	einfo "  Loading Driver Module"
	modprobe tusbd
	sleep 1

	einfo "  Starting usbsrvd"
	start-stop-daemon --start --exec /usr/sbin/usbsrvd \
	    --pidfile /var/run/usbsrvd.pid \
	    --
	eend $?
}

stop() {
	ebegin "Stopping USB-Server"

	einfo "  Stopping usbsrvd"
	start-stop-daemon --stop --exec /usr/sbin/usbsrvd \
	    --pidfile /var/run/usbsrvd.pid
	sleep 1

	einfo "  Unloading Driver Module"
        modprobe -r tusbd
	eend $?
}
Makefile of driver module (Original)

Code: Select all

DEBUG ?= n

obj-m := tusbd.o
tusbd-objs := usbdriver.o usbdcdev.o minor_control.o minor_device.o usbdevice.o fifo.o utils.o waitable_queue.o bind_unbind.o

KERNELDIR ?= /usr/src/linux
PWD:=$(shell pwd)

ifeq ($(DEBUG),y)
EXTRA_CFLAGS += -D_DEBUG_BUILD_
endif


default: 
	make -C $(KERNELDIR) M=$(PWD) modules
#	cp tusbd.ko ..
#	make clean
#	mv ../tusbd.ko ./

clean:
	make -C $(KERNELDIR) M=$(PWD) clean
My guess is that something is wrong with the way the makefile handles the fact that its kernel module (I had to modify the 'default' entry to 'module' in the ebuild to get portage compiling).

Any help appreciated. Otherwise, I'll stop here because the file works for me (despite the warning).[/quote]
Top
Post Reply

2 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic