From 155accb59941af9ced6fb8ba730dbe839857ff70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Fri, 11 Apr 2014 10:42:37 +0200 Subject: [PATCH] debian: support upstart on Wheezy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstart cannot be installed by debootstrap on Wheezy because of a conflict with sysvinit. sysvinit is flagged a being “essential” and apt-get will refuse to remove it. See: https://bugs.debian.org/668001 This patch uses another strategy. We install a standard sysvinit Debian chroot with debootstrap and during a second step, we replace sysvinit with the wanted init system. Change-Id: I081c81b2c32874fccf940c97b79054923c25b8c2 --- .../root.d/99-cleanup-debian-upstart | 3 --- elements/debian/root.d/08-debootstrap | 20 +++++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) delete mode 100755 elements/debian-upstart/root.d/99-cleanup-debian-upstart diff --git a/elements/debian-upstart/root.d/99-cleanup-debian-upstart b/elements/debian-upstart/root.d/99-cleanup-debian-upstart deleted file mode 100755 index cd029626f..000000000 --- a/elements/debian-upstart/root.d/99-cleanup-debian-upstart +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -eux -sudo rm -f ${TARGET_ROOT}/.distro-name ${TARGET_ROOT}/.extra-packages diff --git a/elements/debian/root.d/08-debootstrap b/elements/debian/root.d/08-debootstrap index 7dbd30680..8c952ef8a 100755 --- a/elements/debian/root.d/08-debootstrap +++ b/elements/debian/root.d/08-debootstrap @@ -37,10 +37,6 @@ if [ -n "$DIB_OFFLINE" ] && [ -f $DEBOOTSTRAP_TARBALL ] ; then else echo Building new tarball for Debian $DIB_RELEASE ARCH=$ARCH ADD_PACKAGES=sudo,adduser,locales,openssh-server,file,less,kbd,curl,rsync,bash-completion,linux-image-amd64 - if [ "$DIB_DEBIAN_ALT_INIT_PACKAGE" != "sysvinit" ]; then - ADD_PACKAGES=${ADD_PACKAGES},${DIB_DEBIAN_ALT_INIT_PACKAGE} - fi - sudo sh -c "http_proxy=$http_proxy debootstrap --verbose \ --arch=${ARCH} \ --include=${ADD_PACKAGES} \ @@ -49,16 +45,28 @@ else $DIB_DISTRIBUTION_MIRROR" echo "Customizing result for cloud use" - CLOUD_INIT_PACKAGES="cloud-init cloud-utils cloud-initramfs-growroot" + apt_get_bp_extra_opts= if [ "$DIB_RELEASE" = "wheezy" ]; then sudo sh -c "echo deb $DIB_DISTRIBUTION_MIRROR wheezy-backports main >> ${TARGET_ROOT}/etc/apt/sources.list" sudo chroot ${TARGET_ROOT} apt-get update - sudo chroot ${TARGET_ROOT} apt-get install -y -t wheezy-backports $CLOUD_INIT_PACKAGES cat << EOF | sudo tee -a ${TARGET_ROOT}/etc/network/interfaces source-directory /etc/interfaces.d EOF else # unstable sudo chroot ${TARGET_ROOT} apt-get install -y $CLOUD_INIT_PACKAGES + sudo sh -c "http_proxy=$http_proxy chroot ${TARGET_ROOT} apt-get update" + apt_get_bp_extra_opts="-t wheezy-backports" + fi + + CLOUD_INIT_PACKAGES="cloud-init cloud-utils cloud-initramfs-growroot" + sudo sh -c "http_proxy=$http_proxy chroot ${TARGET_ROOT} apt-get install -y $apt_get_bp_extra_opts $CLOUD_INIT_PACKAGES" + + if [ "$DIB_DEBIAN_ALT_INIT_PACKAGE" != "sysvinit" ]; then + # To avoid a conflict against an essential package, we need to remove sysvinit first + sudo chroot ${TARGET_ROOT} dpkg --purge --force remove-essential sysvinit + sudo sh -c "http_proxy=$http_proxy chroot ${TARGET_ROOT} apt-get install -y $apt_get_bp_extra_opts $DIB_DEBIAN_ALT_INIT_PACKAGE" + sudo sh -c "printf \"Package: sysvinit\nPin: origin ""\nPin-Priority: -1\n\" > \ + ${TARGET_ROOT}/etc/apt/preferences.d/sysvinit > ${TARGET_ROOT}/etc/apt/preferences.d/sysvinit" fi sudo sed -i "s/PermitRootLogin yes/PermitRootLogin without-password/" $TARGET_ROOT/etc/ssh/sshd_config