add mirror attribute

This commit is contained in:
Olivier Sallou 2013-07-10 15:43:39 +02:00
parent f9fafe71fb
commit 17876070a5
4 changed files with 13 additions and 4 deletions

View file

@ -30,7 +30,8 @@
},
"timezone": { "type": "string" },
"locale": { "type": "string" },
"charmap": { "type": "string" }
"charmap": { "type": "string" },
"mirror": { "type": "string" }
},
"required": ["release", "architecture", "timezone", "locale", "charmap"]
},

View file

@ -41,7 +41,8 @@ def tasks(tasklist, manifest):
locale.SetTimezone(),
apt.DisableDaemonAutostart(),
apt.AptSources(),
apt.AptUpgrade(),
#No network for the moment, skip
#apt.AptUpgrade(),
boot.ConfigureGrub(),
filesystem.ModifyFstab(),
boot.BlackListModules(),

View file

@ -10,11 +10,14 @@ class AptSources(Task):
phase = phases.system_modification
def run(self, info):
mirror = 'http://http.debian.net/debian'
if info.manifest.system['mirror']:
mirror = info.manifest.system['mirror']
sources_path = os.path.join(info.root, 'etc/apt/sources.list')
with open(sources_path, 'w') as apt_sources:
apt_sources.write(('deb {apt_mirror} {release} main\n'
'deb-src {apt_mirror} {release} main\n'
.format(apt_mirror='http://http.debian.net/debian',
.format(apt_mirror=mirror,
release=info.manifest.system['release'])))
apt_sources.write(('deb {apt_mirror} {release}/updates main\n'
'deb-src {apt_mirror} {release}/updates main\n'

View file

@ -6,6 +6,10 @@ log = logging.getLogger(__name__)
def get_bootstrap_args(info):
mirror = 'http://http.debian.net/debian'
if info.manifest.system['mirror']:
mirror = info.manifest.system['mirror']
executable = ['/usr/sbin/debootstrap']
options = ['--arch=' + info.manifest.system['architecture']]
include, exclude = info.img_packages
@ -13,7 +17,7 @@ def get_bootstrap_args(info):
options.append('--include=' + ','.join(include))
if len(exclude) > 0:
options.append('--exclude=' + ','.join(exclude))
arguments = [info.manifest.system['release'], info.root, 'http://http.debian.net/debian']
arguments = [info.manifest.system['release'], info.root, mirror]
return executable, options, arguments