2011-05-31

Mount Xoom/Android filesystem while in debug mode under gentoo

Step 1: Create a local overlay if you don't have one.
(if you already have one, skip to step 2)
mkdir -p /usr/local/portage/myoverlay

in /etc/make.conf:
source /var/lib/layman/make.conf # should be there already from layman
PORTDIR_OVERLAY="/usr/local/portage/myoverlay $PORTDIR_OVERLAY"
... if you have layman installed or :
PORTDIR_OVERLAY="/usr/local/portage/myoverlay"


Step 2: Put this ebuild in your local overlay in sys-fs/mtpfs
cd /usr/local/portage/myoverlay
mkdir -p sys-fs/mtpfs
cd sys-fs/mtpfs

mtpfs-0.9.ebuild
# Copyright 1999-2009 Gentoo Foundation
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

DESCRIPTION="MTPFS is a Fuse filesystem based on libmtp"
HOMEPAGE="http://adebenham.com/mtpfs"
SRC_URI="http://adebenham.com/debian/mtpfs_${PV}.orig.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="debug"

DEPEND="sys-fs/fuse
      >=dev-libs/glib-2.18.4-r1
      media-libs/libmtp"
RDEPEND="${DEPEND}"

src_configure() {
   econf $(use_enable debug) || die 'econf failed'
}

src_compile() {
   emake || die 'emake failed'
}

src_unpack() {
    unpack ${A}
    mv ${P}.orig ${P}
}


src_install() {
   emake DESTDIR="${D}" install || die 'installation failed'
   dodoc AUTHORS INSTALL NEWS README ChangeLog
}

pkg_postinst() {
   einfo "To mount your MTP device, issue:"
   einfo " /usr/bin/mtpfs <mountpoint>"
   einfo
   einfo "To unmount your MTP device, issue:"
   einfo " /usr/bin/fusermount -u <mountpoint>"
} 
Step 3: Install it
ebuild mtpfs-0.9.ebuild digest
emerge mtpfs

Step 4: Mount and enjoy
Be sure your device is connected and in debug mode.
mkdir /mnt/xoom
mtpfs -o allow_other /mnt/xoom

Credits to thebytes, I merely improved what he was doing by fixing the ebuild from the original gentoo bugreport.