diff --git a/bootstrapvz/providers/azure/__init__.py b/bootstrapvz/providers/azure/__init__.py index 5081448..970a5db 100644 --- a/bootstrapvz/providers/azure/__init__.py +++ b/bootstrapvz/providers/azure/__init__.py @@ -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, diff --git a/bootstrapvz/providers/azure/tasks/boot.py b/bootstrapvz/providers/azure/tasks/boot.py index 1ec9f56..892a842 100644 --- a/bootstrapvz/providers/azure/tasks/boot.py +++ b/bootstrapvz/providers/azure/tasks/boot.py @@ -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') diff --git a/bootstrapvz/providers/azure/tasks/packages.py b/bootstrapvz/providers/azure/tasks/packages.py index e982185..2089404 100644 --- a/bootstrapvz/providers/azure/tasks/packages.py +++ b/bootstrapvz/providers/azure/tasks/packages.py @@ -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') diff --git a/manifests/examples/azure/jessie.yml b/manifests/examples/azure/jessie.yml index a06114b..43ee5f2 100644 --- a/manifests/examples/azure/jessie.yml +++ b/manifests/examples/azure/jessie.yml @@ -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: diff --git a/manifests/examples/azure/wheezy.yml b/manifests/examples/azure/wheezy.yml index 558d666..623265e 100644 --- a/manifests/examples/azure/wheezy.yml +++ b/manifests/examples/azure/wheezy.yml @@ -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: