mirror/ubuntu: use debootstrap instead of multistrap
The only purpose of using multistrap was collecting the base packages from the multiple APT repositories, now this task is done properly with APT itself, so multistrap is not necessary any more. blueprint support-ubuntu-trusty DocImpact Change-Id: Id10c13946ce9a7d56d69067772bfd5db012722e4
This commit is contained in:
parent
beea71a5e0
commit
c83a59b403
|
@ -2,7 +2,7 @@
|
|||
APT_CONF_TEMPLATES := apt-ftparchive-deb.conf apt-ftparchive-udeb.conf apt-ftparchive-release.conf Release-amd64
|
||||
empty_line:=
|
||||
define insert_ubuntu_version
|
||||
sudo sed -i $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo/$(1) \
|
||||
sed -i $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo/$(1) \
|
||||
-e 's|@@UBUNTU_RELEASE@@|$(UBUNTU_RELEASE)|g' \
|
||||
-e 's|@@UBUNTU_RELEASE_NUMBER@@|$(UBUNTU_RELEASE_NUMBER)|g'
|
||||
$(empty_line)
|
||||
|
@ -12,55 +12,40 @@ ifeq (,$(findstring clean,$(MAKECMDGOALS)))
|
|||
include $(BUILD_DIR)/ubuntu_installer_kernel_version.mk
|
||||
endif
|
||||
|
||||
define newline
|
||||
|
||||
|
||||
endef
|
||||
# there are two blank lines here, this is not an error
|
||||
|
||||
define apt_sources_list
|
||||
$(if $(subst none,,$(USE_MIRROR)),
|
||||
deb $(MIRROR_UBUNTU) $(UBUNTU_RELEASE) main,
|
||||
deb $(MIRROR_UBUNTU) $(UBUNTU_RELEASE) main universe multiverse restricted
|
||||
deb $(MIRROR_UBUNTU) $(UBUNTU_RELEASE)-updates main universe multiverse restricted
|
||||
deb $(MIRROR_UBUNTU) $(UBUNTU_RELEASE)-security main universe multiverse restricted
|
||||
deb $(MIRROR_UBUNTU_SECURITY) $(UBUNTU_RELEASE)-security main universe multiverse restricted
|
||||
deb $(MIRROR_FUEL_UBUNTU) $(UBUNTU_RELEASE) main
|
||||
)
|
||||
$(if $(EXTRA_DEB_REPOS),$(subst |,$(newline)deb,deb $(EXTRA_DEB_REPOS)))
|
||||
endef
|
||||
|
||||
define policy_rc_d
|
||||
#!/bin/sh
|
||||
# suppress starting services in the staging chroot
|
||||
exit 101
|
||||
endef
|
||||
|
||||
$(BUILD_DIR)/mirror/ubuntu/createchroot.done: export APT_SOURCES_LIST:=$(apt_sources_list)
|
||||
$(BUILD_DIR)/mirror/ubuntu/createchroot.done: export POLICY_RC_D:=$(policy_rc_d)
|
||||
|
||||
$(BUILD_DIR)/mirror/ubuntu/createchroot.done:
|
||||
mkdir -p $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot
|
||||
mkdir -p $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/proc
|
||||
cp $(SOURCE_DIR)/mirror/ubuntu/multistrap.conf $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/
|
||||
sed -i $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/multistrap.conf \
|
||||
-e 's|@@MIRROR_UBUNTU@@|$(MIRROR_UBUNTU)|g' \
|
||||
-e 's|@@MIRROR_UBUNTU_SECURITY@@|$(MIRROR_UBUNTU_SECURITY)|g' \
|
||||
-e 's|@@MIRROR_FUEL_UBUNTU@@|$(MIRROR_FUEL_UBUNTU)|g' \
|
||||
-e 's|@@UBUNTU_RELEASE@@|$(UBUNTU_RELEASE)|g' \
|
||||
-e 's|@@UBUNTU_RELEASE_NUMBER@@|$(UBUNTU_RELEASE_NUMBER)|g'
|
||||
ifneq (none,$(strip $(USE_MIRROR)))
|
||||
sed -i $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/multistrap.conf \
|
||||
-e '/#ifdef USE_MIRROR_NONE/,/#endif/ { d }'
|
||||
endif
|
||||
if [ -n "$(EXTRA_DEB_REPOS)" ]; then \
|
||||
extra_count=0; \
|
||||
extra_repos=""; \
|
||||
IFS='|'; \
|
||||
l='$(EXTRA_DEB_REPOS)'; \
|
||||
set -- $$l; unset IFS; \
|
||||
for repo; do \
|
||||
[ -z "$$repo" ] && continue; \
|
||||
extra_repo=Extra$$extra_count; \
|
||||
echo "[$$extra_repo]"; \
|
||||
echo "omitdebsrc=true"; \
|
||||
case $$repo in \
|
||||
*/) repo=$$repo/; \
|
||||
echo "source=$$repo"; \
|
||||
;; \
|
||||
*) set -- $$repo; \
|
||||
if [ $$# -lt 3 ]; then \
|
||||
echo Incorrect repo \"$$repo\" >&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
url=$$1; \
|
||||
suite=$$2; \
|
||||
shift; shift; \
|
||||
components="$$@"; \
|
||||
echo "source=$$url"; \
|
||||
echo "suite=$$suite"; \
|
||||
echo "components=$$components"; \
|
||||
;; \
|
||||
esac; \
|
||||
extra_count=$$(($$extra_count + 1)); \
|
||||
extra_repos="$$extra_repos $$extra_repo"; \
|
||||
done >> $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/multistrap.conf; \
|
||||
sed -i -e "s/\(bootstrap\|aptsources\)=.*/\0 $$extra_repos/g" $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/multistrap.conf; \
|
||||
fi
|
||||
mount | grep -q $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/proc || sudo mount -t proc none $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/proc
|
||||
# Prevent services from being started inside the staging chroot
|
||||
policy_rc_d="$(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/usr/sbin/policy-rc.d"; \
|
||||
mkdir -p "$${policy_rc_d%/*}"; \
|
||||
echo "$${POLICY_RC_D}" > "$${policy_rc_d}"; \
|
||||
chmod 755 "$${policy_rc_d}"
|
||||
mkdir -p $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/init.d
|
||||
# Avoid base packages' configuration errors by preventing the postinst
|
||||
# scripts from fiddling with the services' start order.
|
||||
|
@ -68,30 +53,22 @@ endif
|
|||
# "Errors were while processing: <long-list-of-base-packages>'
|
||||
# and makes it possible to install non-trivial packages in the chroot
|
||||
touch $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/init.d/.legacy-bootordering
|
||||
sudo multistrap -a amd64 -f $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/multistrap.conf -d $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot
|
||||
sudo chroot $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot /bin/bash -c "dpkg --configure -a || exit 0"
|
||||
sudo chroot $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot /bin/bash -c "rm -rf /var/run/*"
|
||||
sudo chroot $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot /bin/bash -c "dpkg --configure -a || exit 0"
|
||||
sudo umount $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/proc
|
||||
sudo rm -f $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt/sources.list.d/*.list
|
||||
echo deb $(MIRROR_UBUNTU) $(UBUNTU_RELEASE) main | sudo tee $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt/sources.list.d/ubuntu.list
|
||||
if [ "$(USE_MIRROR)" = "none" ]; then \
|
||||
ubuntu_lst="$(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt/sources.list.d/ubuntu.list"; \
|
||||
echo deb $(MIRROR_UBUNTU) $(UBUNTU_RELEASE) universe multiverse restricted | sudo tee -a "$$ubuntu_lst"; \
|
||||
echo deb $(MIRROR_UBUNTU) $(UBUNTU_RELEASE)-updates main universe multiverse restricted | sudo tee -a "$$ubuntu_lst"; \
|
||||
echo deb $(MIRROR_UBUNTU) $(UBUNTU_RELEASE)-security main universe multiverse restricted | sudo tee -a "$$ubuntu_lst"; \
|
||||
echo deb $(MIRROR_UBUNTU_SECURITY) $(UBUNTU_RELEASE)-security main universe multiverse restricted | sudo tee -a "$$ubuntu_lst"; \
|
||||
echo deb $(MIRROR_FUEL_UBUNTU) $(UBUNTU_RELEASE) main | sudo tee $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt/sources.list.d/mirantis.list; \
|
||||
fi
|
||||
echo 'APT::Get::AllowUnauthenticated 1;' | sudo tee $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt/apt.conf.d/02mirantis-unauthenticated
|
||||
[ -n "$(EXTRA_DEB_REPOS)" ] && echo "$(EXTRA_DEB_REPOS)" | tr '|' '\n' | while read repo; do echo deb $$repo; done | sudo tee $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt/sources.list.d/extra.list || exit 0
|
||||
sudo cp -a $(SOURCE_DIR)/mirror/ubuntu/files/preferences $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt
|
||||
sudo cp -a $(SOURCE_DIR)/requirements-deb.txt $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/
|
||||
sudo cp /etc/resolv.conf $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/resolv.conf
|
||||
sudo mkdir -p $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo
|
||||
sudo rsync -a $(SOURCE_DIR)/mirror/ubuntu/files/ $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo/
|
||||
# copy the mirroring script and the list of the packages
|
||||
mkdir -p $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo
|
||||
rsync -a $(SOURCE_DIR)/mirror/ubuntu/files/ $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo/
|
||||
cp -a $(SOURCE_DIR)/requirements-deb.txt $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot
|
||||
$(foreach f,$(APT_CONF_TEMPLATES),$(call insert_ubuntu_version,$(f)))
|
||||
sudo chmod +x $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo/mkrepo.sh
|
||||
chmod +x $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo/mkrepo.sh
|
||||
# bootstrap Ubuntu
|
||||
sudo debootstrap --no-check-gpg --arch=$(UBUNTU_ARCH) \
|
||||
--variant=minbase --include=apt-utils,wget,bzip2 \
|
||||
$(UBUNTU_RELEASE) $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot $(MIRROR_UBUNTU)
|
||||
sudo rm -f $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt/sources.list.d/*.list
|
||||
echo "$${APT_SOURCES_LIST}" | sudo tee $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt/sources.list
|
||||
echo 'APT::Get::AllowUnauthenticated 1;' | sudo tee $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt/apt.conf.d/02mirantis-unauthenticated
|
||||
sudo cp -a $(SOURCE_DIR)/mirror/ubuntu/files/preferences $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/apt
|
||||
sudo rm -f $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/resolv.conf
|
||||
sudo cp /etc/resolv.conf $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/etc/resolv.conf
|
||||
extra_env=""; \
|
||||
if [ -n "$$HTTP_PROXY" ] || [ -n "$$http_proxy" ]; then \
|
||||
HTTP_PROXY="$${HTTP_PROXY:-$${http_proxy}}"; \
|
||||
|
@ -104,5 +81,6 @@ endif
|
|||
UBUNTU_KERNEL_FLAVOR='$(UBUNTU_KERNEL_FLAVOR)' \
|
||||
$$extra_env \
|
||||
/repo/mkrepo.sh
|
||||
sudo rsync -a --delete $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo/* $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/ && sudo rm -rf $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/
|
||||
sudo rsync -a --delete $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot/repo/* $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/
|
||||
sudo rm -rf $(LOCAL_MIRROR_UBUNTU_OS_BASEURL)/chroot
|
||||
$(ACTION.TOUCH)
|
||||
|
|
|
@ -109,7 +109,7 @@ mkdir -p ${wrkdir}/apt.tmp/sources
|
|||
mkdir -p ${wrkdir}/apt.tmp/cache
|
||||
|
||||
# Extract all specified repos (except backports repo)
|
||||
for list in /etc/apt/sources.list.d/*.list; do
|
||||
for list in /etc/apt/sources.list; do
|
||||
for repo in `cat $list| grep -v backports | sed 's| \+|\||g' | grep "^deb|"`; do
|
||||
repourl=`echo $repo | awk -F '|' '{print $2}'`
|
||||
repodist=`echo $repo | awk -F '|' '{print $3}'`
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
[General]
|
||||
# arch and directory can be specified on the command line.
|
||||
#arch=armel
|
||||
#directory=/opt/multistrap/
|
||||
# same as --tidy-up option if set to true
|
||||
cleanup=false
|
||||
# retain the sources outside the rootfs for distribution
|
||||
# specify a directory to which all the .debs can be moved.
|
||||
# or override with the --source-dir option.
|
||||
# same as --no-auth option if set to true
|
||||
# keyring packages listed in each debootstrap will
|
||||
# still be installed.
|
||||
noauth=true
|
||||
# retries not needed.
|
||||
#retries=5
|
||||
# extract all downloaded archives
|
||||
unpack=true
|
||||
bootstrap=Ubuntu Updates Security Mirantis Fuel
|
||||
# the order of sections is no longer important.
|
||||
# debootstrap determines which repository is used to
|
||||
# calculate the list of Priority: required packages
|
||||
# the order of sections is no longer important.
|
||||
# aptsources is a list of sections to be listed
|
||||
# in the /etc/apt/sources.list.d/multistrap.sources.list
|
||||
# of the target.
|
||||
aptsources=Ubuntu Updates Security Mirantis Fuel
|
||||
|
||||
[Mirantis]
|
||||
packages=apt wget bzip2 apt-utils
|
||||
source=@@MIRROR_UBUNTU@@
|
||||
suite=@@UBUNTU_RELEASE@@
|
||||
omitdebsrc=true
|
||||
|
||||
#ifdef USE_MIRROR_NONE
|
||||
|
||||
[Security]
|
||||
source=@@MIRROR_UBUNTU@@
|
||||
suite=@@UBUNTU_RELEASE@@-security
|
||||
omitdebsrc=true
|
||||
|
||||
[Ubuntu]
|
||||
source=@@MIRROR_UBUNTU@@
|
||||
suite=@@UBUNTU_RELEASE@@
|
||||
omitdebsrc=true
|
||||
|
||||
[Updates]
|
||||
source=@@MIRROR_UBUNTU@@
|
||||
suite=@@UBUNTU_RELEASE@@-updates
|
||||
omitdebsrc=true
|
||||
|
||||
[Fuel]
|
||||
source=@@MIRROR_FUEL_UBUNTU@@
|
||||
suite=@@UBUNTU_RELEASE@@
|
||||
omitdebsrc=true
|
||||
|
||||
[MirantisSecurity]
|
||||
source=@@MIRROR_UBUNTU_SECURITY@@
|
||||
suite=@@UBUNTU_RELEASE@@-security
|
||||
omitdebsrc=true
|
||||
|
||||
#endif
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
# building a Fuel ISO.
|
||||
|
||||
# - We need not try to install rubygems on trusty, because it doesn't exists
|
||||
# - We also should use multistrap version 2.1.6 from devops mirror
|
||||
|
||||
# install yum and yum-utils from trusty, so it can handle the meta-data
|
||||
# of OSCI rpm repositories. Works around ISO build failure (LP #1381535).
|
||||
|
@ -42,16 +41,8 @@ case "${DISTRO}" in
|
|||
|
||||
trusty)
|
||||
GEMPKG="ruby ruby-dev"
|
||||
# we need multistrap version 2.1.6, let's install it from devops mirror
|
||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D5A05778
|
||||
echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list
|
||||
# be sure, that we will not update multistrap in future
|
||||
sudo tee /etc/apt/preferences.d/fuel-pin-300 <<EOF
|
||||
Package: *multistrap*
|
||||
Pin: version 2.1.6*
|
||||
Pin-Priority: 1000
|
||||
|
||||
EOF
|
||||
sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm
|
||||
;;
|
||||
|
||||
|
@ -119,7 +110,7 @@ sudo apt-get update
|
|||
sudo apt-get -y install build-essential make git $GEMPKG debootstrap createrepo \
|
||||
python-setuptools yum yum-utils libmysqlclient-dev isomd5sum bc \
|
||||
python-nose libvirt-bin python-ipaddr python-paramiko python-yaml \
|
||||
python-pip kpartx extlinux unzip genisoimage multistrap \
|
||||
python-pip kpartx extlinux unzip genisoimage \
|
||||
lrzip python-daemon python-dev
|
||||
sudo gem install bundler -v 1.2.1
|
||||
sudo gem install builder
|
||||
|
|
Loading…
Reference in New Issue