Add a debian-mirror element

Add a new element that will set up and configure a Debian or Ubuntu
mirror. It will not populate the mirror during image creation, but
will do so after it is deployed.

Change-Id: Icf46015c8fd8a5b8cf18d0f8ceb99fe429e34f81
This commit is contained in:
Steve Kowalik 2014-01-20 14:41:30 +11:00
parent 09f6c4deb4
commit a27c0b69db
4 changed files with 45 additions and 0 deletions

View File

@ -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'.

View File

@ -0,0 +1 @@
os-apply-config

View File

@ -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

View File

@ -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}}