Merge pull request #243 from szarkos/azure-debian

Updates for building Debian images for Azure
This commit is contained in:
Anders Ingemann 2015-08-25 08:42:23 +02:00
commit 0091afcfb4
5 changed files with 35 additions and 14 deletions

View file

@ -5,6 +5,7 @@ import tasks.image
from bootstrapvz.common.tasks import loopback
from bootstrapvz.common.tasks import initd
from bootstrapvz.common.tasks import ssh
from bootstrapvz.common.tasks import apt
def validate_manifest(data, validator, error):
@ -15,7 +16,8 @@ def validate_manifest(data, validator, error):
def resolve_tasks(taskset, manifest):
taskset.update(task_groups.get_standard_groups(manifest))
taskset.update([tasks.packages.DefaultPackages,
taskset.update([apt.AddBackports,
tasks.packages.DefaultPackages,
loopback.AddRequiredCommands,
loopback.Create,
initd.InstallInitScripts,

View file

@ -15,19 +15,22 @@ class PatchUdev(Task):
from bootstrapvz.common.tools import log_check_call
from . import assets
# c.f. http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=61e055638cea
with open(os.path.join(assets, 'udev.diff')) as diff_file:
udev_dir = os.path.join(info.root, 'usr/share/initramfs-tools/scripts/init-top')
log_check_call(['patch', '--no-backup-if-mismatch', '-p6', '-d' + udev_dir], stdin=diff_file)
udev_file = os.path.join(info.root, 'usr/share/initramfs-tools/scripts/init-top/udev')
diff_file = os.path.join(assets, 'udev.diff')
log_check_call(['patch', '--no-backup-if-mismatch', udev_file, diff_file])
class ConfigureGrub(Task):
description = 'Change grub configuration to allow for ttyS0 output'
phase = phases.system_modification
predecessors = [grub.ConfigureGrub]
successors = [grub.InstallGrub_1_99, grub.InstallGrub_2]
@classmethod
def run(cls, info):
from bootstrapvz.common.tools import sed_i
grub_config = os.path.join(info.root, 'etc/default/grub')
sed_i(grub_config, r'^(GRUB_CMDLINE_LINUX*=".*)"\s*$', r'\1console=ttyS0 earlyprintk=ttyS0 rootdelay=300"')
sed_i(grub_config, r'^.*(GRUB_TIMEOUT=).*$', r'GRUB_TIMEOUT=0')
sed_i(grub_config, r'^(GRUB_CMDLINE_LINUX_DEFAULT=.*)', r'GRUB_CMDLINE_LINUX_DEFAULT=""')
sed_i(grub_config, r'^(GRUB_CMDLINE_LINUX*=".*)"\s*$', r'\1console=tty0 console=ttyS0,115200n8 earlyprintk=ttyS0,115200 rootdelay=300"')
sed_i(grub_config, r'^(GRUB_HIDDEN_TIMEOUT=).*', r'#GRUB_HIDDEN_TIMEOUT=true')
sed_i(grub_config, r'^.*(GRUB_TIMEOUT=).*$', r'GRUB_TIMEOUT=5')

View file

@ -47,3 +47,9 @@ class Waagent(Task):
if os.path.isfile(info.manifest.provider['waagent']['conf']):
log_check_call(['cp', info.manifest.provider['waagent']['conf'],
os.path.join(info.root, 'etc/waagent.conf')])
# The Azure Linux agent uses 'useradd' to add users, but SHELL
# is set to /bin/sh by default. Set this to /bin/bash instead.
from bootstrapvz.common.tools import sed_i
useradd_config = os.path.join(info.root, 'etc/default/useradd')
sed_i(useradd_config, r'^(SHELL=.*)', r'SHELL=/bin/bash')

View file

@ -2,7 +2,7 @@
provider:
name: azure
waagent:
version: 2.0.13
version: 2.0.14
bootstrapper:
mirror: http://httpredir.debian.org/debian/
workspace: /target
@ -23,7 +23,11 @@ volume:
root:
filesystem: ext4
size: 10GiB
packages: {}
packages:
components:
- main
- contrib
- non-free
plugins:
ntp:
servers:

View file

@ -2,7 +2,7 @@
provider:
name: azure
waagent:
version: 2.0.4
version: 2.0.14
bootstrapper:
mirror: http://httpredir.debian.org/debian/
workspace: /target
@ -20,13 +20,19 @@ volume:
backing: raw
partitions:
type: msdos
boot:
filesystem: ext2
size: 32MiB
root:
filesystem: ext4
size: 7GiB
packages: {}
size: 10GiB
packages:
components:
- main
- contrib
- non-free
preferences:
backport-kernel:
- package: linux-image-* initramfs-tools
pin: release n=wheezy-backports
pin-priority: 500
plugins:
ntp:
servers: