# MoPi: Mobile Power for the Raspberry Pi

## paul_chany

Hi,

I just want to ask a question about installing simbamond software on Gentoo Linux system.

I have a Raspberry Pi 2 Model. On it Gentoo Linux, and a Moodle system are running.

I wish to get this MoPi to serve as UPS for my RPi.

Only do not know how can one install the simbamond debian package here, on Gentoo Linux?

I ask the question:

"Can I expect a simbamond daemon which is running on a Gentoo linux too?"

the developers, but get an answer:

"There's nothing very debian-specific in the package -- I'd just google "installing .deb on gentoo" and see where that gets you?

best"

So, what can I do to achieve my goal with simbamond?

----------

## NeddySeagoon

paul_chany,

Fetch the source from git then build and install by hand.

When you do that, software should really install to /usr/local.

This package won't do that, which is a bad thing.  You might want to modify the makefile.

----------

## paul_chany

 *NeddySeagoon wrote:*   

> paul_chany,
> 
> Fetch the source from git then build and install by hand.
> 
> When you do that, software should really install to /usr/local.
> ...

 

I have now the MoPi hardware at my hands.   :Very Happy: 

I am willing to install this on to my Gentoo system now.

Here are few lines in makefile in simbamon directory:

```
VERSION=4.1

NEXT_SNAP=1

P=simbamond

D=simbamon

MOPI=mopi

MOPICLI=mopicli

MOPIAPI=mopiapi.py

PD=package/$(VERSION)

INSTALLED_FILES=\

  $(DESTDIR)/usr/sbin/$(D) \

  $(DESTDIR)/usr/sbin/$(MOPI) \

  $(DESTDIR)/usr/sbin/$(MOPICLI) \

  $(DESTDIR)/usr/sbin/$(MOPIAPI) \

  $(DESTDIR)/etc/init.d/$(P) \

  $(DESTDIR)/etc/default/$(P) \

  $(DESTDIR)/usr/share/man/man8/$(D).8.gz \

  $(DESTDIR)/usr/share/man/man8/$(P).8.gz \

  $(DESTDIR)/usr/share/man/man8/$(MOPI).8.gz \

  $(DESTDIR)/usr/share/man/man8/$(MOPICLI).8.gz \

  $(DESTDIR)/usr/share/man/man8/$(MOPIAPI).8.gz

```

How can I modify $(DESTDIR) variable?

----------

## NeddySeagoon

paul_chany,

DESTDIR looks like an environment variable. Its normally empty, so its default value is "" (the empty string)

Random example from your post. 

```
 $(DESTDIR)/usr/sbin/$(MOPI)
```

and we see that 

```
MOPI=mopi
```

Taken together that expands to /usr/sbin/mopi, which is what you might expect.

----------

## Hu

Since the package does respect DESTDIR, but does not provide an easy way to install to /usr/local, you could instead write an ebuild for it so that Portage can manage it when it is installed to /usr.

----------

## paul_chany

 *Hu wrote:*   

> Since the package does respect DESTDIR, but does not provide an easy way to install to /usr/local, you could instead write an ebuild for it so that Portage can manage it when it is installed to /usr.

 

I wish to write an ebuild for this, but have not enough spare time ( because I am a teacher and teaching they lost me a lot of my time ).

However I do not write any ebuild so far.. but if somehow find time for this then I will try to write it.

----------

## Hu

If you need help writing an ebuild, we can try to guide you.  If the installation is simple enough, someone might write the ebuild for you.

----------

## paul_chany

 *Hu wrote:*   

> If you need help writing an ebuild, we can try to guide you.  If the installation is simple enough, someone might write the ebuild for you.

 

OK

I'm reading now followings:

https://wiki.gentoo.org/wiki/Ebuild

https://wiki.gentoo.org/wiki/Basic_guide_to_write_Gentoo_Ebuilds

Please tell me how to start writing ebuild for simbamon, a Simple Battery Monitor daemon?

Eg. should it hase name like: app-misc/simbamon or sys-power/simbamon ?

So I am following the Gentoo Wiki Ebuild.

So far did followings:

```
mkdir -p /usr/local/portage/sys-power/simbamon

cd $_

cp /usr/portage/header.txt ./simbamon-1.0.ebuild

nano simbamon-1.0.ebuild
```

```
# Copyright 1999-2016 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Id$

EAPI=6

DESCRIPTION="a Simple Battery Monitor daemon for projects like Mobile Pi ( MoPi ) -- http://pi.gate.ac.uk/mopi"

SLOT="0"

HOMEPAGE="https://github.com/hamishcunningham/pi-tronics/tree/master/simbamon"

SRC_URI=""
```

```
ebuild simbamon-1.0.ebuild manifest clean merge
```

As you can see I do not know what to put in SRC_URI?

Because the simbamon code is a part of the pi-tronics and only pi-tronics is packaged into a ZIP archive:

https://github.com/hamishcunningham/pi-tronics/archive/master.zip

OK I get help on #gentoo channel and the ebuild looks like this:

/usr/local/portage/sys-power/simbamon/simbamon-1.0.ebuild

```
# Copyright 1999-2016 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Id$

EAPI=6

DESCRIPTION="a Simple Battery Monitor daemon for projects like Mobile Pi ( MoPi ) -- http://pi.gate.ac.uk/mopi"

SLOT="0"

SRC_URI=""

HOMEPAGE="https://github.com/hamishcunningham/pi-tronics/tree/master/simbamon"

EGIT_REPO_URI="https://github.com/hamishcunningham/pi-tronics/tree/master/simbamon"

LICENSE="GPL 3 or any later version ( unless otherwise stated ) ."

KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
```

I can install this ebuild with command:

```
ebuild simbamon-1.0.ebuild manifest clean merge
```

But, when I run it on a shell, I get this message:

 *Quote:*   

> /usr/local/usr/sbin/simbamon: line 22: /lib/lsb/init-functions: No such file or directory

 

So I get again help on #gentoo channel, but only that, that where to find about the /lib/lsb/init-funtions script.

Look here: http://www.linuxfromscratch.org/lfs/view/stable/scripts/apds02.html

From here I do not know how to proceed further?

----------

