From 3db8c36ade39c5996632cb7019336cedb1936913 Mon Sep 17 00:00:00 2001 From: Michal Skalski Date: Thu, 16 Apr 2015 13:40:09 +0000 Subject: Fix debootstrap package This commit provide scripts to patch debootstrap package. This should fix problems that can occur during ubuntu 12.04 installation. More detail can be found here: * https://bugs.launchpad.net/ubuntu/+source/debootstrap/+bug/1001131 * https://wiki.debian.org/DebianInstaller/Modify/CD#Workaround_bug_in_deboostrap Change-Id: I881191a37ba22d336c61623ae506f7e75dcc7540 JIRA: Signed-off-by: Michal Skalski --- fuel/build/Makefile | 3 +- fuel/build/install/apt-ftparchive-udeb.conf | 33 ++++++++++++ fuel/build/install/install.sh | 10 ++++ fuel/build/patch-packages/Makefile | 2 +- fuel/build/patch-packages/debootstrap/Makefile | 28 +++++++++++ .../patch-packages/debootstrap/debootstrap.patch | 12 +++++ fuel/build/patch-packages/tools/udeb_pack | 38 ++++++++++++++ fuel/build/patch-packages/tools/udeb_unpack | 58 ++++++++++++++++++++++ 8 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 fuel/build/install/apt-ftparchive-udeb.conf create mode 100644 fuel/build/patch-packages/debootstrap/Makefile create mode 100644 fuel/build/patch-packages/debootstrap/debootstrap.patch create mode 100755 fuel/build/patch-packages/tools/udeb_pack create mode 100755 fuel/build/patch-packages/tools/udeb_unpack (limited to 'fuel/build') diff --git a/fuel/build/Makefile b/fuel/build/Makefile index fda212d..5f63120 100644 --- a/fuel/build/Makefile +++ b/fuel/build/Makefile @@ -27,6 +27,7 @@ export NEWISO = $(shell pwd)/release/opnfv-${REVSTATE}.iso #Build variables export BUILD_BASE := $(shell pwd) export DEB_DEST := $(BUILD_BASE)/release/packages/ubuntu/pool/main +export UDEB_DEST := $(BUILD_BASE)/release/packages/ubuntu/pool/debian-installer export PUPPET_DEST := $(BUILD_BASE)/release/puppet/modules export CACHE_DIR := $(BUILD_BASE)/cache export VERSION_FILE := $(BUILD_BASE)/.versions @@ -108,7 +109,7 @@ umount-origiso: .PHONY: $(SUBDIRS) $(SUBDIRS): - @mkdir -p release/packages/ubuntu/pool/main release/puppet/modules release/isoroot + @mkdir -p release/packages/ubuntu/pool/main release/packages/ubuntu/pool/debian-installer release/puppet/modules release/isoroot $(MAKE) -C $@ -f Makefile release .PHONY: patch-packages diff --git a/fuel/build/install/apt-ftparchive-udeb.conf b/fuel/build/install/apt-ftparchive-udeb.conf new file mode 100644 index 0000000..2acbcf0 --- /dev/null +++ b/fuel/build/install/apt-ftparchive-udeb.conf @@ -0,0 +1,33 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +Dir { + ArchiveDir "."; +}; + +TreeDefault { + Directory "pool"; +}; + +BinDirectory "pool/debian-installer" { + Packages "dists/precise/main/debian-installer/binary-amd64/Packages"; + BinOverride "./indices/override.precise.main.debian-installer"; +}; + +Default { + Packages { + Extensions ".udeb"; + Compress ". gzip"; + }; +}; + +Contents { + Compress "gzip"; +}; diff --git a/fuel/build/install/install.sh b/fuel/build/install/install.sh index 823bcd9..dbb26d6 100755 --- a/fuel/build/install/install.sh +++ b/fuel/build/install/install.sh @@ -257,6 +257,14 @@ make_iso() { copy_packages() { echo "Copying Debian packages..." + cd $TOP/release/packages/ubuntu/pool/debian-installer + + for udeb in `ls -1 | grep '\.udeb$'` + do + echo " $udeb" + cp $udeb $REPO/pool/debian-installer + done + cd $TOP/release/packages/ubuntu/pool/main for deb in `ls -1 | grep '\.deb$'` do @@ -401,8 +409,10 @@ copy_packages() { # The below methods are from 15B APT_REL_CONF="$TOP/install/apt-ftparchive-release.conf" APT_DEB_CONF="$TOP/install/apt-ftparchive-deb.conf" + APT_UDEB_CONF="$TOP/install/apt-ftparchive-udeb.conf" apt-ftparchive -c "${APT_REL_CONF}" generate "${APT_DEB_CONF}" + apt-ftparchive generate "${APT_UDEB_CONF}" # Fuel also needs this index file cat dists/precise/main/binary-amd64/Packages | \ diff --git a/fuel/build/patch-packages/Makefile b/fuel/build/patch-packages/Makefile index 9eb22fe..bcaac36 100644 --- a/fuel/build/patch-packages/Makefile +++ b/fuel/build/patch-packages/Makefile @@ -8,7 +8,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -SUBDIRS := python-nova +SUBDIRS := python-nova debootstrap SUBCLEAN = $(addsuffix .clean,$(SUBDIRS)) .PHONY: $(SUBDIRS) $(SUBCLEAN) clean diff --git a/fuel/build/patch-packages/debootstrap/Makefile b/fuel/build/patch-packages/debootstrap/Makefile new file mode 100644 index 0000000..0109312 --- /dev/null +++ b/fuel/build/patch-packages/debootstrap/Makefile @@ -0,0 +1,28 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +TOP := $(shell pwd) + +.PHONY: all +all: + +.PHONY: clean +clean: + @rm -rf udebPackage + @rm -rf *.udeb + @rm -rf patch-replacements + @rm -rf .udebpackage + +.PHONY: release +release: + ../tools/udeb_unpack debootstrap-udeb_1.0.4*.udeb $(ORIGISO) + patch -s -p0 < debootstrap.patch + ../tools/udeb_pack $(REVSTATE) + @cp *.udeb $(UDEB_DEST) diff --git a/fuel/build/patch-packages/debootstrap/debootstrap.patch b/fuel/build/patch-packages/debootstrap/debootstrap.patch new file mode 100644 index 0000000..62342c9 --- /dev/null +++ b/fuel/build/patch-packages/debootstrap/debootstrap.patch @@ -0,0 +1,12 @@ +--- udebPackage/usr/share/debootstrap/scripts/gutsy.orig 2014-11-10 18:21:37.000000000 +0000 ++++ udebPackage/usr/share/debootstrap/scripts/gutsy 2015-04-15 09:28:44.290437000 +0000 +@@ -112,7 +112,8 @@ + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" +- x_core_install base-files base-passwd ++ x_core_install base-passwd ++ x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + diff --git a/fuel/build/patch-packages/tools/udeb_pack b/fuel/build/patch-packages/tools/udeb_pack new file mode 100755 index 0000000..e961a73 --- /dev/null +++ b/fuel/build/patch-packages/tools/udeb_pack @@ -0,0 +1,38 @@ +#!/bin/bash -e +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +my_exit() { + + if [ -d "$ISOROOT" ]; then + fusermount -u $ISOROOT + fi +} + +ME=$(basename $0) + +trap my_exit EXIT + +if [ ! -d udebPackage ]; then + echo "$ME: Error - package directory does not exist" + exit 1 +fi + +echo "Stepping revision number to $REV" + + +fakeroot dpkg-deb --build -Zgzip udebPackage +PKGNAME=`grep "^Package: " udebPackage/DEBIAN/control | awk '{ print $2 }'` +PKGREV=`grep "^Version: " udebPackage/DEBIAN/control | awk '{ print $2 }'` +ARCH=`grep "^Architecture: " udebPackage/DEBIAN/control | awk '{ print $2 }'` +mv udebPackage.deb ${PKGNAME}_${PKGREV}_${ARCH}.udeb + +ORIGPKG=`cat .udebpackage` diff --git a/fuel/build/patch-packages/tools/udeb_unpack b/fuel/build/patch-packages/tools/udeb_unpack new file mode 100755 index 0000000..ed9cd21 --- /dev/null +++ b/fuel/build/patch-packages/tools/udeb_unpack @@ -0,0 +1,58 @@ +#!/bin/bash -e +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +my_exit() { + + if [ -d "$ISOROOT" ]; then + fusermount -u $ISOROOT + fi +} + +ME=$(basename $0) + +trap my_exit EXIT + + +if [ -z "$1" ]; then + echo "$ME: Error - No package specified" + exit 1 +fi + +if [ -z "$2" ]; then + echo "$ME: Error - No ISO path specified" + exit 1 +fi + +DEB=$1 +ORIGISO=$2 +DEST=udebPackage + +if [ -e $DEST -o -d $DEST ]; then + echo "$ME: Error - $DEST already exists" + exit 1 +fi + +ISOROOT=`mktemp -d /tmp/XXXXXXX` +fuseiso -p $ORIGISO $ISOROOT +sleep 1 + +if [ ! -f $ISOROOT/ubuntu/pool/debian-installer/$DEB ];then + echo "Could not find package $DEB in source ISO!" +fi + +mkdir -p $DEST +dpkg -x $ISOROOT/ubuntu/pool/debian-installer/$DEB $DEST + +mkdir -p $DEST/DEBIAN +dpkg -e $ISOROOT/ubuntu/pool/debian-installer/$DEB $DEST/DEBIAN + +echo $DEB > .udebpackage -- cgit 1.2.3-korg