# Creating a local Overlay

## FelixPetzold

Why a local Overlay?

If you only want to put one ebuild into your Portage tree and do not want to add a complete Overlay (like Sabayon, Gnome or KDE), this is your way. By using a local Overlay you can keep your stable Gentoo clean and have some unstable Packages from Overlays as well.

Creation

```
sudo mkdir -p /usr/local/portage/overlay

sudo chown portage:portage /usr/local/portage/overlay
```

Now go to http://gpo.zugaina.org/ and search for the ebuild you want to add to your Portage tree. Download something like "foo.ebuild". The ending .ebuild is important. For foo you now have to create the folders "category" and "foo" inside "category"

```
sudo mkdir -p /usr/local/portage/overlay/category/foo

sudo cp /home/felix/Downloads/foo-2.1.0.47.ebuild /usr/local/portage/overlay/category/foo/

sudo chown -R portage:portage /usr/local/portage/overlay/*
```

Now you have to create the manifest for this ebuild.

```
sudo ebuild /usr/local/portage/overlay/category/foo/foo-2.1.0.47.ebuild manifest
```

Last thing is to tell Portage that you have a local Overlay. Add the following to your /etc/make.conf:

```
PORTDIR_OVERLAY="/usr/local/portage/overlay/"
```

To give your local Overlay a name do following:

```
mkdir -p /usr/local/portage/overlay/profiles

touch /usr/local/portage/overlay/profiles/repo_name

echo "my_overlay_name" >> /usr/local/portage/overlay/profiles/repo_name
```

The foo version I used as an example is a stable one. If you add unstable ebuilds to your Portage tree, you have to unmask them in /etc/portage/package.unmask. 

If your ebuild has dependencies that can not be resolved with the offical Portage tree, you have to add them to your local overlay as well.Last edited by FelixPetzold on Mon May 10, 2010 5:49 pm; edited 3 times in total

----------

## avx

 *Quote:*   

> Als letztes müssen wir Portage nun noch sagen, dass es ein Overlay gibt, dass benutzt werden soll. Dazu fügen wir folgendes in die /etc/make.conf ein:

 Nice german/english mix  :Wink: 

Mh, why are you posting this, it's not witchcraft and it's in the docs?! Besides 

```
ebuild foo.ebuild digest
```

 is deprecated, use 

```
ebuild foo.ebuild manifest
```

instead.

----------

## FelixPetzold

sorry. will remove the german. I copied it from my post in a german forum, because I reference from the update script to it.

----------

## slackline

Why not write it up  in the Unofficial Gentoo Wiki

----------

## publiosulpicio

Does eix automatically see the new overlay? I don't think so, but for sure it is possible to do something. Does anybody know how to do this?

----------

## mv

 *publiosulpicio wrote:*   

> Does eix automatically see the new overlay?

 

Yes, after eix-update (if you have set PORTDIR_OVERLAY appropriately). Concerning speed of eix-update, you might want to have a look at the description of the CACHE_METHOD and related variables in the eix manpage.

----------

## OPelerin

Nice page.

Quick question. How can I force one of my ebuild to download the source file from a specific server?

I've tried

```

BASE_URI="http://server/source.tar.bz2"

SRC_URI="http://server/source.tar.bz2"

```

But every time, it tries to download that file via the mirrors servers [ which obviously is not working]. Any pointers?

----------

## OPelerin

Nevermind - I've found the answer by looking at the virtualbox-bin ebuild

added RESTRICT="mirror" and it has fixed my issue

----------

## soparla

This is a bit older article, try:

https://wiki.gentoo.org/wiki/Custom_repository

----------

