diff --git a/elements/debian-mirror/README.md b/elements/debian-mirror/README.md new file mode 100644 index 000000000..71d8ee75a --- /dev/null +++ b/elements/debian-mirror/README.md @@ -0,0 +1,20 @@ +Installs apt-mirror from packages. + +Please note that Debian or Ubuntu mirrors are very large -- a single +architecture of a single series is roughly 50GiB, and a full Ubuntu archive +is on the order of 600GiB -- so please keep in mind when you attach storage. + +Configuration +------------- + + debian-mirror: + mirror: "http://archive.ubuntu.com/ubuntu" + # The mirror you wish to mirror from. + suites: ["saucy", "saucy-updates", "saucy-security"] + # An array of suites you wish to mirror, such as `saucy' or `wheezy'. + architectures: [{"arch": "amd64"}] + # An array of dictionaries containing the architectures you wish to + # mirror. + components: ["main", "restricted", "universe", "multiverse"] + # An array of components you wish to mirror, such as `main' or + # `non-free'. diff --git a/elements/debian-mirror/element-deps b/elements/debian-mirror/element-deps new file mode 100644 index 000000000..b0a0c5d7d --- /dev/null +++ b/elements/debian-mirror/element-deps @@ -0,0 +1 @@ +os-apply-config diff --git a/elements/debian-mirror/install.d/82-debmirror b/elements/debian-mirror/install.d/82-debmirror new file mode 100755 index 000000000..cde2fed01 --- /dev/null +++ b/elements/debian-mirror/install.d/82-debmirror @@ -0,0 +1,7 @@ +#!/bin/bash + +set -eu + +install-packages apt-mirror + +sed -i -e 's/^#0/0/' -e 's&/var/spool/apt-mirror&/mnt/state/srv/apt-mirror&' /etc/cron.d/apt-mirror diff --git a/elements/debian-mirror/os-apply-config/etc/apt/mirror.list b/elements/debian-mirror/os-apply-config/etc/apt/mirror.list new file mode 100644 index 000000000..54d99c342 --- /dev/null +++ b/elements/debian-mirror/os-apply-config/etc/apt/mirror.list @@ -0,0 +1,17 @@ +set base_path /mnt/state/srv/apt-mirror +set mirror_path $base_path/mirror +set skel_path $base_path/skel +set var_path $base_path/var + +set nthreads 1 +set _autoclean 1 + +{{#debian-mirror}} +{{#architectures}} +{{#suites}} +deb-{{arch}} {{mirror}} {{.}} {{#components}}{{.}} {{/components}} +{{/suites}} +{{/architectures}} + +clean {{mirror}} +{{/debian-mirror}}