# Debian Multi Repo

This setup is meant for those who need packages from non-stable Debian repositories. This should only be done as a **last resort**.

We've included these documents for our more advanced users, integrators and others who are working on more experimental and advanced Lollipop Cloud deployments.

If you weren't linked here via other documentation or aren't sure if you need this. You don't.

## Inspiration / Further Reading

- [https://serverfault.com/questions/22414/how-can-i-run-debian-stable-but-install-some-packages-from-testing](https://serverfault.com/questions/22414/how-can-i-run-debian-stable-but-install-some-packages-from-testing)

# Setup Apt preferences

For stable, testing, unstable, experiemental with weights that prioritize more stable apt repos.

``` bash

cat > /etc/apt/preferences.d/stable.pref <<EOF
# 500 <= P < 990: causes a version to be installed unless there is a
# version available belonging to the target release or the installed
# version is more recent

Package: *
Pin: release a=stable
Pin-Priority: 900
EOF

cat > /etc/apt/preferences.d/testing.pref <<EOF
# 100 <= P < 500: causes a version to be installed unless there is a
# version available belonging to some other distribution or the installed
# version is more recent

Package: *
Pin: release a=testing
Pin-Priority: 400
EOF

cat > /etc/apt/preferences.d/unstable.pref <<EOF
# 0 < P < 100: causes a version to be installed only if there is no
# installed version of the package

Package: *
Pin: release a=unstable
Pin-Priority: 50
EOF

cat > /etc/apt/preferences.d/experimental.pref <<EOF
# 0 < P < 100: causes a version to be installed only if there is no
# installed version of the package

Package: *
Pin: release a=experimental
Pin-Priority: 1
EOF

```

# Reset Original Apt Sources

You'll want to verify ```/etc/apt/sources.list``` doesn't contain anything important or useful prior to moving it out of the way.

``` bash

mv /etc/apt/sources.list /etc/apt/sources.list.orig

```

# Setup New Apt Lists

``` bash 

cat > /etc/apt/sources.list.d/stretch.list <<EOF
deb http://httpredir.debian.org/debian stretch main contrib non-free
deb http://httpredir.debian.org/debian stretch-updates main contrib non-free
deb http://security.debian.org/ stretch/updates main contrib non-free
EOF

cat > /etc/apt/sources.list.d/testing.list <<EOF
deb http://httpredir.debian.org/debian testing main contrib non-free
EOF

cat > /etc/apt/sources.list.d/unstable.list <<EOF
deb http://httpredir.debian.org/debian unstable main contrib non-free
EOF

cat > /etc/apt/sources.list.d/experimental.list <<EOF
deb http://httpredir.debian.org/debian experimental main contrib non-free
EOF

```

# Setup Apt to default tree

Default to stable

``` bash

cat > /etc/apt/apt.conf.d/99defaultrelease <<EOF
APT::Default-Release "stable";
EOF

```

# Update Apt

Last step: update the apt repos to include the changes

``` bash

apt-get update

```
