summaryrefslogtreecommitdiffstats
path: root/fuel/build
diff options
context:
space:
mode:
Diffstat (limited to 'fuel/build')
-rw-r--r--fuel/build/Makefile150
-rw-r--r--fuel/build/README22
-rw-r--r--fuel/build/add_opnfv_packages23
-rw-r--r--fuel/build/apply_patches18
-rw-r--r--fuel/build/cache.mk94
-rw-r--r--fuel/build/config.mk20
-rw-r--r--fuel/build/docker/Makefile23
-rw-r--r--fuel/build/docker/README25
-rwxr-xr-xfuel/build/docker/runcontext35
-rw-r--r--fuel/build/docker/ubuntu-builder/Dockerfile28
-rw-r--r--fuel/build/docker/ubuntu-builder/enable_dockerx220
-rwxr-xr-xfuel/build/docker/ubuntu-builder/setcontext20
-rw-r--r--fuel/build/f_example_control_bond/Makefile28
-rw-r--r--fuel/build/f_example_control_bond/README56
-rw-r--r--fuel/build/f_example_control_bond/puppet/modules/opnfv/files/control-bond90
-rw-r--r--fuel/build/f_example_control_bond/puppet/modules/opnfv/manifests/control-bond.pp56
-rw-r--r--fuel/build/f_example_packadd/Makefile42
-rw-r--r--fuel/build/f_example_packadd/README47
-rw-r--r--fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/conffiles1
-rw-r--r--fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/control10
-rwxr-xr-xfuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/postinst2
-rw-r--r--fuel/build/f_example_packadd/foobar_1.0-1/etc/foobar/foobar.conf2
-rwxr-xr-xfuel/build/f_example_packadd/foobar_1.0-1/usr/bin/foobar2
-rw-r--r--fuel/build/f_example_packadd/foobar_1.0-1/usr/share/doc/foobar/changelog.Debian5
-rw-r--r--fuel/build/f_example_packadd/foobar_1.0-1/usr/share/doc/foobar/copyright18
-rw-r--r--fuel/build/f_example_packadd/puppet/modules/opnfv/manifests/foobar.pp7
-rw-r--r--fuel/build/f_isoroot/Makefile35
-rw-r--r--fuel/build/f_isoroot/README16
-rw-r--r--fuel/build/f_isoroot/f_bootstrap/Makefile29
-rw-r--r--fuel/build/f_isoroot/f_bootstrap/README24
-rwxr-xr-xfuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh172
-rwxr-xr-xfuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig152
-rwxr-xr-xfuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh4
-rwxr-xr-xfuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh19
-rwxr-xr-xfuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh4
-rw-r--r--fuel/build/f_isoroot/f_kscfg/Makefile25
-rw-r--r--fuel/build/f_isoroot/f_kscfg/README18
-rw-r--r--fuel/build/f_isoroot/f_kscfg/ks.cfg598
-rw-r--r--fuel/build/f_isoroot/f_kscfg/ks.cfg.orig592
-rw-r--r--fuel/build/f_isoroot/f_odlpluginbuild/Makefile38
-rw-r--r--fuel/build/f_isoroot/f_repobuild/Makefile56
-rw-r--r--fuel/build/fuel-agent_1.patch36
-rw-r--r--fuel/build/fuel-main_3.patch19
-rw-r--r--fuel/build/fuel-main_5.patch19
-rw-r--r--fuel/build/install/apt-ftparchive-deb.conf35
-rw-r--r--fuel/build/install/apt-ftparchive-release.conf18
-rw-r--r--fuel/build/install/apt-ftparchive-udeb.conf33
-rwxr-xr-xfuel/build/install/install.sh477
-rwxr-xr-xfuel/build/install/uninstall.sh79
-rw-r--r--fuel/build/patch-packages/Makefile26
-rwxr-xr-xfuel/build/patch-packages/tools/correct_deps78
-rwxr-xr-xfuel/build/patch-packages/tools/deb_pack63
-rwxr-xr-xfuel/build/patch-packages/tools/deb_unpack58
-rwxr-xr-xfuel/build/patch-packages/tools/udeb_pack38
-rwxr-xr-xfuel/build/patch-packages/tools/udeb_unpack58
-rw-r--r--fuel/build/patch-packages/tr_example/Makefile30
56 files changed, 3693 insertions, 0 deletions
diff --git a/fuel/build/Makefile b/fuel/build/Makefile
new file mode 100644
index 000000000..ba4beaf39
--- /dev/null
+++ b/fuel/build/Makefile
@@ -0,0 +1,150 @@
+##############################################################################
+# 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
+##############################################################################
+
+SHELL = /bin/bash
+############################################################################
+# BEGIN of variables to customize
+#
+#Input args
+export UNIT_TEST = FALSE
+export INTERACTIVE = TRUE
+export ISOSRC = file:$(shell pwd)/fuel-6.1.iso
+export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC))
+export PRODNO = "OPNFV_BGS"
+export REVSTATE = "P0000"
+export NEWISO = $(shell pwd)/release/opnfv-${REVSTATE}.iso
+
+# Note! Invoke with "make REVSTATE=RXXXX all" to make release build!
+# Invoke with ICOCACHE=/full/path/to/iso if cached ISO is in non-standard location.
+
+#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
+export DOCKERIMG = opnfv.org/ubuntu-builder:14.04
+export TOPDIR := $(shell pwd)
+
+#Build subclasses
+
+SUBDIRS := f_isoroot
+
+# f_example is only an example of how to generate a .deb package and
+# should not be enabled in official builds.
+#SUBDIRS += f_example
+
+ORIGDIR := $(TOPDIR)/origiso
+#
+# END of variables to customize
+#############################################################################
+
+SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
+
+
+.PHONY: all
+all:
+ @docker version >/dev/null 2>&1 || (echo 'No Docker installation available'; exit 1)
+ @echo "Versions of cached build results built by" $(shell hostname) "at" $(shell date -u) > $(VERSION_FILE)
+ @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(VERSION_FILE)
+ @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(VERSION_FILE)
+ @make -C docker
+ @docker/runcontext $(DOCKERIMG) $(MAKE) $(MAKEFLAGS) iso
+
+############################################################################
+# BEGIN of Include definitions
+#
+include config.mk
+include cache.mk
+#
+# END Include definitions
+#############################################################################
+
+$(ISOCACHE):
+ # Clone Fuel to non-persistent location and build
+ cd /tmp && git clone $(FUEL_MAIN_REPO)
+ cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG)
+ @echo "fuel" `git -C /tmp/fuel-main show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE)
+ # Setup cgroups for docker-in-docker
+ sudo /root/enable_dockerx2
+ # Temporary patch to accomodate for new Ubuntu trusty devops keys not yet
+ # backported to fuel 6.0 or 6.1
+ cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-main_3.patch
+ # Patch for adding dosfstools, as Fuel 6.1 is running mkfs.vfat
+ cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-main_5.patch
+ # Remove Docker optimizations, otherwise multistrap will fail during
+ # Fuel build.
+ sudo rm -f /etc/apt/apt.conf.d/docker*
+ #
+ cd /tmp/fuel-main && ./prepare-build-env.sh
+ cd /tmp/fuel-main && make repos
+ # Patch for speeding up image creation in virtual environments,
+ # https://review.openstack.org/#/c/197943/
+ cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-agent_1.patch
+ cd /tmp/fuel-main/build/repos/nailgun && git config --global user.email "build$opnfv.org"
+ cd /tmp/fuel-main/build/repos/nailgun && git config --global user.name "OPNFV build"
+ cd /tmp/fuel-main/build/repos/nailgun && git add -u .
+ cd /tmp/fuel-main/build/repos/nailgun && git commit -m "Added patch"
+ #
+ cd /tmp/fuel-main && make iso
+ mv /tmp/fuel-main/build/artifacts/fuel*.iso .
+
+.PHONY: mount-origiso umount-origiso
+mount-origiso: $(ISOCACHE)
+ @echo "Mounting original ISO in $(ORIGDIR)"
+ @mkdir -p $(ORIGDIR)
+ @fuseiso $(ISOCACHE) $(ORIGDIR)
+
+umount-origiso:
+ @echo "Unmounting original ISO from $(ORIGDIR)"
+ @fusermount -u $(ORIGDIR)
+ @rmdir $(ORIGDIR)
+
+.PHONY: $(SUBDIRS)
+$(SUBDIRS):
+ @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
+patch-packages:
+ ORIGISO=$(ISOCACHE) REVSTATE=$(REVSTATE) $(MAKE) -C $@ -f Makefile release
+
+.PHONY: build-clean $(SUBCLEAN)
+build-clean: $(SUBCLEAN)
+ $(MAKE) -C patch-packages -f Makefile clean
+ @rm -Rf release
+ @rm -Rf newiso
+ @rm -f $(NEWISO)
+
+.PHONY: clean $(SUBCLEAN)
+clean: clean-cache $(SUBCLEAN)
+ $(MAKE) -C patch-packages -f Makefile clean
+ @rm -f *.iso
+ @rm -Rf release
+ @rm -Rf newiso
+ @rm -f $(NEWISO)
+ @rm -f $(BUILD_BASE)/.versions
+
+$(SUBCLEAN): %.clean:
+ $(MAKE) -C $* -f Makefile clean
+
+# Todo: Make things smarter - we shouldn't need to clean everything
+# betwen make invocations.
+.PHONY: iso
+iso: build-clean $(ISOCACHE) $(SUBDIRS) patch-packages
+ install/install.sh iso $(ISOCACHE) $(NEWISO) $(PRODNO) $(REVSTATE)
+ @printf "\n\nProduct ISO is $(NEWISO)\n\n"
+
+# Start a bash shell in docker for Makefile debugging
+.PHONY: debug
+debug:
+ @docker version >/dev/null 2>&1 || (echo 'No Docker installation available'; exit 1)
+ docker/runcontext $(DOCKERIMG) bash
diff --git a/fuel/build/README b/fuel/build/README
new file mode 100644
index 000000000..a6e15694c
--- /dev/null
+++ b/fuel/build/README
@@ -0,0 +1,22 @@
+##############################################################################
+# 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
+##############################################################################
+
+This purpose of this framework is to:
+
+1) Build fuel baseline from upstream OpenStack Fuel repos (builds in a docker container to isolate dependencies from host
+ and full re-producability)
+2) Apply arbitrary changes to the fuel baseline, consistent and non volatile:
+ - Add arbitrary packages with puppet modules for install and config. to be applied on controllers as well as computes.
+ - Change any stack-, or other pack config. using puppet
+ - Apply patches to the baseline.
+ - Etc.
+3) Re factor/rebuild the .iso image for deployment (also builds in a container, for the same reason as mentioned above)
+
+For detailed instructions on how to add content, configuration, build and deply - please see: DOC/
diff --git a/fuel/build/add_opnfv_packages b/fuel/build/add_opnfv_packages
new file mode 100644
index 000000000..44af92ea7
--- /dev/null
+++ b/fuel/build/add_opnfv_packages
@@ -0,0 +1,23 @@
+##############################################################################
+# 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
+##############################################################################
+
+# Format of this file:
+#
+#TEXT>old package>url for replacement package
+#
+# Note! No spaces!
+# The TEXT can be anything it is just for information display.
+# Iff the packages is new, i.e. not replacing an existing package
+# the old package should be specified as NONE.
+# Note! For new packages a puppet manifest must actually install it.
+# Easiest is to just add it to add_packages.pp. (The same might
+# of course be true for an exising package if it isn't already
+# is being installed).
+#
diff --git a/fuel/build/apply_patches b/fuel/build/apply_patches
new file mode 100644
index 000000000..6925ff6b7
--- /dev/null
+++ b/fuel/build/apply_patches
@@ -0,0 +1,18 @@
+##############################################################################
+# 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
+##############################################################################
+
+# Format of this file:
+#
+#TR>old package>url for replacement package
+#
+# Note! No spaces!
+# Example:
+#FIX>foo_0.0.1.deb>https://example.org/foo_0.0.2.deb
+
diff --git a/fuel/build/cache.mk b/fuel/build/cache.mk
new file mode 100644
index 000000000..b88ac2fc4
--- /dev/null
+++ b/fuel/build/cache.mk
@@ -0,0 +1,94 @@
+#############################################################################
+# 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
+##############################################################################
+
+SHELL = /bin/bash
+CACHEVALIDATE := $(addsuffix .validate,$(SUBDIRS))
+CACHECLEAN := $(addsuffix .clean,$(CACHEFILES) $(CACHEDIRS))
+
+############################################################################
+# BEGIN of variables to customize
+#
+#CACHEDIRS := foo/bar
+
+CACHEFILES += .versions
+CACHEFILES += $(shell basename $(ISOSRC))
+#
+# END of variables to customize
+############################################################################
+
+.PHONY: prepare-cache
+prepare-cache: make-cache-dir $(CACHEDIRS) $(CACHEFILES)
+
+.PHONY: make-cache-dir
+make-cache-dir:
+ @rm -rf ${CACHE_DIR}
+ @mkdir ${CACHE_DIR}
+
+.PHONY: clean-cache
+clean-cache: $(CACHECLEAN)
+ @rm -rf ${CACHE_DIR}
+
+.PHONY: $(CACHEDIRS)
+$(CACHEDIRS):
+ @mkdir -p $(dir $(CACHE_DIR)/$@)
+ @if [ ! -d $(BUILD_BASE)/$@ ]; then\
+ mkdir -p $(BUILD_BASE)/$@;\
+ fi
+ @ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@
+
+.PHONY: $(CACHEFILES)
+$(CACHEFILES):
+ @mkdir -p $(dir $(CACHE_DIR)/$@)
+ @if [ ! -d $(dir $(BUILD_BASE)/$@) ]; then\
+ mkdir -p $(dir $(BUILD_BASE)/$@);\
+ fi
+
+ @if [ ! -f $(BUILD_BASE)/$@ ]; then\
+ echo " " > $(BUILD_BASE)/$@;\
+ ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@;\
+ rm -f $(BUILD_BASE)/$@;\
+ else\
+ ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@;\
+ fi
+
+.PHONY: validate-cache
+validate-cache: $(CACHEVALIDATE)
+ @if [ "$(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ")" != "$(shell cat $(VERSION_FILE) | grep config.mk | awk '{print $$NF}')" ]; then\
+ echo "Cache does not match current config.mk definition, cache must be rebuilt";\
+ exit 1;\
+ fi;
+
+ @if [ "$(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ")" != "$(shell cat $(VERSION_FILE) | grep cache.mk | awk '{print $$NF}')" ]; then\
+ echo "Cache does not match current cache.mk definition, cache must be rebuilt";\
+ exit 1;\
+ fi;
+
+# Once the Make structure is refactored, this should go in as a validate-cache
+# taget in the fuel Makefile
+
+ @REMOTE_ID=$(shell git ls-remote $(FUEL_MAIN_REPO) $(FUEL_MAIN_TAG)^{} | awk '{print $$(NF-1)}'); \
+ if [ -z $$REMOTE_ID ] || [ $$REMOTE_ID = " " ]; \
+ then \
+ REMOTE_ID=$(shell git ls-remote $(FUEL_MAIN_REPO) $(FUEL_MAIN_TAG) | awk '{print $$(NF-1)}'); \
+ fi; \
+ if [[ $$REMOTE_ID != $(shell cat $(VERSION_FILE) | grep fuel | awk '{print $$NF}') ]]; \
+ then \
+ echo "Cache does not match upstream Fuel, cache must be rebuilt!"; \
+ exit 1; \
+ fi
+
+.PHONY: $(CACHEVALIDATE)
+$(CACHEVALIDATE): %.validate:
+ @echo VALIDATE $(CACHEVALIDATE)
+ $(MAKE) -C $* -f Makefile validate-cache
+
+.PHONY: $(CACHECLEAN)
+$(CACHECLEAN): %.clean:
+ rm -rf ${CACHE_DIR}/$*
diff --git a/fuel/build/config.mk b/fuel/build/config.mk
new file mode 100644
index 000000000..e9a5320f4
--- /dev/null
+++ b/fuel/build/config.mk
@@ -0,0 +1,20 @@
+##############################################################################
+# 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
+##############################################################################
+
+FUEL_MAIN_REPO := https://github.com/stackforge/fuel-main
+FUEL_MAIN_TAG = stable/6.1
+
+DOCKER_REPO := http://get.docker.com/builds/Linux/x86_64
+DOCKER_TAG := docker-latest
+
+.PHONY: get-fuel-repo
+get-fuel-repo:
+ @echo $(FUEL_MAIN_REPO) $(FUEL_MAIN_TAG)
+
diff --git a/fuel/build/docker/Makefile b/fuel/build/docker/Makefile
new file mode 100644
index 000000000..c2853c856
--- /dev/null
+++ b/fuel/build/docker/Makefile
@@ -0,0 +1,23 @@
+##############################################################################
+# 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
+##############################################################################
+
+FILES = $(wildcard ubuntu-builder/*) runcontext
+
+.PHONY: all
+all: .docker
+
+.docker: $(FILES)
+ /usr/bin/docker build --rm=true --no-cache=true -t opnfv.org/ubuntu-builder:14.04 ubuntu-builder
+ /usr/bin/docker tag -f opnfv.org/ubuntu-builder:14.04 opnfv.org/ubuntu-builder
+ touch .docker
+
+.PHONY: clean
+clean:
+ rm .docker
diff --git a/fuel/build/docker/README b/fuel/build/docker/README
new file mode 100644
index 000000000..e5ccdfab6
--- /dev/null
+++ b/fuel/build/docker/README
@@ -0,0 +1,25 @@
+##############################################################################
+# 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
+##############################################################################
+
+The makefile on this level is used for *creating* the Docker image
+used for building in Ubuntu 12.04 context.
+
+There are two requirements before running make on this level:
+
+1. You need to have Docker installed on your system
+
+2. If in a corporate network, make sure to have a valid DNS config in
+ your /etc/default/docker, e.g:
+
+ DOCKER_OPTS=" --dns=8.8.8.8 --dns=8.8.8.4"
+
+The top level makefile will refer to the "runcontext" file in order to
+run the build process as the current user with the current working
+directory available to the container.
diff --git a/fuel/build/docker/runcontext b/fuel/build/docker/runcontext
new file mode 100755
index 000000000..52b46ad14
--- /dev/null
+++ b/fuel/build/docker/runcontext
@@ -0,0 +1,35 @@
+#!/bin/bash
+##############################################################################
+# 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
+##############################################################################
+#
+context=$1
+shift
+GID=`id -g`
+USER=`whoami`
+res=`docker build -q --rm - <<EOF
+FROM $context
+RUN date || date
+RUN /root/setcontext $USER $UID $GID $HOME
+EOF`
+GITROOT=`git rev-parse --show-toplevel`
+CID=`echo $res | sed 's/.* //'`
+
+ RUN_CONTEXT_OPT="--privileged=true --rm -i -e HOME=$HOME -u $USER -w $PWD -v ${HOME}/.ssh:${HOME}/.ssh -v $GITROOT:$GITROOT"
+
+if [ "${INTERACTIVE}" != "FALSE" ]; then
+ RUN_CONTEXT_OPT+=" -t"
+fi
+
+echo command: docker run ${RUN_CONTEXT_OPT} $CID "$@"
+docker run ${RUN_CONTEXT_OPT} $CID "$@"
+
+rc=$?
+docker rmi -f $CID > /dev/null
+exit $rc
diff --git a/fuel/build/docker/ubuntu-builder/Dockerfile b/fuel/build/docker/ubuntu-builder/Dockerfile
new file mode 100644
index 000000000..81cdc43fb
--- /dev/null
+++ b/fuel/build/docker/ubuntu-builder/Dockerfile
@@ -0,0 +1,28 @@
+#!/bin/bash
+##############################################################################
+# 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
+##############################################################################
+
+FROM ubuntu:14.04
+RUN apt-get update
+RUN apt-get install -y software-properties-common python-software-properties \
+ make python-setuptools python-all dpkg-dev debhelper \
+ fuseiso git genisoimage bind9-host wget curl lintian tmux lxc iptables \
+ ca-certificates sudo apt-utils lsb-release dosfstools
+
+RUN echo "ALL ALL=NOPASSWD: ALL" > /etc/sudoers.d/open-sudo
+RUN chmod 0440 /etc/sudoers.d/open-sudo
+RUN chmod 4755 /bin/fusermount
+
+ADD ./setcontext /root/setcontext
+RUN chmod +x /root/setcontext
+ADD ./enable_dockerx2 /root/enable_dockerx2
+RUN chmod +x /root/enable_dockerx2
+
+VOLUME /var/lib/docker
diff --git a/fuel/build/docker/ubuntu-builder/enable_dockerx2 b/fuel/build/docker/ubuntu-builder/enable_dockerx2
new file mode 100644
index 000000000..1511c70ea
--- /dev/null
+++ b/fuel/build/docker/ubuntu-builder/enable_dockerx2
@@ -0,0 +1,20 @@
+#!/bin/sh
+##############################################################################
+# 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
+##############################################################################
+#
+# Needed to expose underlying cgroups to container
+echo "running x2" > /x2
+mount -n -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
+mount -t securityfs none /sys/kernel/security
+
+for mnt in $(cut -d: -f2 /proc/1/cgroup); do
+ mkdir /sys/fs/cgroup/$mnt
+ mount -n -t cgroup -o $mnt cgroup /sys/fs/cgroup/$mnt
+done
diff --git a/fuel/build/docker/ubuntu-builder/setcontext b/fuel/build/docker/ubuntu-builder/setcontext
new file mode 100755
index 000000000..bc28994a9
--- /dev/null
+++ b/fuel/build/docker/ubuntu-builder/setcontext
@@ -0,0 +1,20 @@
+#!/bin/bash
+##############################################################################
+# 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
+##############################################################################
+#
+SETUSER=$1
+SETUID=$2
+SETGID=$3
+SETHOME=$4
+
+getent group $SETUSER || /usr/sbin/groupadd --gid $SETGID $SETUSER
+getent passwd $SETUSER || /usr/sbin/adduser --system --uid=$SETUID --gid=$SETGID --home $SETHOME --shell /bin/bash $SETUSER
+/usr/sbin/usermod -a -G fuse $SETUSER
+exit 0
diff --git a/fuel/build/f_example_control_bond/Makefile b/fuel/build/f_example_control_bond/Makefile
new file mode 100644
index 000000000..0949737bc
--- /dev/null
+++ b/fuel/build/f_example_control_bond/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 tmp
+ @rm -rf release
+
+.PHONY: validate-cache
+validate-cache:
+ @echo "No cache validation schema available for $(shell pwd)"
+ @echo "Continuing ..."
+
+.PHONY: release
+release:
+ @cp -Rvp puppet/modules/* $(PUPPET_DEST)
diff --git a/fuel/build/f_example_control_bond/README b/fuel/build/f_example_control_bond/README
new file mode 100644
index 000000000..4449b2ff2
--- /dev/null
+++ b/fuel/build/f_example_control_bond/README
@@ -0,0 +1,56 @@
+##############################################################################
+# 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
+##############################################################################
+
+This is an example of a modification of the bridge and bonding of interfaces.
+Rationale: Fuel currently don't support bonding of the "Admin" network, which
+becomes a problem if you want to co-locate the single "Admin" and the redundant
+bonded "Management" network on one and the same physical network in order to minimize
+number of NICs, switches and cables.
+This example show how you can modify the bridge and bonding settings and scripts to
+achieve co-location. Of course the FUEL GUI becomes shorted in this respect, I.e.
+the "admin" and "management" network cant be dragged across the NICs in the GUI.
+
+The f_example_control_bond has the following structure:
+.
++--------+----------+-----------+
+ | | |
+ puppet/ Makefile README
+ | (this file)
+ |
+ |
+ modules/
+ |
+ |
+ |
+ opnfv/
+ |
+ +--------------+
+ | |
+ files/ manifests/
+ | |
+ | |
+ | |
+ control-bond control-bond.pp
+
+Makefile:
+Invoked by the git root Makefile, copies the files up to the release build
+directory.
+
+control-bond:
+The control-bond file is the .init file orchestrating the interface-, bridge-
+and bond actions required for enabling the control bond
+
+control-bond.pp:
+The control-bond.pp is the pupet manifest orchestrating the placement and
+configuration of the control-bond shell script file.
+
+To activate this example feature, add "SUBDIRS += f_example_control_bond" in the git root Makefile.
+
+
diff --git a/fuel/build/f_example_control_bond/puppet/modules/opnfv/files/control-bond b/fuel/build/f_example_control_bond/puppet/modules/opnfv/files/control-bond
new file mode 100644
index 000000000..bf2930d73
--- /dev/null
+++ b/fuel/build/f_example_control_bond/puppet/modules/opnfv/files/control-bond
@@ -0,0 +1,90 @@
+##############################################################################
+# 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
+##############################################################################
+
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: control-bond
+# Required-Start: $remote_fs $all
+# Required-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Bonds eth0 and eth1 and changes bridge configuration.
+### END INIT INFO
+
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+VSCTL=/usr/bin/ovs-vsctl
+APPCTL=/usr/bin/ovs-appctl
+
+
+add_control_bond() {
+ logger "Starting addition of control-bond"
+ $VSCTL --may-exist br-fw-admin
+ $VSCTL --may-exist br-mgmt
+ $VSCTL add-bond br-fw-admin bond-control eth0 eth1
+
+ $VSCTL set port br-mgmt tag=66
+ $APPCTL bond/set-active-slave bond-control eth0
+
+ $VSCTL add-port br-fw-admin admin-to-mgmt
+ $VSCTL add-port br-mgmt mgmt-to-admin
+ $VSCTL set interface admin-to-mgmt type=patch
+ $VSCTL set interface mgmt-to-admin type=patch
+
+ $VSCTL set interface admin-to-mgmt options:peer=mgmt-to-admin
+ $VSCTL set interface mgmt-to-admin options:peer=admin-to-mgmt
+
+ $VSCTL set port admin-to-mgmt trunk=66
+ $VSCTL set port mgmt-to-admin trunk=66
+ logger "Finished addition of control-bond"
+}
+
+status_control_bond() {
+ if [ ! -f $VSCTL ]; then
+ return 1
+ else
+ $VSCTL show | grep -q "admin-to-mgmt"
+ return $?
+ fi
+}
+
+case "$1" in
+ start)
+ status_control_bond
+ if [ $? -eq 0 ]; then
+ exit 0
+ else
+ add_control_bond
+ fi
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ status)
+ status_control_bond
+ if [ $? -eq 0 ]; then
+ echo "The control-bond is enabled"
+ exit 0
+ else
+ echo "The control-bond is disabled"
+ exit 1
+ fi
+
+ ;;
+ stop)
+ echo "Stop is not supported"
+ exit 0
+ ;;
+ *)
+ echo "Usage: $0 start|status" >&2
+ exit 3
+ ;;
+esac
diff --git a/fuel/build/f_example_control_bond/puppet/modules/opnfv/manifests/control-bond.pp b/fuel/build/f_example_control_bond/puppet/modules/opnfv/manifests/control-bond.pp
new file mode 100644
index 000000000..22fe78171
--- /dev/null
+++ b/fuel/build/f_example_control_bond/puppet/modules/opnfv/manifests/control-bond.pp
@@ -0,0 +1,56 @@
+##############################################################################
+# 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
+##############################################################################
+
+# Class: opnfv::control-bond
+#
+# Bridge control and management networks together using OVS.
+#
+#
+
+class opnfv::control-bond {
+ notify { '*** In Opnfv::control-bond-start ***': }
+
+ file { "/etc/init.d/control-bond":
+ source => "puppet:///modules/opnfv/control-bond",
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ notify => Service["control-bond"]
+ }
+
+
+ service { "control-bond":
+ ensure => running,
+ require => [ File["/etc/init.d/control-bond"], Service["openvswitch-service"] ],
+ }
+
+ # Only start scripts - we don't want to bring down
+ # bridge during shutdown
+
+ file { "/etc/rc2.d/S18control-bond":
+ ensure => 'link',
+ target => '/etc/init.d/control-bond',
+ }
+
+ file { "/etc/rc3.d/S18control-bond":
+ ensure => 'link',
+ target => '/etc/init.d/control-bond',
+ }
+
+ file { "/etc/rc4.d/S18control-bond":
+ ensure => 'link',
+ target => '/etc/init.d/control-bond',
+ }
+
+ file { "/etc/rc5.d/S18control-bond":
+ ensure => 'link',
+ target => '/etc/init.d/control-bond',
+ }
+}
diff --git a/fuel/build/f_example_packadd/Makefile b/fuel/build/f_example_packadd/Makefile
new file mode 100644
index 000000000..a64293dcb
--- /dev/null
+++ b/fuel/build/f_example_packadd/Makefile
@@ -0,0 +1,42 @@
+##############################################################################
+# 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)
+PACKAGE := foobar
+VERSION := 1.0-1
+DEB_NAME := $(PACKAGE)_$(VERSION).deb
+
+.PHONY: all
+all: release/pool/main/$(DEB_NAME)
+
+release/pool/main/$(DEB_NAME):
+ @mkdir -p tmp/src
+ @mkdir -p release/pool/main
+ @cp -r $(DEB_NAME) tmp/src
+ @gzip -9 tmp/src/$(DEB_NAME)/usr/share/doc/$(PACKAGE)/changelog.Debian
+ @fakeroot dpkg-deb --build tmp/src/$(DEB_NAME)
+ @lintian tmp/src/$(DEB_NAME)
+ @cp tmp/src/$(DEB_NAME) release/pool/main
+
+.PHONY: clean
+clean:
+ @rm -rf tmp
+ @rm -rf release
+ @rm -f ../release/packages/ubuntu/pool/main/$(DEB_NAME)
+
+.PHONY: validate-cache
+validate-cache:
+ @echo "No cache validation schema available for $(shell pwd)"
+ @echo "Continuing ..."
+
+.PHONY: release
+release:release/pool/main/$(DEB_NAME)
+ @cp release/pool/main/$(DEB_NAME) $(DEB_DEST)
+ @cp -Rvp puppet/modules/* $(PUPPET_DEST)
diff --git a/fuel/build/f_example_packadd/README b/fuel/build/f_example_packadd/README
new file mode 100644
index 000000000..55fa7c1a1
--- /dev/null
+++ b/fuel/build/f_example_packadd/README
@@ -0,0 +1,47 @@
+##############################################################################
+# 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
+##############################################################################
+
+This is an example of a an addition of an arbitrary debian package: foobar
+It adds the debian package foobar_1.0-1 to the fuel .iso image and deploys it
+to the controllers and the computes.
+
+The f_example_packadd has the following structure:
+.
++--------+----------+-----------+------------+
+ | | | |
+ puppet/ Makefile README foobar_1.0-1/
+ | (this file) (deb pack)
+ |
+ |
+ modules/
+ |
+ |
+ |
+ opnfv/
+ |
+ |
+ |
+ manifests/
+ |
+ |
+ |
+ foobar.pp
+
+Makefile:
+Invoked by the git root Makefile, based on the foobar_1.0-1 deb pack artifacts, and the pupet manifests, it builds a deb package
+and adds it together with the manifest to a fuel build artifact directory, such that it eventually gets built into the new fuel .iso
+
+foobar_1.0-1:
+Contains arbitrary debian package artifacts
+
+foobar.pp:
+Controls the installation and configuration of foobar
+
+To activate this example feature, add "SUBDIRS += f_example_packadd" in the git root Makefile.
diff --git a/fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/conffiles b/fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/conffiles
new file mode 100644
index 000000000..bad6a0ef5
--- /dev/null
+++ b/fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/conffiles
@@ -0,0 +1 @@
+/etc/foobar/foobar.conf
diff --git a/fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/control b/fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/control
new file mode 100644
index 000000000..f3f0eb603
--- /dev/null
+++ b/fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/control
@@ -0,0 +1,10 @@
+Package: foobar
+Version: 1.0-1
+Section: utils
+Priority: optional
+Architecture: amd64
+Depends: python2.7
+Maintainer: Main Tainer <maintainer@somwhere.org>
+Description: foo bar daemon
+ This is a daemon for the Foobar service.
+ Foo is bar!
diff --git a/fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/postinst b/fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/postinst
new file mode 100755
index 000000000..f48f26075
--- /dev/null
+++ b/fuel/build/f_example_packadd/foobar_1.0-1/DEBIAN/postinst
@@ -0,0 +1,2 @@
+#!/bin/bash -e
+date
diff --git a/fuel/build/f_example_packadd/foobar_1.0-1/etc/foobar/foobar.conf b/fuel/build/f_example_packadd/foobar_1.0-1/etc/foobar/foobar.conf
new file mode 100644
index 000000000..e0eee5c7a
--- /dev/null
+++ b/fuel/build/f_example_packadd/foobar_1.0-1/etc/foobar/foobar.conf
@@ -0,0 +1,2 @@
+# Foobar config file
+foo=bar
diff --git a/fuel/build/f_example_packadd/foobar_1.0-1/usr/bin/foobar b/fuel/build/f_example_packadd/foobar_1.0-1/usr/bin/foobar
new file mode 100755
index 000000000..c9651a463
--- /dev/null
+++ b/fuel/build/f_example_packadd/foobar_1.0-1/usr/bin/foobar
@@ -0,0 +1,2 @@
+#!/bin/bash
+echo Hello from the foobar package
diff --git a/fuel/build/f_example_packadd/foobar_1.0-1/usr/share/doc/foobar/changelog.Debian b/fuel/build/f_example_packadd/foobar_1.0-1/usr/share/doc/foobar/changelog.Debian
new file mode 100644
index 000000000..fe776f33e
--- /dev/null
+++ b/fuel/build/f_example_packadd/foobar_1.0-1/usr/share/doc/foobar/changelog.Debian
@@ -0,0 +1,5 @@
+foobar (1.0-1) precise-proposed; urgency=low
+
+ * Genesis
+
+ -- Main Tainer <maintainer@somewhere.org> Tue, 23 Sep 2014 11:13:27 +0200
diff --git a/fuel/build/f_example_packadd/foobar_1.0-1/usr/share/doc/foobar/copyright b/fuel/build/f_example_packadd/foobar_1.0-1/usr/share/doc/foobar/copyright
new file mode 100644
index 000000000..4279ce4e2
--- /dev/null
+++ b/fuel/build/f_example_packadd/foobar_1.0-1/usr/share/doc/foobar/copyright
@@ -0,0 +1,18 @@
+foobar - a test daemon
+Copyright (C) 2014 Main Tainer
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License with
+your Debian GNU system, in /usr/share/common-licenses/GPL, or with the
+Debian GNU gnupg source package as the file COPYING. If not, see
+<http://www.gnu.org/licenses/> or write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/fuel/build/f_example_packadd/puppet/modules/opnfv/manifests/foobar.pp b/fuel/build/f_example_packadd/puppet/modules/opnfv/manifests/foobar.pp
new file mode 100644
index 000000000..c6219baa8
--- /dev/null
+++ b/fuel/build/f_example_packadd/puppet/modules/opnfv/manifests/foobar.pp
@@ -0,0 +1,7 @@
+class opnfv::foobar {
+ if $::osfamily == 'Debian' {
+ package { 'foobar':
+ ensure => installed,
+ }
+ }
+}
diff --git a/fuel/build/f_isoroot/Makefile b/fuel/build/f_isoroot/Makefile
new file mode 100644
index 000000000..a9b12d927
--- /dev/null
+++ b/fuel/build/f_isoroot/Makefile
@@ -0,0 +1,35 @@
+##############################################################################
+# 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
+##############################################################################
+
+SUBDIRS = f_kscfg f_bootstrap f_repobuild f_odlpluginbuild
+SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
+
+.PHONY: all
+all: $(SUBDIRS)
+
+.PHONY: $(SUBDIRS)
+$(SUBDIRS):
+ @mkdir -p release
+ $(MAKE) -C $@ -f Makefile release
+
+.PHONY: clean $(SUBCLEAN)
+clean: $(SUBCLEAN)
+ @rm -Rf release
+
+$(SUBCLEAN): %.clean:
+ $(MAKE) -C $* -f Makefile clean
+
+validate-cache:
+ @echo "No cache validation schema available for $(shell pwd)"
+ @echo "Continuing ..."
+
+.PHONY: release
+release:clean $(SUBDIRS)
+ @cp -Rvp release/* ../release/isoroot
diff --git a/fuel/build/f_isoroot/README b/fuel/build/f_isoroot/README
new file mode 100644
index 000000000..eb54c0827
--- /dev/null
+++ b/fuel/build/f_isoroot/README
@@ -0,0 +1,16 @@
+##############################################################################
+# 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
+##############################################################################
+
+This is to (a) replace/patch existing Fuel ISO files as well
+as adding new information directly into the ISO structure
+
+Please separate changes into "patches" and new content into
+"additions". Both directories will be anchored at the ISO file
+root.
diff --git a/fuel/build/f_isoroot/f_bootstrap/Makefile b/fuel/build/f_isoroot/f_bootstrap/Makefile
new file mode 100644
index 000000000..7404319d9
--- /dev/null
+++ b/fuel/build/f_isoroot/f_bootstrap/Makefile
@@ -0,0 +1,29 @@
+##############################################################################
+# 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:
+ @mkdir -p release/opnfv/bootstrap/pre.d
+ @mkdir -p release/opnfv/bootstrap/post.d
+ @mkdir -p release/usr/local/sbin
+ @cp pre-scripts/* release/opnfv/bootstrap/pre.d
+ @cp post-scripts/* release/opnfv/bootstrap/post.d
+ @cp bootstrap_admin_node.sh release
+ @cp bootstrap_admin_node.sh.orig release
+
+.PHONY: clean
+clean:
+ @rm -rf release
+
+.PHONY: release
+release:all
+ @cp -Rvp release/* ../release
diff --git a/fuel/build/f_isoroot/f_bootstrap/README b/fuel/build/f_isoroot/f_bootstrap/README
new file mode 100644
index 000000000..5da954ca4
--- /dev/null
+++ b/fuel/build/f_isoroot/f_bootstrap/README
@@ -0,0 +1,24 @@
+##############################################################################
+# 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
+##############################################################################
+
+This function modifies the adds hooks to the beginning and end of
+/usr/local/sbin/bootstrap_admin_nodes.sh, which is run as the
+last post step from ks.cfg
+
+This enables other functions to place scripts into two directories
+run either at the beginning or the end of the bootstrap procedure:
+
+ /opt/opnfv/bootstrap/pre.d
+ /opt/opnfv/bootstrap/post.d
+
+These will be run in lexical order at pre or post.
+
+CI note: Using pre.d, it would be possible to "inject" a pre-defined
+astute.yaml for Fuel.
diff --git a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
new file mode 100755
index 000000000..8bdf5667c
--- /dev/null
+++ b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
@@ -0,0 +1,172 @@
+#!/bin/bash
+FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ')
+
+function countdown() {
+ local i
+ sleep 1
+ for ((i=$1-1; i>=1; i--)); do
+ printf '\b\b%02d' "$i"
+ sleep 1
+ done
+}
+
+function fail() {
+ echo "ERROR: Fuel node deployment FAILED! Check /var/log/puppet/bootstrap_admin_node.log for details" 1>&2
+ exit 1
+}
+# LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details
+export LANG=en_US.UTF8
+showmenu="no"
+if [ -f /root/.showfuelmenu ]; then
+ . /root/.showfuelmenu
+fi
+
+echo -n "Applying default Fuel settings..."
+fuelmenu --save-only --iface=eth0
+echo "Done!"
+
+### OPNFV addition BEGIN
+shopt -s nullglob
+for script in /opt/opnfv/bootstrap/pre.d/*.sh
+do
+ echo "Pre script: $script" >> /root/pre.log 2>&1
+ $script >> /root/pre.log 2>&1
+done
+shopt -u nullglob
+### OPNFV addition END
+
+if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
+ fuelmenu
+ else
+ #Give user 15 seconds to enter fuelmenu or else continue
+ echo
+ echo -n "Press a key to enter Fuel Setup (or press ESC to skip)... 15"
+ countdown 15 & pid=$!
+ if ! read -s -n 1 -t 15 key; then
+ echo -e "\nSkipping Fuel Setup..."
+ else
+ { kill "$pid"; wait $!; } 2>/dev/null
+ case "$key" in
+ $'\e') echo "Skipping Fuel Setup.."
+ ;;
+ *) echo -e "\nEntering Fuel Setup..."
+ fuelmenu
+ ;;
+ esac
+ fi
+fi
+
+
+#Reread /etc/sysconfig/network to inform puppet of changes
+. /etc/sysconfig/network
+hostname "$HOSTNAME"
+
+service docker start
+
+if [ -f /root/.build_images ]; then
+ #Fail on all errors
+ set -e
+ trap fail EXIT
+
+ echo "Loading Fuel base image for Docker..."
+ docker load -i /var/www/nailgun/docker/images/fuel-images.tar
+
+ echo "Building Fuel Docker images..."
+ WORKDIR=$(mktemp -d /tmp/docker-buildXXX)
+ SOURCE=/var/www/nailgun/docker
+ REPO_CONT_ID=$(docker -D run -d -p 80 -v /var/www/nailgun:/var/www/nailgun fuel/centos sh -c 'mkdir /var/www/html/os;ln -sf /var/www/nailgun/centos/x86_64 /var/www/html/os/x86_64;/usr/sbin/apachectl -DFOREGROUND')
+ RANDOM_PORT=$(docker port $REPO_CONT_ID 80 | cut -d':' -f2)
+
+ for imagesource in /var/www/nailgun/docker/sources/*; do
+ if ! [ -f "$imagesource/Dockerfile" ]; then
+ echo "Skipping ${imagesource}..."
+ continue
+ fi
+ image=$(basename "$imagesource")
+ cp -R "$imagesource" $WORKDIR/$image
+ mkdir -p $WORKDIR/$image/etc
+ cp -R /etc/puppet /etc/fuel $WORKDIR/$image/etc
+ sed -e "s/_PORT_/${RANDOM_PORT}/" -i $WORKDIR/$image/Dockerfile
+ sed -e 's/production:.*/production: "docker-build"/' -i $WORKDIR/$image/etc/fuel/version.yaml
+ docker build -t fuel/${image}_${FUEL_RELEASE} $WORKDIR/$image
+ done
+ docker rm -f $REPO_CONT_ID
+ rm -rf "$WORKDIR"
+
+ #Remove trap for normal deployment
+ trap - EXIT
+ set +e
+else
+ echo "Loading docker images. (This may take a while)"
+ docker load -i /var/www/nailgun/docker/images/fuel-images.tar
+fi
+
+# apply puppet
+puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp
+if [ $? -ge 4 ];then
+ fail
+fi
+rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote
+
+dockerctl check || fail
+bash /etc/rc.local
+
+### OPNFV addition BEGIN
+shopt -s nullglob
+for script in /opt/opnfv/bootstrap/post.d/*.sh
+do
+ echo "Post script: $script" >> /root/post.log 2>&1
+ $script >> /root/post.log 2>&1
+done
+shopt -u nullglob
+### OPNFV addition END
+
+# Enable updates repository
+cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-updates.repo << EOF
+[mos${FUEL_RELEASE}-updates]
+name=mos${FUEL_RELEASE}-updates
+baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/updates/
+gpgcheck=0
+skip_if_unavailable=1
+EOF
+
+# Enable security repository
+cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-security.repo << EOF
+[mos${FUEL_RELEASE}-security]
+name=mos${FUEL_RELEASE}-security
+baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/security/
+gpgcheck=0
+skip_if_unavailable=1
+EOF
+
+#Check if repo is accessible
+echo "Checking for access to updates repository..."
+repourl=$(grep baseurl /etc/yum.repos.d/*updates* 2>/dev/null | cut -d'=' -f2- | head -1)
+if urlaccesscheck check "$repourl" ; then
+ UPDATE_ISSUES=0
+else
+ UPDATE_ISSUES=1
+fi
+
+if [ $UPDATE_ISSUES -eq 1 ]; then
+ warning="WARNING: There are issues connecting to Fuel update repository.\
+\nPlease fix your connection and update this node with \`yum update\`\
+\nThen run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
+\nto repeat bootstrap on Fuel Master with the latest updates.\
+\nFor more information, check out Fuel documentation at:\
+\nhttp://docs.mirantis.com/fuel"
+else
+ warning="WARNING: There may be updates available for Fuel.\
+\nYou should update this node with \`yum update\`. If there are available\
+\n updates, run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
+\nto repeat bootstrap on Fuel Master with the latest updates.\
+\nFor more information, check out Fuel documentation at:\
+\nhttp://docs.mirantis.com/fuel"
+fi
+echo
+echo "*************************************************"
+echo -e "$warning"
+echo "*************************************************"
+echo "Sending notification to Fuel UI..."
+fuel notify --topic warning --send "$warning"
+echo "Fuel node deployment complete!"
diff --git a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
new file mode 100755
index 000000000..8d21c1e72
--- /dev/null
+++ b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
@@ -0,0 +1,152 @@
+#!/bin/bash
+FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ')
+
+function countdown() {
+ local i
+ sleep 1
+ for ((i=$1-1; i>=1; i--)); do
+ printf '\b\b%02d' "$i"
+ sleep 1
+ done
+}
+
+function fail() {
+ echo "ERROR: Fuel node deployment FAILED! Check /var/log/puppet/bootstrap_admin_node.log for details" 1>&2
+ exit 1
+}
+# LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details
+export LANG=en_US.UTF8
+showmenu="no"
+if [ -f /root/.showfuelmenu ]; then
+ . /root/.showfuelmenu
+fi
+
+echo -n "Applying default Fuel settings..."
+fuelmenu --save-only --iface=eth0
+echo "Done!"
+
+if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
+ fuelmenu
+ else
+ #Give user 15 seconds to enter fuelmenu or else continue
+ echo
+ echo -n "Press a key to enter Fuel Setup (or press ESC to skip)... 15"
+ countdown 15 & pid=$!
+ if ! read -s -n 1 -t 15 key; then
+ echo -e "\nSkipping Fuel Setup..."
+ else
+ { kill "$pid"; wait $!; } 2>/dev/null
+ case "$key" in
+ $'\e') echo "Skipping Fuel Setup.."
+ ;;
+ *) echo -e "\nEntering Fuel Setup..."
+ fuelmenu
+ ;;
+ esac
+ fi
+fi
+
+
+#Reread /etc/sysconfig/network to inform puppet of changes
+. /etc/sysconfig/network
+hostname "$HOSTNAME"
+
+service docker start
+
+if [ -f /root/.build_images ]; then
+ #Fail on all errors
+ set -e
+ trap fail EXIT
+
+ echo "Loading Fuel base image for Docker..."
+ docker load -i /var/www/nailgun/docker/images/fuel-images.tar
+
+ echo "Building Fuel Docker images..."
+ WORKDIR=$(mktemp -d /tmp/docker-buildXXX)
+ SOURCE=/var/www/nailgun/docker
+ REPO_CONT_ID=$(docker -D run -d -p 80 -v /var/www/nailgun:/var/www/nailgun fuel/centos sh -c 'mkdir /var/www/html/os;ln -sf /var/www/nailgun/centos/x86_64 /var/www/html/os/x86_64;/usr/sbin/apachectl -DFOREGROUND')
+ RANDOM_PORT=$(docker port $REPO_CONT_ID 80 | cut -d':' -f2)
+
+ for imagesource in /var/www/nailgun/docker/sources/*; do
+ if ! [ -f "$imagesource/Dockerfile" ]; then
+ echo "Skipping ${imagesource}..."
+ continue
+ fi
+ image=$(basename "$imagesource")
+ cp -R "$imagesource" $WORKDIR/$image
+ mkdir -p $WORKDIR/$image/etc
+ cp -R /etc/puppet /etc/fuel $WORKDIR/$image/etc
+ sed -e "s/_PORT_/${RANDOM_PORT}/" -i $WORKDIR/$image/Dockerfile
+ sed -e 's/production:.*/production: "docker-build"/' -i $WORKDIR/$image/etc/fuel/version.yaml
+ docker build -t fuel/${image}_${FUEL_RELEASE} $WORKDIR/$image
+ done
+ docker rm -f $REPO_CONT_ID
+ rm -rf "$WORKDIR"
+
+ #Remove trap for normal deployment
+ trap - EXIT
+ set +e
+else
+ echo "Loading docker images. (This may take a while)"
+ docker load -i /var/www/nailgun/docker/images/fuel-images.tar
+fi
+
+# apply puppet
+puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp
+if [ $? -ge 4 ];then
+ fail
+fi
+rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote
+
+dockerctl check || fail
+bash /etc/rc.local
+
+# Enable updates repository
+cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-updates.repo << EOF
+[mos${FUEL_RELEASE}-updates]
+name=mos${FUEL_RELEASE}-updates
+baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/updates/
+gpgcheck=0
+skip_if_unavailable=1
+EOF
+
+# Enable security repository
+cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-security.repo << EOF
+[mos${FUEL_RELEASE}-security]
+name=mos${FUEL_RELEASE}-security
+baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/security/
+gpgcheck=0
+skip_if_unavailable=1
+EOF
+
+#Check if repo is accessible
+echo "Checking for access to updates repository..."
+repourl=$(grep baseurl /etc/yum.repos.d/*updates* 2>/dev/null | cut -d'=' -f2- | head -1)
+if urlaccesscheck check "$repourl" ; then
+ UPDATE_ISSUES=0
+else
+ UPDATE_ISSUES=1
+fi
+
+if [ $UPDATE_ISSUES -eq 1 ]; then
+ warning="WARNING: There are issues connecting to Fuel update repository.\
+\nPlease fix your connection and update this node with \`yum update\`\
+\nThen run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
+\nto repeat bootstrap on Fuel Master with the latest updates.\
+\nFor more information, check out Fuel documentation at:\
+\nhttp://docs.mirantis.com/fuel"
+else
+ warning="WARNING: There may be updates available for Fuel.\
+\nYou should update this node with \`yum update\`. If there are available\
+\n updates, run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
+\nto repeat bootstrap on Fuel Master with the latest updates.\
+\nFor more information, check out Fuel documentation at:\
+\nhttp://docs.mirantis.com/fuel"
+fi
+echo
+echo "*************************************************"
+echo -e "$warning"
+echo "*************************************************"
+echo "Sending notification to Fuel UI..."
+fuel notify --topic warning --send "$warning"
+echo "Fuel node deployment complete!"
diff --git a/fuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh
new file mode 100755
index 000000000..7ac896589
--- /dev/null
+++ b/fuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh
@@ -0,0 +1,4 @@
+#/bin/sh
+date
+echo "This is an example file run at post-bootstrap."
+exit 0
diff --git a/fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh
new file mode 100755
index 000000000..427a55add
--- /dev/null
+++ b/fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh
@@ -0,0 +1,19 @@
+#/bin/sh
+echo "Installing pre-build repo"
+if [ ! -d /opt/opnfv/nailgun ]; then
+ echo "Error - found no repo!"
+ exit 1
+fi
+
+mkdir -p /var/www/nailgun
+mv /opt/opnfv/nailgun/* /var/www/nailgun
+if [ $? -ne 0 ]; then
+ echo "Error moving repos to their correct location!"
+ exit 1
+fi
+rmdir /opt/opnfv/nailgun
+if [ $? -ne 0 ]; then
+ echo "Error removing /opt/opnfv/nailgun directory!"
+ exit 1
+fi
+echo "Done installing pre-build repo"
diff --git a/fuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh b/fuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh
new file mode 100755
index 000000000..ac427bf87
--- /dev/null
+++ b/fuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh
@@ -0,0 +1,4 @@
+#/bin/sh
+date
+echo "This is an example file run at pre-bootstrap."
+exit 0
diff --git a/fuel/build/f_isoroot/f_kscfg/Makefile b/fuel/build/f_isoroot/f_kscfg/Makefile
new file mode 100644
index 000000000..38305fd50
--- /dev/null
+++ b/fuel/build/f_isoroot/f_kscfg/Makefile
@@ -0,0 +1,25 @@
+##############################################################################
+# 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:
+ @mkdir -p release
+ @cp ks.cfg release
+ @cp ks.cfg.orig release
+
+.PHONY: clean
+clean:
+ @rm -rf release
+
+.PHONY: release
+release: all
+ @cp -Rvp release/* ../release
diff --git a/fuel/build/f_isoroot/f_kscfg/README b/fuel/build/f_isoroot/f_kscfg/README
new file mode 100644
index 000000000..c85efde77
--- /dev/null
+++ b/fuel/build/f_isoroot/f_kscfg/README
@@ -0,0 +1,18 @@
+##############################################################################
+# 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
+##############################################################################
+
+This function modifies the ks.cfg of the Fuel master to
+make copy whatever is in the top level opnfv directory
+of the ISO (populated by, for example, f_configfrontend) to
+/opt/opnfv. In the end this is where the installation
+parts will evolve.
+
+This is also the place to force the installation to overwrite
+the disk (set forceformat="yes" instead of "no").
diff --git a/fuel/build/f_isoroot/f_kscfg/ks.cfg b/fuel/build/f_isoroot/f_kscfg/ks.cfg
new file mode 100644
index 000000000..12cd1abab
--- /dev/null
+++ b/fuel/build/f_isoroot/f_kscfg/ks.cfg
@@ -0,0 +1,598 @@
+install
+text
+%include /tmp/source.ks
+reboot --eject
+lang en_US.UTF-8
+keyboard us
+rootpw r00tme
+timezone --utc Etc/UTC
+firewall --disabled
+selinux --disabled
+# ignore unsupported hardware warning
+unsupported_hardware
+# SKIP CONFIGURING X
+skipx
+# NEVER ever place zerombr here, it breaks automated installation
+%include /tmp/bootloader.ks
+%include /tmp/partition.ks
+
+# PREINSTALL SECTION
+# HERE ARE COMMANDS THAT WILL BE LAUNCHED BEFORE
+# INSTALLATION PROCESS ITSELF
+%pre
+#!/bin/sh
+
+# hard drives
+drives=""
+removable_drives=""
+for drv in `ls -1 /sys/block | grep "sd\|hd\|vd\|cciss"`; do
+ if !(blkid | grep -q "${drv}.*Fuel"); then
+ if (grep -q 0 /sys/block/${drv}/removable); then
+ drives="${drives} ${drv}"
+ else
+ removable_drives="${removable_drives} ${drv}"
+ fi
+ fi
+done
+default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'`
+
+installdrive="undefined"
+forceformat="no"
+for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+
+set ${drives} ${removable_drives}
+numdrives=`echo $#`
+
+tgtdrive="${installdrive}"
+
+function confirm_format {
+ check_drive="$1"
+ local confirm_format="no"
+
+ if [[ "$forceformat" == "yes" ]] ; then
+ return 0
+ fi
+
+ if parted -s /dev/$check_drive print &>/dev/null ; then
+ echo
+ echo "$check_drive drive contains partition table:"
+ parted -s /dev/$check_drive print
+ echo
+ read -p "Are you sure you want to erase ALL data on disk $check_drive? (y/N)" confirm_format
+ if [[ "$confirm_format" == "y" ]] || [[ "$confirm_format" == "Y" ]] || [[ "$forceformat" == "yes" ]]; then
+ return 0
+ else
+ return 1
+ fi
+ else
+ return 0
+ fi
+}
+
+format_confirmed="no"
+
+if [ $numdrives -lt 1 ]; then
+ exec < /dev/tty3 > /dev/tty3 2>&1
+ chvt 3
+ clear
+ echo
+ echo '********************************************************************'
+ echo '* E R R O R *'
+ echo '* *'
+ echo '* There is no suitable media available for installation. *'
+ echo '* Please attach a drive and try again. *'
+ echo '* *'
+ echo '********************************************************************'
+ echo
+ read -p "Press Enter to shut down the system: " _
+ poweroff
+fi
+
+if [ ${numdrives} -gt 1 ] || [ `echo ${drives} | wc -w` -eq 0 ] ; then
+ exec < /dev/tty3 > /dev/tty3 2>&1
+ chvt 3
+ while [ "${tgtdrive}" = "undefined" ]; do
+ clear
+ echo
+ echo '********************************************************************************'
+ echo '* W A R N I N G *'
+ echo '* *'
+ echo '* Which of the detected hard drives do you want to be used as *'
+ echo '* the installation target? *'
+ echo '* *'
+ echo '********************************************************************************'
+ echo
+ echo "Possible choices"
+ echo "Persistent drives: ${drives}"
+ echo "Removable drives: ${removable_drives}"
+ echo
+ if [ `echo ${drives} | wc -w` -eq 1 ] ; then
+ read -t 30 -p "Choose hard drive: " tgtdrive || tgtdrive=$default_drive
+ else
+ read -p "Choose hard drive: " tgtdrive
+ fi
+ match="no"
+ for drive in ${drives[@]} ${removable_drives[@]}; do
+ if [[ "$drive" == "$tgtdrive" ]] && match="yes" ; then
+ if confirm_format $tgtdrive ; then
+ format_confirmed="yes"
+ break
+ else
+ tgtdrive="undefined"
+ read -p "You may select another disk. Press Enter to continue." _
+ fi
+ fi
+ done
+ if [[ "$match" == "no" ]]; then
+ tgtdrive="undefined"
+ read -p "Invalid choice. Press Enter to continue." _
+ fi
+ done
+ clear
+ chvt 1
+else
+ tgtdrive=`echo ${drives} | sed -e "s/^\s*//" -e "s/\s*$//"`
+fi
+
+if [ "$format_confirmed" != "yes" ] ; then
+ exec < /dev/tty3 > /dev/tty3 2>&1
+ chvt 3
+ if ! confirm_format $tgtdrive ; then
+ clear
+ echo
+ echo '********************************************************************'
+ echo '* E R R O R *'
+ echo '* *'
+ echo '* Disk $tgtdrive contains active partition(s). *'
+ echo '* Installation cannot continue without confirmation. *'
+ echo '* *'
+ echo '********************************************************************'
+ echo
+ read -p "Press Enter to restart: " _
+ reboot
+ fi
+ chvt 1
+fi
+
+# verify tgtdrive is at least 41GB
+tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 ))
+if [ $tgtdrivesize -lt 41984 ]; then
+ exec < /dev/tty3 > /dev/tty3 2>&1
+ chvt 3
+ clear
+ echo
+ echo '********************************************************************'
+ echo '* E R R O R *'
+ echo '* *'
+ echo '* Your disk is under 41GB in size. Installation cannot continue. *'
+ echo '* Restart installation with a larger disk. *'
+ echo '* *'
+ echo '********************************************************************'
+ echo
+ read -p "Press Enter to restart: " _
+ reboot
+fi
+
+# paths in /dev have "/" instead of "!" for cciss devices
+tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//')
+
+# source
+if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
+ echo "harddrive --partition=LABEL="OpenStack_Fuel" --dir=/" > /tmp/source.ks
+elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
+ echo "harddrive --partition=UUID=will_be_substituted_with_actual_uuid --dir=/" > /tmp/source.ks
+else
+ echo "cdrom" > /tmp/source.ks
+fi
+
+vgremove -ff os
+dd if=/dev/zero of=/dev/${tgtdrive} bs=10M count=10
+sleep 3
+hdparm -z /dev/${tgtdrive}
+parted -s /dev/${tgtdrive} mklabel gpt
+parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0 24
+parted -s /dev/${tgtdrive} set 1 bios_grub on
+parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary fat16 24 224
+parted -s /dev/${tgtdrive} set 2 boot on
+parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 224 424
+sleep 3
+hdparm -z /dev/${tgtdrive}
+
+# partition
+
+# This adds support for the p seperator required for cciss devices
+if echo ${tgtdrive} | grep -q -e cciss ; then
+ bootdev=${tgtdrive}p
+else
+ bootdev=${tgtdrive}
+fi
+echo > /tmp/partition.ks
+echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks
+echo "partition /boot/efi --onpart=/dev/${bootdev}2" >> /tmp/partition.ks
+echo "partition pv.001 --ondisk=${tgtdrive} --size=41000 --grow" >> /tmp/partition.ks
+echo "volgroup os pv.001" >> /tmp/partition.ks
+echo "logvol swap --vgname=os --recommended --name=swap" >> /tmp/partition.ks
+echo "logvol / --vgname=os --size=10000 --name=root --fstype=ext4" >> /tmp/partition.ks
+echo "logvol /var --vgname=os --size=10000 --percent 30 --grow --name=var --fstype=ext4" >> /tmp/partition.ks
+echo "logvol /var/lib/docker --vgname=os --size=17000 --percent 20 --grow --name=varlibdocker --fstype=ext4" >> /tmp/partition.ks
+echo "logvol /var/log --vgname=os --size=4096 --percent 50 --grow --name=varlog --fstype=ext4" >> /tmp/partition.ks
+
+
+# bootloader
+echo "bootloader --location=partition --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
+
+# Anaconda can not install grub 0.97 on disks which are >4T.
+# The reason is that grub does not support such large geometries
+# and it simply thinks that the cylinder number has negative value.
+# Here we just set geometry manually so that grub thinks that disk
+# size is equal to 1G.
+# 130 cylinders * (16065 * 512 = 8225280 bytes) = 1G
+echo "%post --nochroot --log=/mnt/sysimage/root/anaconda-post-partition.log" > /tmp/post_partition.ks
+echo "echo \"device (hd0) /dev/${tgtdrive}\" >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "echo \"geometry (hd0) 130 255 63\" >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "echo \"root (hd0,2)\" >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "echo \"install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf\" >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "echo quit >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "cat /tmp/grub.script | chroot /mnt/sysimage /sbin/grub --no-floppy --batch" >> /tmp/post_partition.ks
+
+%end
+
+%packages --nobase --excludedocs
+@Core
+fuel
+fuel-library
+fuel-dockerctl
+authconfig
+bind-utils
+cronie
+crontabs
+curl
+daemonize
+dhcp
+docker-io
+fuel-bootstrap-image
+fuel-createmirror
+fuel-target-centos-images
+fuel-package-updates
+fuelmenu
+fuel-docker-images
+gdisk
+lrzip
+lsof
+man
+mlocate
+nmap-ncat
+ntp
+ntpdate
+openssh-clients
+policycoreutils
+python-daemon
+rsync
+ruby21-puppet
+ruby21-rubygem-netaddr
+ruby21-rubygem-openstack
+selinux-policy-targeted
+strace
+subscription-manager
+sysstat
+system-config-firewall-base
+tcpdump
+telnet
+vim-enhanced
+virt-what
+wget
+yum
+yum-plugin-priorities
+
+%include /tmp/post_partition.ks
+
+# POSTINSTALL SECTION
+# HERE ARE COMMANDS THAT WILL BE LAUNCHED JUST AFTER
+# INSTALLATION ITSELF COMPLETED
+%post
+echo -e "modprobe nf_conntrack_ipv4\nmodprobe nf_conntrack_ipv6\nmodprobe nf_conntrack_tftp\nmodprobe nf_nat_tftp" >> /etc/rc.modules
+chmod +x /etc/rc.modules
+echo -e "net.nf_conntrack_max=1048576" >> /etc/sysctl.conf
+mkdir -p /var/log/coredump
+echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" >> /etc/sysctl.conf
+chmod 777 /var/log/coredump
+echo -e "* soft core unlimited\n* hard core unlimited" >> /etc/security/limits.conf
+
+# Mount installation media in chroot
+%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log
+#!/bin/sh
+
+set -x
+
+SOURCE="/mnt/sysimage/tmp/source"
+
+for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+
+mkdir -p "${SOURCE}"
+
+case "${repo}" in
+ nfs:*)
+ nfs_url="${repo#nfs:}"
+ mount -t nfs "${nfs_url}" "${SOURCE}"
+ ;;
+ *)
+ if [ -d "/mnt/source" ]; then
+ mount -o bind "/mnt/source" "${SOURCE}"
+ fi
+ ;;
+esac
+
+%post --log=/root/anaconda-post-after-chroot.log
+#!/bin/bash
+
+set -x
+
+function save_cfg {
+ scrFile="/etc/sysconfig/network-scripts/ifcfg-$device"
+ search="domain $domain\nsearch $domain"
+ sed -i -e 's#^\(HOSTNAME=\).*$#\1'"$hostname"'#' /etc/sysconfig/network
+ grep -q "^\s*$ip\s+$hostname" /etc/hosts || echo "$ip $hostname" >> /etc/hosts
+ echo "${search}\nnameserver 127.0.0.1" > /etc/resolv.conf
+ [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/resolv.conf
+ [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/dnsmasq.upstream
+ [ $dns2 ] && echo "nameserver $dns2" >> /etc/resolv.conf
+ [ $dns2 ] && echo "nameserver $dns2" >> /etc/dnsmasq.upstream
+
+ echo DEVICE=$device > $scrFile
+ echo ONBOOT=yes >> $scrFile
+ echo NM_CONTROLLED=no >> $scrFile
+ echo HWADDR=$hwaddr >> $scrFile
+ echo USERCTL=no >> $scrFile
+ echo PEERDNS=no >> $scrFile
+ if [ $ip ]; then
+ echo BOOTPROTO=static >> $scrFile
+ echo IPADDR=$ip >> $scrFile
+ echo NETMASK=$netmask >> $scrFile
+ else
+ echo BOOTPROTO=dhcp >> $scrFile
+ fi
+ scrDHCPFile="/etc/sysconfig/network-scripts/ifcfg-$dhcp_interface"
+ #Ignore gateway and set up DHCP if it is used, otherwise apply it
+ if [ $dhcp_interface ] && [ "$dhcp_interface" != "$device" ]; then
+ echo "DEVICE=$dhcp_interface" > $scrDHCPFile
+ echo "BOOTPROTO=dhcp" >> $scrDHCPFile
+ echo "ONBOOT=yes" >> $scrDHCPFile
+ echo "USERCTL=no" >> $scrDHCPFile
+ else
+ echo GATEWAY=$gw >> /etc/sysconfig/network
+ fi
+ [ -n "$build_images" -a "$build_images" != "0" ] && echo -e "$build_images" > /root/.build_images
+}
+
+# Default FQDN
+hostname="nailgun.mirantis.com"
+
+for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+hostname=$hostname
+domain=${hostname#*.}
+ip=$ip
+netmask=$netmask
+gw=$gw
+device="eth0"
+hwaddr=`ifconfig $device | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
+dhcp_interface=$dhcp_interface
+build_images=$build_images
+save_cfg
+
+# Mounting installation source
+SOURCE=/tmp/source
+FS=/tmp/fs
+
+echo
+mkdir -p ${SOURCE}
+mkdir -p ${FS}
+
+if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
+ mount /dev/disk/by-label/"OpenStack_Fuel" ${SOURCE}
+elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
+ mount /dev/disk/by-uuid/will_be_substituted_with_actual_uuid ${FS}
+ mount -o loop ${FS}/nailgun.iso ${SOURCE}
+fi
+
+OPENSTACK_VERSION=`cat ${SOURCE}/openstack_version`
+
+# ----------------------
+# UNPACKING REPOSITORIES
+# ----------------------
+
+wwwdir="/var/www/nailgun"
+repodir="${wwwdir}/${OPENSTACK_VERSION}"
+
+# Copying Centos files
+mkdir -p ${repodir}/centos/x86_64
+cp -r ${SOURCE}/images ${repodir}/centos/x86_64
+cp -r ${SOURCE}/isolinux ${repodir}/centos/x86_64
+cp -r ${SOURCE}/repodata ${repodir}/centos/x86_64
+cp -r ${SOURCE}/Packages ${repodir}/centos/x86_64
+cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64
+
+# Copying Ubuntu files
+mkdir -p ${repodir}/ubuntu/x86_64/images
+cp -r ${SOURCE}/ubuntu/dists ${repodir}/ubuntu/x86_64
+cp -r ${SOURCE}/ubuntu/pool ${repodir}/ubuntu/x86_64
+
+# We do not ship debian-installer kernel and initrd on ISO.
+# But we still need to be able to create ubuntu cobbler distro
+# which requires kernel and initrd to be available. So, we
+# just touch these files to work around cobbler's limitation.
+touch ${repodir}/ubuntu/x86_64/images/linux
+touch ${repodir}/ubuntu/x86_64/images/initrd.gz
+
+# make links for backward compatibility
+ln -s ${repodir}/centos ${wwwdir}/centos
+ln -s ${repodir}/ubuntu ${wwwdir}/ubuntu
+
+# --------------------------
+# UNPACKING PUPPET MANIFESTS
+# --------------------------
+
+# create folders
+#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/manifests/
+#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/modules/
+#rm -rf /etc/puppet/modules/
+
+# TODO(ikalnitsky): investigate why we need this
+#cp ${SOURCE}/puppet-slave.tgz ${wwwdir}/
+
+# place modules and manifests
+#tar zxf ${SOURCE}/puppet-slave.tgz -C /etc/puppet/${OPENSTACK_VERSION}/modules
+#cp /etc/puppet/${OPENSTACK_VERSION}/modules/osnailyfacter/examples/site.pp /etc/puppet/${OPENSTACK_VERSION}/manifests/site.pp
+cp ${SOURCE}/centos-versions.yaml ${SOURCE}/ubuntu-versions.yaml /etc/puppet/${OPENSTACK_VERSION}/manifests/
+
+# make links for backward compatibility
+#pushd /etc/puppet
+#ln -s ${OPENSTACK_VERSION}/manifests/ /etc/puppet/manifests
+#ln -s ${OPENSTACK_VERSION}/modules/ /etc/puppet/modules
+#popd
+
+cp ${SOURCE}/send2syslog.py /bin/send2syslog.py
+mkdir -p /var/lib/hiera
+touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml
+
+# Prepare local repository specification
+rm /etc/yum.repos.d/CentOS*.repo
+cat > /etc/yum.repos.d/nailgun.repo << EOF
+[nailgun]
+name=Nailgun Local Repo
+baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/centos/x86_64
+gpgcheck=0
+EOF
+
+# Disable subscription-manager plugins
+sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/product-id.conf || :
+sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/subscription-manager.conf || :
+
+# Disable GSSAPI in ssh server config
+sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config
+
+# Enable MOTD banner in sshd
+sed -i -e "s/^\s*PrintMotd no/PrintMotd yes/g" /etc/ssh/sshd_config
+
+# Add note regarding local repos creation to MOTD
+cat >> /etc/motd << EOF
+
+All environments use online repositories by default.
+Use the following commands to create local repositories
+on master node and change default repository settings:
+
+* CentOS: fuel-package-updates (see --help for options)
+* Ubuntu: fuel-createmirror (see --help for options)
+
+Please refer to the following guide for more information:
+https://docs.mirantis.com/openstack/fuel/fuel-6.1/reference-architecture.html#fuel-rep-mirror
+
+EOF
+
+# Copying bootstrap_admin_node.sh, chmod it and
+# adding /etc/init/bootstrap_admin_node.conf
+cp ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh
+chmod 0777 /usr/local/sbin/bootstrap_admin_node.sh
+cp ${SOURCE}/bootstrap_admin_node.conf /etc/init/bootstrap_admin_node.conf
+echo "ENABLED=1" > /etc/sysconfig/bootstrap_admin_node
+
+# Copying version.yaml file. It contains COMMIT_SHA of last commit.
+RELEASE=$(awk '/release/{gsub(/"/, "");print $2}' ${SOURCE}/version.yaml)
+mkdir -p /etc/nailgun /etc/fuel/${RELEASE} /etc/fuel/release_versions
+cp ${SOURCE}/version.yaml /etc/nailgun/version.yaml
+cp ${SOURCE}/version.yaml /etc/fuel/${RELEASE}/version.yaml
+ln -s /etc/fuel/${RELEASE}/version.yaml /etc/fuel/version.yaml
+cp ${SOURCE}/version.yaml /etc/fuel/release_versions/`cat ${SOURCE}/openstack_version`.yaml
+
+# Generete Fuel UUID
+uuidgen > /etc/fuel/fuel-uuid
+
+###Run fuel menu
+[ -z "$showmenu" ] && showmenu="no"
+cat > /root/.showfuelmenu << EOF
+#Set to yes to run Fuel Setup
+#Set to no to accept default settings
+showmenu=$showmenu
+EOF
+
+# Prepare custom /etc/issue logon banner and script for changing IP in it
+cat > /etc/issue << EOF
+#########################################
+# Welcome to the Fuel server #
+#########################################
+Server is running on \m platform
+
+Fuel UI is available on:
+http://:8000
+
+Default administrator login: root
+Default administrator password: r00tme
+
+Default Fuel UI login: admin
+Default Fuel UI password: admin
+
+Please change root password on first login.
+
+EOF
+
+
+cat >> '/etc/rc.local' << EOF
+first=yes
+for ip in \$(ip -o -4 addr | grep "eth." | awk '{print \$4 }' | cut -d/ -f1); do
+if [ "\$first" = "yes" ]; then
+ ipstr="Fuel UI is available on: http://\$ip:8000"
+ first=no
+else
+ ipstr=\$(printf "%s\n%25s%s" "\$ipstr" " " "http://\$ip:8000")
+fi
+done
+tmpissue=\$(mktemp)
+while read -r line; do
+ if [[ "\$line" =~ "Fuel UI is available on" ]]; then
+ echo -e "\$ipstr" >> \$tmpissue
+ elif [[ "\$line" =~ :8000$ ]]; then
+ :
+ else
+ echo -e "\$line" >> \$tmpissue
+ fi
+done < /etc/issue
+mv "\$tmpissue" /etc/issue
+
+EOF
+
+######### OPNFV addition BEGIN ############
+# Copy data into /opt/opnfv
+# TODO: This ought to be a package instead!
+mkdir -p /opt/opnfv
+cp -r ${SOURCE}/opnfv /opt
+######### OPNFV addition END ############
+
+# Unmounting source
+umount -f ${SOURCE}
+rm -rf ${SOURCE}
+
+umount -f ${FS} || true
+rm -rf ${FS}
+
+echo "tos orphan 7" >> /etc/ntp.conf
+
+# Do not show error message on ntpdate failure. Customers should not be confused
+# if admin node does not have access to the internet time servers.
+sed -i /etc/rc.d/init.d/ntpdate -e 's/\([ $RETVAL -eq 0 ] && success || \)failure/\1success/'
+
+# Disabling splash
+sed -i --follow-symlinks -e '/^\skernel/ s/rhgb//' /etc/grub.conf
+sed -i --follow-symlinks -e '/^\skernel/ s/quiet//' /etc/grub.conf
+
+# Disabling console clearing
+sed -i 's/getty/getty --noclear/' /etc/init/tty.conf
+
+# Disabling starting first console from start-ttys service
+sed -i --follow-symlinks -e 's/ACTIVE_CONSOLES=.*/ACTIVE_CONSOLES=\/dev\/tty\[2-6\]/' /etc/sysconfig/init
+
+# Copying default bash settings to the root directory
+cp -f /etc/skel/.bash* /root/
+
+# Blacklist i2c_piix4 module for VirtualBox so it does not create kernel errors
+[[ $(virt-what) = "virtualbox" ]] && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf
+
+%end \ No newline at end of file
diff --git a/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig b/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig
new file mode 100644
index 000000000..cf8cf80d1
--- /dev/null
+++ b/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig
@@ -0,0 +1,592 @@
+install
+text
+%include /tmp/source.ks
+reboot --eject
+lang en_US.UTF-8
+keyboard us
+rootpw r00tme
+timezone --utc Etc/UTC
+firewall --disabled
+selinux --disabled
+# ignore unsupported hardware warning
+unsupported_hardware
+# SKIP CONFIGURING X
+skipx
+# NEVER ever place zerombr here, it breaks automated installation
+%include /tmp/bootloader.ks
+%include /tmp/partition.ks
+
+# PREINSTALL SECTION
+# HERE ARE COMMANDS THAT WILL BE LAUNCHED BEFORE
+# INSTALLATION PROCESS ITSELF
+%pre
+#!/bin/sh
+
+# hard drives
+drives=""
+removable_drives=""
+for drv in `ls -1 /sys/block | grep "sd\|hd\|vd\|cciss"`; do
+ if !(blkid | grep -q "${drv}.*Fuel"); then
+ if (grep -q 0 /sys/block/${drv}/removable); then
+ drives="${drives} ${drv}"
+ else
+ removable_drives="${removable_drives} ${drv}"
+ fi
+ fi
+done
+default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'`
+
+installdrive="undefined"
+forceformat="no"
+for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+
+set ${drives} ${removable_drives}
+numdrives=`echo $#`
+
+tgtdrive="${installdrive}"
+
+function confirm_format {
+ check_drive="$1"
+ local confirm_format="no"
+
+ if [[ "$forceformat" == "yes" ]] ; then
+ return 0
+ fi
+
+ if parted -s /dev/$check_drive print &>/dev/null ; then
+ echo
+ echo "$check_drive drive contains partition table:"
+ parted -s /dev/$check_drive print
+ echo
+ read -p "Are you sure you want to erase ALL data on disk $check_drive? (y/N)" confirm_format
+ if [[ "$confirm_format" == "y" ]] || [[ "$confirm_format" == "Y" ]] || [[ "$forceformat" == "yes" ]]; then
+ return 0
+ else
+ return 1
+ fi
+ else
+ return 0
+ fi
+}
+
+format_confirmed="no"
+
+if [ $numdrives -lt 1 ]; then
+ exec < /dev/tty3 > /dev/tty3 2>&1
+ chvt 3
+ clear
+ echo
+ echo '********************************************************************'
+ echo '* E R R O R *'
+ echo '* *'
+ echo '* There is no suitable media available for installation. *'
+ echo '* Please attach a drive and try again. *'
+ echo '* *'
+ echo '********************************************************************'
+ echo
+ read -p "Press Enter to shut down the system: " _
+ poweroff
+fi
+
+if [ ${numdrives} -gt 1 ] || [ `echo ${drives} | wc -w` -eq 0 ] ; then
+ exec < /dev/tty3 > /dev/tty3 2>&1
+ chvt 3
+ while [ "${tgtdrive}" = "undefined" ]; do
+ clear
+ echo
+ echo '********************************************************************************'
+ echo '* W A R N I N G *'
+ echo '* *'
+ echo '* Which of the detected hard drives do you want to be used as *'
+ echo '* the installation target? *'
+ echo '* *'
+ echo '********************************************************************************'
+ echo
+ echo "Possible choices"
+ echo "Persistent drives: ${drives}"
+ echo "Removable drives: ${removable_drives}"
+ echo
+ if [ `echo ${drives} | wc -w` -eq 1 ] ; then
+ read -t 30 -p "Choose hard drive: " tgtdrive || tgtdrive=$default_drive
+ else
+ read -p "Choose hard drive: " tgtdrive
+ fi
+ match="no"
+ for drive in ${drives[@]} ${removable_drives[@]}; do
+ if [[ "$drive" == "$tgtdrive" ]] && match="yes" ; then
+ if confirm_format $tgtdrive ; then
+ format_confirmed="yes"
+ break
+ else
+ tgtdrive="undefined"
+ read -p "You may select another disk. Press Enter to continue." _
+ fi
+ fi
+ done
+ if [[ "$match" == "no" ]]; then
+ tgtdrive="undefined"
+ read -p "Invalid choice. Press Enter to continue." _
+ fi
+ done
+ clear
+ chvt 1
+else
+ tgtdrive=`echo ${drives} | sed -e "s/^\s*//" -e "s/\s*$//"`
+fi
+
+if [ "$format_confirmed" != "yes" ] ; then
+ exec < /dev/tty3 > /dev/tty3 2>&1
+ chvt 3
+ if ! confirm_format $tgtdrive ; then
+ clear
+ echo
+ echo '********************************************************************'
+ echo '* E R R O R *'
+ echo '* *'
+ echo '* Disk $tgtdrive contains active partition(s). *'
+ echo '* Installation cannot continue without confirmation. *'
+ echo '* *'
+ echo '********************************************************************'
+ echo
+ read -p "Press Enter to restart: " _
+ reboot
+ fi
+ chvt 1
+fi
+
+# verify tgtdrive is at least 41GB
+tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 ))
+if [ $tgtdrivesize -lt 41984 ]; then
+ exec < /dev/tty3 > /dev/tty3 2>&1
+ chvt 3
+ clear
+ echo
+ echo '********************************************************************'
+ echo '* E R R O R *'
+ echo '* *'
+ echo '* Your disk is under 41GB in size. Installation cannot continue. *'
+ echo '* Restart installation with a larger disk. *'
+ echo '* *'
+ echo '********************************************************************'
+ echo
+ read -p "Press Enter to restart: " _
+ reboot
+fi
+
+# paths in /dev have "/" instead of "!" for cciss devices
+tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//')
+
+# source
+if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
+ echo "harddrive --partition=LABEL="OpenStack_Fuel" --dir=/" > /tmp/source.ks
+elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
+ echo "harddrive --partition=UUID=will_be_substituted_with_actual_uuid --dir=/" > /tmp/source.ks
+else
+ echo "cdrom" > /tmp/source.ks
+fi
+
+vgremove -ff os
+dd if=/dev/zero of=/dev/${tgtdrive} bs=10M count=10
+sleep 3
+hdparm -z /dev/${tgtdrive}
+parted -s /dev/${tgtdrive} mklabel gpt
+parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0 24
+parted -s /dev/${tgtdrive} set 1 bios_grub on
+parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary fat16 24 224
+parted -s /dev/${tgtdrive} set 2 boot on
+parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 224 424
+sleep 3
+hdparm -z /dev/${tgtdrive}
+
+# partition
+
+# This adds support for the p seperator required for cciss devices
+if echo ${tgtdrive} | grep -q -e cciss ; then
+ bootdev=${tgtdrive}p
+else
+ bootdev=${tgtdrive}
+fi
+echo > /tmp/partition.ks
+echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks
+echo "partition /boot/efi --onpart=/dev/${bootdev}2" >> /tmp/partition.ks
+echo "partition pv.001 --ondisk=${tgtdrive} --size=41000 --grow" >> /tmp/partition.ks
+echo "volgroup os pv.001" >> /tmp/partition.ks
+echo "logvol swap --vgname=os --recommended --name=swap" >> /tmp/partition.ks
+echo "logvol / --vgname=os --size=10000 --name=root --fstype=ext4" >> /tmp/partition.ks
+echo "logvol /var --vgname=os --size=10000 --percent 30 --grow --name=var --fstype=ext4" >> /tmp/partition.ks
+echo "logvol /var/lib/docker --vgname=os --size=17000 --percent 20 --grow --name=varlibdocker --fstype=ext4" >> /tmp/partition.ks
+echo "logvol /var/log --vgname=os --size=4096 --percent 50 --grow --name=varlog --fstype=ext4" >> /tmp/partition.ks
+
+
+# bootloader
+echo "bootloader --location=partition --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
+
+# Anaconda can not install grub 0.97 on disks which are >4T.
+# The reason is that grub does not support such large geometries
+# and it simply thinks that the cylinder number has negative value.
+# Here we just set geometry manually so that grub thinks that disk
+# size is equal to 1G.
+# 130 cylinders * (16065 * 512 = 8225280 bytes) = 1G
+echo "%post --nochroot --log=/mnt/sysimage/root/anaconda-post-partition.log" > /tmp/post_partition.ks
+echo "echo \"device (hd0) /dev/${tgtdrive}\" >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "echo \"geometry (hd0) 130 255 63\" >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "echo \"root (hd0,2)\" >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "echo \"install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf\" >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "echo quit >> /tmp/grub.script" >> /tmp/post_partition.ks
+echo "cat /tmp/grub.script | chroot /mnt/sysimage /sbin/grub --no-floppy --batch" >> /tmp/post_partition.ks
+
+%end
+
+%packages --nobase --excludedocs
+@Core
+fuel
+fuel-library
+fuel-dockerctl
+authconfig
+bind-utils
+cronie
+crontabs
+curl
+daemonize
+dhcp
+docker-io
+fuel-bootstrap-image
+fuel-createmirror
+fuel-target-centos-images
+fuel-package-updates
+fuelmenu
+fuel-docker-images
+gdisk
+lrzip
+lsof
+man
+mlocate
+nmap-ncat
+ntp
+ntpdate
+openssh-clients
+policycoreutils
+python-daemon
+rsync
+ruby21-puppet
+ruby21-rubygem-netaddr
+ruby21-rubygem-openstack
+selinux-policy-targeted
+strace
+subscription-manager
+sysstat
+system-config-firewall-base
+tcpdump
+telnet
+vim-enhanced
+virt-what
+wget
+yum
+yum-plugin-priorities
+
+%include /tmp/post_partition.ks
+
+# POSTINSTALL SECTION
+# HERE ARE COMMANDS THAT WILL BE LAUNCHED JUST AFTER
+# INSTALLATION ITSELF COMPLETED
+%post
+echo -e "modprobe nf_conntrack_ipv4\nmodprobe nf_conntrack_ipv6\nmodprobe nf_conntrack_tftp\nmodprobe nf_nat_tftp" >> /etc/rc.modules
+chmod +x /etc/rc.modules
+echo -e "net.nf_conntrack_max=1048576" >> /etc/sysctl.conf
+mkdir -p /var/log/coredump
+echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" >> /etc/sysctl.conf
+chmod 777 /var/log/coredump
+echo -e "* soft core unlimited\n* hard core unlimited" >> /etc/security/limits.conf
+
+# Mount installation media in chroot
+%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log
+#!/bin/sh
+
+set -x
+
+SOURCE="/mnt/sysimage/tmp/source"
+
+for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+
+mkdir -p "${SOURCE}"
+
+case "${repo}" in
+ nfs:*)
+ nfs_url="${repo#nfs:}"
+ mount -t nfs "${nfs_url}" "${SOURCE}"
+ ;;
+ *)
+ if [ -d "/mnt/source" ]; then
+ mount -o bind "/mnt/source" "${SOURCE}"
+ fi
+ ;;
+esac
+
+%post --log=/root/anaconda-post-after-chroot.log
+#!/bin/bash
+
+set -x
+
+function save_cfg {
+ scrFile="/etc/sysconfig/network-scripts/ifcfg-$device"
+ search="domain $domain\nsearch $domain"
+ sed -i -e 's#^\(HOSTNAME=\).*$#\1'"$hostname"'#' /etc/sysconfig/network
+ grep -q "^\s*$ip\s+$hostname" /etc/hosts || echo "$ip $hostname" >> /etc/hosts
+ echo "${search}\nnameserver 127.0.0.1" > /etc/resolv.conf
+ [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/resolv.conf
+ [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/dnsmasq.upstream
+ [ $dns2 ] && echo "nameserver $dns2" >> /etc/resolv.conf
+ [ $dns2 ] && echo "nameserver $dns2" >> /etc/dnsmasq.upstream
+
+ echo DEVICE=$device > $scrFile
+ echo ONBOOT=yes >> $scrFile
+ echo NM_CONTROLLED=no >> $scrFile
+ echo HWADDR=$hwaddr >> $scrFile
+ echo USERCTL=no >> $scrFile
+ echo PEERDNS=no >> $scrFile
+ if [ $ip ]; then
+ echo BOOTPROTO=static >> $scrFile
+ echo IPADDR=$ip >> $scrFile
+ echo NETMASK=$netmask >> $scrFile
+ else
+ echo BOOTPROTO=dhcp >> $scrFile
+ fi
+ scrDHCPFile="/etc/sysconfig/network-scripts/ifcfg-$dhcp_interface"
+ #Ignore gateway and set up DHCP if it is used, otherwise apply it
+ if [ $dhcp_interface ] && [ "$dhcp_interface" != "$device" ]; then
+ echo "DEVICE=$dhcp_interface" > $scrDHCPFile
+ echo "BOOTPROTO=dhcp" >> $scrDHCPFile
+ echo "ONBOOT=yes" >> $scrDHCPFile
+ echo "USERCTL=no" >> $scrDHCPFile
+ else
+ echo GATEWAY=$gw >> /etc/sysconfig/network
+ fi
+ [ -n "$build_images" -a "$build_images" != "0" ] && echo -e "$build_images" > /root/.build_images
+}
+
+# Default FQDN
+hostname="nailgun.mirantis.com"
+
+for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+hostname=$hostname
+domain=${hostname#*.}
+ip=$ip
+netmask=$netmask
+gw=$gw
+device="eth0"
+hwaddr=`ifconfig $device | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
+dhcp_interface=$dhcp_interface
+build_images=$build_images
+save_cfg
+
+# Mounting installation source
+SOURCE=/tmp/source
+FS=/tmp/fs
+
+echo
+mkdir -p ${SOURCE}
+mkdir -p ${FS}
+
+if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
+ mount /dev/disk/by-label/"OpenStack_Fuel" ${SOURCE}
+elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
+ mount /dev/disk/by-uuid/will_be_substituted_with_actual_uuid ${FS}
+ mount -o loop ${FS}/nailgun.iso ${SOURCE}
+fi
+
+OPENSTACK_VERSION=`cat ${SOURCE}/openstack_version`
+
+# ----------------------
+# UNPACKING REPOSITORIES
+# ----------------------
+
+wwwdir="/var/www/nailgun"
+repodir="${wwwdir}/${OPENSTACK_VERSION}"
+
+# Copying Centos files
+mkdir -p ${repodir}/centos/x86_64
+cp -r ${SOURCE}/images ${repodir}/centos/x86_64
+cp -r ${SOURCE}/isolinux ${repodir}/centos/x86_64
+cp -r ${SOURCE}/repodata ${repodir}/centos/x86_64
+cp -r ${SOURCE}/Packages ${repodir}/centos/x86_64
+cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64
+
+# Copying Ubuntu files
+mkdir -p ${repodir}/ubuntu/x86_64/images
+cp -r ${SOURCE}/ubuntu/dists ${repodir}/ubuntu/x86_64
+cp -r ${SOURCE}/ubuntu/pool ${repodir}/ubuntu/x86_64
+
+# We do not ship debian-installer kernel and initrd on ISO.
+# But we still need to be able to create ubuntu cobbler distro
+# which requires kernel and initrd to be available. So, we
+# just touch these files to work around cobbler's limitation.
+touch ${repodir}/ubuntu/x86_64/images/linux
+touch ${repodir}/ubuntu/x86_64/images/initrd.gz
+
+# make links for backward compatibility
+ln -s ${repodir}/centos ${wwwdir}/centos
+ln -s ${repodir}/ubuntu ${wwwdir}/ubuntu
+
+# --------------------------
+# UNPACKING PUPPET MANIFESTS
+# --------------------------
+
+# create folders
+#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/manifests/
+#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/modules/
+#rm -rf /etc/puppet/modules/
+
+# TODO(ikalnitsky): investigate why we need this
+#cp ${SOURCE}/puppet-slave.tgz ${wwwdir}/
+
+# place modules and manifests
+#tar zxf ${SOURCE}/puppet-slave.tgz -C /etc/puppet/${OPENSTACK_VERSION}/modules
+#cp /etc/puppet/${OPENSTACK_VERSION}/modules/osnailyfacter/examples/site.pp /etc/puppet/${OPENSTACK_VERSION}/manifests/site.pp
+cp ${SOURCE}/centos-versions.yaml ${SOURCE}/ubuntu-versions.yaml /etc/puppet/${OPENSTACK_VERSION}/manifests/
+
+# make links for backward compatibility
+#pushd /etc/puppet
+#ln -s ${OPENSTACK_VERSION}/manifests/ /etc/puppet/manifests
+#ln -s ${OPENSTACK_VERSION}/modules/ /etc/puppet/modules
+#popd
+
+cp ${SOURCE}/send2syslog.py /bin/send2syslog.py
+mkdir -p /var/lib/hiera
+touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml
+
+# Prepare local repository specification
+rm /etc/yum.repos.d/CentOS*.repo
+cat > /etc/yum.repos.d/nailgun.repo << EOF
+[nailgun]
+name=Nailgun Local Repo
+baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/centos/x86_64
+gpgcheck=0
+EOF
+
+# Disable subscription-manager plugins
+sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/product-id.conf || :
+sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/subscription-manager.conf || :
+
+# Disable GSSAPI in ssh server config
+sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config
+
+# Enable MOTD banner in sshd
+sed -i -e "s/^\s*PrintMotd no/PrintMotd yes/g" /etc/ssh/sshd_config
+
+# Add note regarding local repos creation to MOTD
+cat >> /etc/motd << EOF
+
+All environments use online repositories by default.
+Use the following commands to create local repositories
+on master node and change default repository settings:
+
+* CentOS: fuel-package-updates (see --help for options)
+* Ubuntu: fuel-createmirror (see --help for options)
+
+Please refer to the following guide for more information:
+https://docs.mirantis.com/openstack/fuel/fuel-6.1/reference-architecture.html#fuel-rep-mirror
+
+EOF
+
+# Copying bootstrap_admin_node.sh, chmod it and
+# adding /etc/init/bootstrap_admin_node.conf
+cp ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh
+chmod 0777 /usr/local/sbin/bootstrap_admin_node.sh
+cp ${SOURCE}/bootstrap_admin_node.conf /etc/init/bootstrap_admin_node.conf
+echo "ENABLED=1" > /etc/sysconfig/bootstrap_admin_node
+
+# Copying version.yaml file. It contains COMMIT_SHA of last commit.
+RELEASE=$(awk '/release/{gsub(/"/, "");print $2}' ${SOURCE}/version.yaml)
+mkdir -p /etc/nailgun /etc/fuel/${RELEASE} /etc/fuel/release_versions
+cp ${SOURCE}/version.yaml /etc/nailgun/version.yaml
+cp ${SOURCE}/version.yaml /etc/fuel/${RELEASE}/version.yaml
+ln -s /etc/fuel/${RELEASE}/version.yaml /etc/fuel/version.yaml
+cp ${SOURCE}/version.yaml /etc/fuel/release_versions/`cat ${SOURCE}/openstack_version`.yaml
+
+# Generete Fuel UUID
+uuidgen > /etc/fuel/fuel-uuid
+
+###Run fuel menu
+[ -z "$showmenu" ] && showmenu="no"
+cat > /root/.showfuelmenu << EOF
+#Set to yes to run Fuel Setup
+#Set to no to accept default settings
+showmenu=$showmenu
+EOF
+
+# Prepare custom /etc/issue logon banner and script for changing IP in it
+cat > /etc/issue << EOF
+#########################################
+# Welcome to the Fuel server #
+#########################################
+Server is running on \m platform
+
+Fuel UI is available on:
+http://:8000
+
+Default administrator login: root
+Default administrator password: r00tme
+
+Default Fuel UI login: admin
+Default Fuel UI password: admin
+
+Please change root password on first login.
+
+EOF
+
+
+cat >> '/etc/rc.local' << EOF
+first=yes
+for ip in \$(ip -o -4 addr | grep "eth." | awk '{print \$4 }' | cut -d/ -f1); do
+if [ "\$first" = "yes" ]; then
+ ipstr="Fuel UI is available on: http://\$ip:8000"
+ first=no
+else
+ ipstr=\$(printf "%s\n%25s%s" "\$ipstr" " " "http://\$ip:8000")
+fi
+done
+tmpissue=\$(mktemp)
+while read -r line; do
+ if [[ "\$line" =~ "Fuel UI is available on" ]]; then
+ echo -e "\$ipstr" >> \$tmpissue
+ elif [[ "\$line" =~ :8000$ ]]; then
+ :
+ else
+ echo -e "\$line" >> \$tmpissue
+ fi
+done < /etc/issue
+mv "\$tmpissue" /etc/issue
+
+EOF
+
+
+# Unmounting source
+umount -f ${SOURCE}
+rm -rf ${SOURCE}
+
+umount -f ${FS} || true
+rm -rf ${FS}
+
+echo "tos orphan 7" >> /etc/ntp.conf
+
+# Do not show error message on ntpdate failure. Customers should not be confused
+# if admin node does not have access to the internet time servers.
+sed -i /etc/rc.d/init.d/ntpdate -e 's/\([ $RETVAL -eq 0 ] && success || \)failure/\1success/'
+
+# Disabling splash
+sed -i --follow-symlinks -e '/^\skernel/ s/rhgb//' /etc/grub.conf
+sed -i --follow-symlinks -e '/^\skernel/ s/quiet//' /etc/grub.conf
+
+# Disabling console clearing
+sed -i 's/getty/getty --noclear/' /etc/init/tty.conf
+
+# Disabling starting first console from start-ttys service
+sed -i --follow-symlinks -e 's/ACTIVE_CONSOLES=.*/ACTIVE_CONSOLES=\/dev\/tty\[2-6\]/' /etc/sysconfig/init
+
+# Copying default bash settings to the root directory
+cp -f /etc/skel/.bash* /root/
+
+# Blacklist i2c_piix4 module for VirtualBox so it does not create kernel errors
+[[ $(virt-what) = "virtualbox" ]] && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf
+
+%end \ No newline at end of file
diff --git a/fuel/build/f_isoroot/f_odlpluginbuild/Makefile b/fuel/build/f_isoroot/f_odlpluginbuild/Makefile
new file mode 100644
index 000000000..ce9cd73e1
--- /dev/null
+++ b/fuel/build/f_isoroot/f_odlpluginbuild/Makefile
@@ -0,0 +1,38 @@
+##############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# mskalski@mirantis.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)
+DOCKNAME = fuelrepo
+DOCKVERSION = 1.0
+ODL_BRANCH="juno/lithium-sr1"
+ODL_REPO="https://github.com/stackforge/fuel-plugin-opendaylight.git"
+
+.PHONY: all
+all: .odlbuild
+
+.PHONY: clean
+clean:
+ # Deliberately not cleaning nailgun directory to speed up multiple builds
+ @rm -f ../release/opnfv/opendaylight*.rpm
+
+.PHONY: release
+release:.odlbuild
+ @rm -f ../release/opnfv/opendaylight*.rpm
+ @mkdir -p ../release/opnfv
+ @cp opendaylight*.rpm ../release/opnfv/
+
+.odlbuild:
+ rm -rf fuel-plugin-opendaylight
+ sudo apt-get -y install build-essential ruby-dev rubygems-integration python-pip git rpm createrepo dpkg-dev
+ sudo gem install fpm
+ sudo pip install fuel-plugin-builder
+ git clone -b ${ODL_BRANCH} ${ODL_REPO}
+ INCLUDE_DEPENDENCIES=true fpb --debug --build fuel-plugin-opendaylight/
+ mv fuel-plugin-opendaylight/opendaylight*.rpm .
+ rm -rf fuel-plugin-opendaylight
diff --git a/fuel/build/f_isoroot/f_repobuild/Makefile b/fuel/build/f_isoroot/f_repobuild/Makefile
new file mode 100644
index 000000000..6bfbd35c1
--- /dev/null
+++ b/fuel/build/f_isoroot/f_repobuild/Makefile
@@ -0,0 +1,56 @@
+##############################################################################
+# 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
+##############################################################################
+
+SHELL := /bin/bash
+TOP := $(shell pwd)
+DOCKNAME = fuelrepo
+DOCKVERSION = 1.0
+
+# try to choose close ubuntu mirror which support rsync protocol
+# https://bugs.launchpad.net/fuel/+bug/1459252
+MIRROR_URLS := $(shell curl -s http://mirrors.ubuntu.com/mirrors.txt)
+MIRROR_HOSTS := $(shell for url in ${MIRROR_URLS}; do echo $$url | cut -d'/' -f3; done)
+RSYNC_HOST := $(shell for host in ${MIRROR_HOSTS}; do rsync -4 --contimeout 5 --no-motd --list-only "$${host}::ubuntu/." &> /dev/null && echo $$host && break; done)
+
+.PHONY: all
+all: .nailgun
+
+.nailgun:
+ sudo apt-get update
+ sudo apt-get upgrade -y
+ sudo apt-get install -y rsync python python-yaml dpkg-dev openssl
+ rm -rf tmpiso tmpdir
+ mkdir tmpiso
+ fuseiso ${ISOCACHE} tmpiso
+ cp tmpiso/ubuntu/pool/main/f/fuel-createmirror/fuel-createmirror_6.1*.deb .
+ fusermount -u tmpiso
+ rm -rf tmpiso
+ sudo dpkg -i fuel-createmirror_6.1*.deb
+ sudo sed -i 's/DOCKER_MODE=true/DOCKER_MODE=false/' /etc/fuel-createmirror/common.cfg
+ sudo sed -i 's/DEBUG="no"/DEBUG="yes"/' /etc/fuel-createmirror/ubuntu.cfg
+ sudo sed -i 's/MIRROR_UBUNTU_HOST="archive.ubuntu.com"/MIRROR_UBUNTU_HOST="${RSYNC_HOST}"/' /etc/fuel-createmirror/common.cfg
+ rm -Rf nailgun
+ sudo mkdir -p /var/www
+ sudo su - -c /opt/fuel-createmirror-6.1/fuel-createmirror
+ sudo chmod -R 755 /var/www/nailgun
+ cp -Rp /var/www/nailgun .
+ touch .nailgun
+
+.PHONY: clean
+clean:
+ # Deliberately not cleaning nailgun directory to speed up multiple builds
+ @rm -rf ../release/opnfv/nailgun fuel-createmirror_6.1*.deb
+
+.PHONY: release
+release:.nailgun
+ @rm -Rf ../release/opnfv/nailgun
+ @mkdir -p ../release/opnfv
+ @cp -Rp nailgun ../release/opnfv/nailgun
+
diff --git a/fuel/build/fuel-agent_1.patch b/fuel/build/fuel-agent_1.patch
new file mode 100644
index 000000000..b0808966f
--- /dev/null
+++ b/fuel/build/fuel-agent_1.patch
@@ -0,0 +1,36 @@
+*** build/repos/nailgun/fuel_agent/fuel_agent/manager.py.orig Thu Sep 24 11:08:38 2015
+--- build/repos/nailgun/fuel_agent/fuel_agent/manager.py Thu Sep 24 11:10:25 2015
+***************
+*** 541,546 ****
+--- 541,552 ----
+ fs_options=fs.options,
+ fs_label=fs.label,
+ dev=str(fs.device))
++ if fs.type == 'ext4':
++ LOG.debug('Trying to disable journaling for ext4 '
++ 'in order to speed up the build')
++ utils.execute('tune2fs', '-O', '^has_journal',
++ str(fs.device))
++
+
+ # mounting all images into chroot tree
+ self.mount_target(chroot, treat_mtab=False, pseudo=False)
+***************
+*** 631,636 ****
+--- 637,652 ----
+ self.umount_target(chroot, pseudo=False, try_lazy_umount=False)
+
+ for image in self.driver.image_scheme.images:
++ # find fs with the same loop device object
++ # as image.target_device
++ fs = self.driver.partition_scheme.fs_by_device(
++ image.target_device)
++
++ if fs.type == 'ext4':
++ LOG.debug('Trying to re-enable journaling for ext4')
++ utils.execute('tune2fs', '-O', 'has_journal',
++ str(fs.device))
++
+ LOG.debug('Deattaching loop device from file: %s',
+ image.img_tmp_file)
+ bu.deattach_loop(str(image.target_device))
diff --git a/fuel/build/fuel-main_3.patch b/fuel/build/fuel-main_3.patch
new file mode 100644
index 000000000..8341d72d6
--- /dev/null
+++ b/fuel/build/fuel-main_3.patch
@@ -0,0 +1,19 @@
+*** prepare-build-env.sh.orig Tue Sep 8 08:47:46 2015
+--- prepare-build-env.sh Tue Sep 8 08:48:22 2015
+***************
+*** 41,47 ****
+
+ trusty)
+ GEMPKG="ruby ruby-dev"
+! 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
+ sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm
+ ;;
+--- 41,47 ----
+
+ trusty)
+ GEMPKG="ruby ruby-dev"
+! sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D2B45A2
+ echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list
+ sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm
+ ;;
diff --git a/fuel/build/fuel-main_5.patch b/fuel/build/fuel-main_5.patch
new file mode 100644
index 000000000..ec75626d0
--- /dev/null
+++ b/fuel/build/fuel-main_5.patch
@@ -0,0 +1,19 @@
+*** prepare-build-env.sh.orig Tue Sep 8 10:29:08 2015
+--- prepare-build-env.sh Tue Sep 8 10:30:21 2015
+***************
+*** 43,49 ****
+ GEMPKG="ruby ruby-dev"
+ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D2B45A2
+ echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list
+! sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm
+ ;;
+
+ precise)
+--- 43,49 ----
+ GEMPKG="ruby ruby-dev"
+ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D2B45A2
+ echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list
+! sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm dosfstools xorriso
+ ;;
+
+ precise)
diff --git a/fuel/build/install/apt-ftparchive-deb.conf b/fuel/build/install/apt-ftparchive-deb.conf
new file mode 100644
index 000000000..0d15aec6f
--- /dev/null
+++ b/fuel/build/install/apt-ftparchive-deb.conf
@@ -0,0 +1,35 @@
+##############################################################################
+# 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/main" {
+ Packages "dists/trusty/main/binary-amd64/Packages";
+ BinOverride "./indices/override.trusty.main";
+ ExtraOverride "./indices/override.trusty.extra.main";
+};
+
+Default {
+ Packages {
+ Extensions ".deb";
+ Compress ". gzip";
+ };
+};
+
+Contents {
+ Compress "gzip";
+};
+
diff --git a/fuel/build/install/apt-ftparchive-release.conf b/fuel/build/install/apt-ftparchive-release.conf
new file mode 100644
index 000000000..02706bd7d
--- /dev/null
+++ b/fuel/build/install/apt-ftparchive-release.conf
@@ -0,0 +1,18 @@
+##############################################################################
+# 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
+##############################################################################
+
+APT::FTPArchive::Release::Origin "Ubuntu";
+APT::FTPArchive::Release::Label "Ubuntu";
+APT::FTPArchive::Release::Suite "trusty";
+APT::FTPArchive::Release::Version "1.04";
+APT::FTPArchive::Release::Codename "trusty";
+APT::FTPArchive::Release::Architectures "amd64";
+APT::FTPArchive::Release::Components "main";
+APT::FTPArchive::Release::Description "Ubuntu Trusty Tahr 14.04 LTS";
diff --git a/fuel/build/install/apt-ftparchive-udeb.conf b/fuel/build/install/apt-ftparchive-udeb.conf
new file mode 100644
index 000000000..3b5b239a6
--- /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/trusty/main/debian-installer/binary-amd64/Packages";
+ BinOverride "./indices/override.trusty.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
new file mode 100755
index 000000000..f0bb84914
--- /dev/null
+++ b/fuel/build/install/install.sh
@@ -0,0 +1,477 @@
+#!/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() {
+ rc=$?
+
+ cd /tmp
+
+ if [ -n "$TMP_HOSTMOUNT" ]; then
+ if [ -d "$TMP_HOSTMOUNT" ]; then
+ fusermount -u $TMP_HOSTMOUNT
+ rmdir $TMP_HOSTMOUNT
+ fi
+ fi
+
+ if [ -d "$TMP_OLDISO" ]; then
+ fusermount -u $TMP_OLDISO
+ rmdir $TMP_OLDISO
+ fi
+
+ if [ -f "$CONF" ]; then
+ rm $CONF
+ fi
+
+ if [ -d "$TMP_ISOPUPPET" ]; then
+ rm -Rf $TMP_ISOPUPPET
+ fi
+}
+
+get_deb_name() {
+ ar p $1 control.tar.gz | tar xzO ./control | grep "^Package:.* " | sed 's/.* //'
+ if [ $PIPESTATUS -ne 0 ]; then
+ echo "Error in get_deb_name($1)"
+ exit 1
+ fi
+}
+
+get_deb_rev() {
+ ar p $1 control.tar.gz | tar xzO ./control | grep "^Version:.* " | sed 's/.* //'
+ if [ $PIPESTATUS -ne 0 ]; then
+ echo "Error in get_deb_rev($1)"
+ exit 1
+ fi
+}
+
+
+# Added logic for ".orig" files:
+# 1. Is there an .orig file for the new file?
+# 2. If the file is not present in base ISO -> Error!
+# 3. If the file is changed i base ISO -> Error! (need manual rebase)
+# 4. If there is no .orig file, but file is present in base ISO: Error!
+verify_orig_files() {
+ OLDDIR=$1
+ NEWDIR=$2
+
+ pushd $NEWDIR >/dev/null
+ for f in $(find * -type f -name '*.orig')
+ do
+ origfile=$NEWDIR/$f
+ oldfile=$OLDDIR/$(echo $f | sed 's/.orig$//')
+ newfile=$NEWDIR/$(echo $f | sed 's/.orig$//')
+
+ origfile=${newfile}.orig
+ # If no corresponding base file, error
+ if [ ! -f $oldfile ]; then
+ printf "\n\n\n\n"
+ echo "Error: found ${newfile} but no"
+ echo "Error: ${oldfile}"
+ echo "Error: Manual rebase is needed!"
+ printf "\n\n\n\n"
+ exit 1
+ fi
+
+ # If orig file differs from base file, error
+ if ! diff -q $origfile $oldfile > /dev/null; then
+ printf "\n\n\n\n"
+ echo "Error: $origfile differs from"
+ echo "Error: $oldfile!"
+ echo "Error: Manual rebase is needed!"
+ printf "\n\n\n\n"
+ exit 1
+ fi
+
+ done
+
+
+ # Check that there we're not overwriting oldfiles without having a ".orig" copy
+ for f in $(find * -type f ! -name '*.orig')
+ do
+ newfile=$NEWDIR/$(echo $f | sed 's/.orig$//')
+ origfile=${newfile}.orig
+ oldfile=$OLDDIR/$f
+ if [ -f $oldfile ]; then
+ if [ ! -f $origfile ]; then
+ printf "\n\n\n\n"
+ echo "Error: Will overwrite $oldfile, but there is no"
+ echo "Error: $origfile!"
+ echo "Error: You need to create the `basename $origfile`!"
+ printf "\n\n\n\n"
+ exit 1
+ fi
+ fi
+ done
+
+
+ popd >/dev/null
+}
+
+prep_make_live() {
+ DEST=$TMP_HOSTMOUNT
+ REPO=$DEST/var/www/nailgun/ubuntu/fuelweb/x86_64
+ echo "Live install"
+ ssh-copy-id root@$FUELHOST
+ sshfs root@1${FUELHOST}:/ $TMP_HOSTMOUNT
+
+ if [ -f $REPO/dists/trusty/main/binary-amd64/Packages.backup ]; then
+ echo "Error - found backup file for Packages!"
+ exit 1
+ fi
+
+ if [ -f $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup ]; then
+ echo "Error - found backup file for Packages.gz!"
+ exit 1
+ fi
+
+ if [ -f $REPO/dists/trusty/Release.backup ]; then
+ echo "Error - found backup file for Release!"
+ exit 1
+ fi
+
+ if [ -d $DEST/etc/puppet.backup ]; then
+ echo "Error - found backup file for Puppet!"
+ exit 1
+ fi
+
+ cp $REPO/dists/trusty/main/binary-amd64/Packages $REPO/dists/trusty/main/binary-amd64/Packages.backup
+ cp $REPO/dists/trusty/main/binary-amd64/Packages.gz $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup
+ cp $REPO/dists/trusty/Release $REPO/dists/trusty/Release.backup
+ cp -Rvp $DEST/etc/puppet $DEST/etc/puppet.backup
+}
+
+post_make_live() {
+ if [ -d $TOP/release/puppet/modules ]; then
+ echo "Installing into Puppet:"
+ cd $TOP/release/puppet/modules
+ if [ `ls -1 | wc -l` -gt 0 ]; then
+ for dir in *
+ do
+ echo " $dir"
+ cp -Rp $dir $DEST/etc/puppet/modules
+ done
+ fi
+ fi
+}
+
+make_live() {
+ prep_make_live
+ copy_packages
+ post_make_live
+}
+
+
+prep_make_iso() {
+ DEST=$TOP/newiso
+ REPO=$DEST/ubuntu
+ echo "Making ISO..."
+ echo "Unpack of old ISO..."
+ if [ -d newiso ]; then
+ chmod -R 755 newiso
+ rm -rf newiso
+ fi
+ mkdir newiso
+ fusermount -u $TMP_OLDISO 2>/dev/null || cat /dev/null
+ fuseiso -p $ORIGISO $TMP_OLDISO
+ sleep 1
+ cd $TMP_OLDISO
+ find . | cpio -pd $TOP/newiso
+ cd ..
+ fusermount -u $TMP_OLDISO
+ rm -Rf $TMP_OLDISO
+ chmod -R 755 $TOP/newiso
+}
+
+make_iso_image() {
+ echo "Making ISO..."
+ cd $DEST
+ find . -name TRANS.TBL -exec rm {} \;
+ rm -rf rr_moved
+
+ mkisofs --quiet -r -V "$VOLUMEID" -publisher "$PUBLISHER" \
+ -p `git rev-parse --verify HEAD` -J -R -b isolinux/isolinux.bin \
+ -no-emul-boot \
+ -boot-load-size 4 -boot-info-table \
+ --hide-rr-moved \
+ -x "lost+found" -o $NEWISO .
+
+ isoinfo -d -i $NEWISO
+}
+
+# iso_copy_puppet: Create a new puppet-slave.tgz for the iso
+iso_copy_puppet() {
+ echo "Installing into Puppet..."
+ mkdir -p $TMP_ISOPUPPET/release/puppet
+ cd $TMP_ISOPUPPET/release/puppet
+ tar xzf $DEST/puppet-slave.tgz
+ cd $TOP/release/puppet/modules
+
+ # Remove all .orig files before copying as they now have been verfied
+
+ if [ -d $TOP/release/puppet/modules ]; then
+ if [ `ls -1 | wc -l` -gt 0 ]; then
+ verify_orig_files $TMP_ISOPUPPET/release/puppet $TOP/release/puppet/modules
+ find $TOP/release/puppet/modules -type f -name '*.orig' -exec rm {} \;
+ for dir in $TOP/release/puppet/modules/*
+ do
+ echo " $dir"
+ cp -Rp $dir $TMP_ISOPUPPET/release/puppet
+ done
+ fi
+ fi
+
+ cd $TMP_ISOPUPPET/release/puppet
+ tar czf $DEST/puppet-slave.tgz .
+ cd $TOP
+ rm -Rf $TMP_ISOPUPPET
+}
+
+# iso_modify_image: Add/patch files in the ISO root
+iso_modify_image () {
+ # TODO: Add logic for ".orig" files (hey! make a function!), which would look
+ # something like:
+ # 1. Is there an .orig file?
+ # 2. If the file is not present in origiso -> Error exit
+ # 3. If the file is changed in origiso -> Error exit (need manual rebase)
+ # 4. Otherwise continue, but don't copy orig file (or maybe we should?)
+ # ... and corresponding reverse logic:
+ # 1. If there is no .orig file, but file is present in origiso -> Error exit
+ echo "Modify ISO files (wild copy)..."
+
+ verify_orig_files $DEST $TOP/release/isoroot
+ # Remove all .orig files before copying as they now have been verfied
+ find $TOP/release/isoroot -type f -name '*.orig' -exec rm {} \;
+
+ cd $TOP/release/isoroot
+ cp -Rvp . $DEST
+}
+
+make_iso() {
+ prep_make_iso
+ copy_packages
+ #iso_copy_puppet
+ iso_modify_image
+ make_iso_image
+}
+
+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
+ echo "Did not expect a package here, not supported"
+ exit 1
+ done
+
+ cd $TOP/release/packages/ubuntu/pool/main
+ for deb in `ls -1 | grep '\.deb$'`
+ do
+ echo " $deb"
+ cp $deb $REPO/pool/main
+ echo "Did not expect a package here, not supported"
+ exit 1
+ done
+
+ echo "Running Fuel package patch file"
+ pushd $REPO/pool/main > /dev/null
+
+ for line in `cat $TOP/apply_patches | grep -v "^#" | grep -v "^$"`; do
+ echo "Line is $line"
+ echo "Did not expect a line here, not supported"
+ exit 1
+ ref=`echo $line | cut -d '>' -f 1`
+ origpkg=`echo $line| cut -d '>' -f 2`
+ url=`echo $line | cut -d '>' -f 3`
+
+ if [ -z "$origpkg" ]; then
+ echo "Error: No origpkg for patching"
+ exit 1
+ fi
+
+ if [ -z "$url" ]; then
+ echo "Error: No url for patching"
+ exit 1
+ fi
+
+ if [ -z "$ref" ]; then
+ echo "Error: No reference text for patching"
+ exit 1
+ fi
+
+ echo "CM: Patching Fuel package for $ref" | tee -a $REPORTFILE
+ echo "CM: Replacing package $origpkg with $url" | tee -a $REPORTFILE
+ oldrev=`get_deb_rev $origpkg`
+ rm $origpkg
+ wget --quiet $url
+ topkg=`basename $url`
+ echo "CM: MD5 of new package:" | tee -a $REPORTFILE
+ md5sum $topkg | tee -a $REPORTFILE
+
+ patchname=`get_deb_name $topkg`
+ patchrev=`get_deb_rev $topkg`
+ echo "Correcting dependencies towards $patchname rev $patchrev - old rev $oldrev" | tee -a $REPORTFILE
+ $TOP/patch-packages/tools/correct_deps $patchname $oldrev $patchrev | tee -a $REPORTFILE
+ if [ $PIPESTATUS -ne 0 ]; then
+ exit 1
+ fi
+ done
+
+ printf "Done running Fuel patch file\n\n"
+ echo "Running add packages file"
+ for line in `cat $TOP/add_opnfv_packages | grep -v "^#" | grep -v "^$"`; do
+ echo "Line is $line"
+ echo "Did not expect a line here, not supported"
+ exit 1
+ ref=`echo $line | cut -d '>' -f 1`
+ origpkg=`echo $line| cut -d '>' -f 2`
+ url=`echo $line | cut -d '>' -f 3`
+
+ if [ -z "$origpkg" ]; then
+ echo "Error: No origpkg for patching"
+ exit 1
+ fi
+
+ if [ -z "$url" ]; then
+ echo "Error: No url for patching"
+ exit 1
+ fi
+
+ if [ -z "$ref" ]; then
+ echo "Error: No reference text for patching"
+ exit 1
+ fi
+
+ if [ "$origpkg" != "NONE" ]; then
+ echo "CM: Patching added package for $ref" | tee -a $REPORTFILE
+ echo "CM: Replacing package $origpkg with $url" | tee -a $REPORTFILE
+ oldrev=`get_deb_rev $origpkg`
+ rm $origpkg
+ else
+ echo "CM: Adding previoulsy uninstalled package for $ref" tee -a $REPORTFILE
+ fi
+ wget --quiet $url
+ topkg=`basename $url`
+ echo "CM: MD5 of new package:" | tee -a $REPORTFILE
+ md5sum $topkg | tee -a $REPORTFILE
+ if [ "$origpkg" != "NONE" ]; then
+ patchname=`get_deb_name $topkg`
+ patchrev=`get_deb_rev $topkg`
+ echo "Correcting dependencies towards $patchname rev $patchrev - old rev $oldrev" | tee -a $REPORTFILE
+ $TOP/patch-packages/tools/correct_deps $patchname $oldrev $patchrev | tee -a $REPORTFILE
+ if [ $PIPESTATUS -ne 0 ]; then
+ exit 1
+ fi
+ fi
+ done
+ printf "Done running add packages file\n\n"
+
+ popd > /dev/null
+
+ if [ -f $TOP/patch-packages/release/patch-replacements ]; then
+ echo "Applying package patches" | tee -a $REPORTFILE
+ pushd $REPO/pool/main > /dev/null
+ printf "\n\n" | tee -a $REPORTFILE
+ for line in `cat $TOP/patch-packages/release/patch-replacements`
+ do
+ echo "Did not expect a line here, not supported"
+ exit 1
+ frompkg=`echo $line | cut -d ">" -f 1`
+ topkg=`echo $line | cut -d ">" -f 2`
+ echo "CM: Applying patch to $frompkg" | tee -a $REPORTFILE
+ echo "CM: New package rev after patch: $topkg" | tee -a $REPORTFILE
+
+ if [ ! -f $frompkg ]; then
+ echo "Error: Can't find $frompkg in repo"
+ exit 1
+ else
+ oldrev=`get_deb_rev $frompkg`
+ echo "Removing $frompkg from repo"
+ rm $frompkg
+ fi
+
+ if [ ! -f $TOP/patch-packages/release/packages/$topkg ]; then
+ echo "Error: Can't find $topkg in patch release"
+ exit 1
+ else
+ echo "Adding $topkg to repo"
+ cp $TOP/patch-packages/release/packages/$topkg .
+ fi
+
+ patchname=`get_deb_name $topkg`
+ patchrev=`get_deb_rev $topkg`
+ echo "Correcting dependencies towards $patchname rev $patchrev - old rev $oldrev" | tee -a $REPORTFILE
+ $TOP/patch-packages/tools/correct_deps $patchname $oldrev $patchrev | tee -a $REPORTFILE
+ if [ $PIPESTATUS -ne 0 ]; then
+ exit 1
+ fi
+ done
+ popd > /dev/null
+ fi
+
+ echo "Generating metadata..."
+ pushd $REPO > /dev/null
+
+ # 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"
+
+ echo Not running echo apt-ftparchive -c "${APT_REL_CONF}" generate "${APT_DEB_CONF}"
+ echo Not running apt-ftparchive -c "${APT_REL_CONF}" generate "${APT_DEB_CONF}"
+ echo Not running apt-ftparchive generate "${APT_UDEB_CONF}"
+ echo Not running apt-ftparchive generate "${APT_UDEB_CONF}"
+
+ # Fuel also needs this index file
+ # cat dists/trusty/main/binary-amd64/Packages | \
+ # awk '/^Package:/{pkg=$2}
+ # /^Version:/{print pkg ": \"" $2 "\""}' > ubuntu-versions.yaml
+ # cp ubuntu-versions.yaml $DEST
+
+ # apt-ftparchive -c "${APT_REL_CONF}" release dists/trusty/ > dists/trusty/Release
+ # gzip -9cf dists/trusty/Release > dists/trusty/Release.gz
+
+ popd > /dev/null
+
+}
+
+
+#############################################################################
+
+trap my_exit EXIT
+
+CONF=`mktemp /tmp/XXXXXXX`
+MODE=$1
+TOP=`pwd`
+
+if [ $MODE = "iso" ]; then
+ PUBLISHER="OPNFV"
+ TMP_OLDISO=`mktemp -d /tmp/XXXXXXX`
+ TMP_ISOPUPPET=`mktemp -d /tmp/XXXXXXX`
+ ORIGISO=$2
+ NEWISO=$3
+ VOLUMEID="$4 $5"
+ REPORTFILE="${NEWISO}.txt"
+ echo "Opening reportfile at $REPORTFILE"
+ touch $REPORTFILE
+ if [ ! -f $ORIGISO ]; then
+ echo "Can't find original MOS 5.1 iso at $ORIGISO"
+ rm $CONF
+ exit 1
+ fi
+
+ make_iso
+else
+ echo "Unknown mode: $MODE"
+ exit 1
+fi
diff --git a/fuel/build/install/uninstall.sh b/fuel/build/install/uninstall.sh
new file mode 100755
index 000000000..a9e74bc39
--- /dev/null
+++ b/fuel/build/install/uninstall.sh
@@ -0,0 +1,79 @@
+#!/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() {
+ cd /tmp
+ if [ -d "$MOUNT" ]; then
+ fusermount -u $MOUNT
+ rmdir $MOUNT
+ fi
+}
+trap my_exit EXIT
+
+echo "Live uninstall is currently disabled as it is not tested"
+exit 1
+
+TOP=`pwd`
+MOUNT=`mktemp -d /tmp/XXXXXXX`
+ssh-copy-id root@10.20.0.2
+sshfs root@10.20.0.2:/ $MOUNT
+
+DEST=$MOUNT
+REPO=$DEST/var/www/nailgun/ubuntu/fuelweb/x86_64
+
+cd $REPO
+if [ ! -f $REPO/dists/trusty/main/binary-amd64/Packages.backup ]; then
+ echo "Error - didn't find backup file for Packages!"
+ exit 1
+fi
+
+if [ ! -f $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup ]; then
+ echo "Error - didn't find backup file for Packages.gz!"
+ exit 1
+fi
+
+if [ ! -f $REPO/dists/trusty/Release.backup ]; then
+ echo "Error - didn't find backup file for Release!"
+ exit 1
+fi
+
+if [ ! -f $DEST/etc/puppet/manifests/site.pp.backup ]; then
+ echo "Error - didn't find backup file for site.pp!"
+ exit 1
+fi
+
+echo "Removing Debian packages:"
+cd $TOP/release/pool/main
+for deb in *.deb
+do
+ echo " $deb"
+ rm -Rf $REPO/pool/main/$deb
+done
+cd $REPO
+
+echo "Removing Puppet modules:"
+cd $TOP/puppet/modules
+for dir in *
+do
+ echo " $dir"
+ rm -Rf $DEST/etc/puppet/modules/$dir
+done
+cd $REPO
+
+echo "Restoring backups of datafiles"
+
+rm -f $REPO/dists/trusty/main/binary-amd64/Packages $REPO/dists/trusty/main/binary-amd64/Packages.gz
+rm -f $REPO/dists/trusty/Release $DEST/etc/puppet/manifests/site.pp
+mv $REPO/dists/trusty/main/binary-amd64/Packages.backup $REPO/dists/trusty/main/binary-amd64/Packages
+mv $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup $REPO/dists/trusty/main/binary-amd64/Packages.gz
+mv $REPO/dists/trusty/Release.backup $REPO/dists/trusty/Release
+mv $DEST/etc/puppet/manifests/site.pp.backup $DEST/etc/puppet/manifests/site.pp
diff --git a/fuel/build/patch-packages/Makefile b/fuel/build/patch-packages/Makefile
new file mode 100644
index 000000000..339c9e7cf
--- /dev/null
+++ b/fuel/build/patch-packages/Makefile
@@ -0,0 +1,26 @@
+##############################################################################
+# 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
+##############################################################################
+
+SUBDIRS :=
+SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
+
+.PHONY: $(SUBDIRS) $(SUBCLEAN) clean
+$(SUBDIRS):
+ @mkdir -p release/packages
+ ORIGISO=$(ORIGISO) REVSTATE=$(REVSTATE) $(MAKE) -C $@ -f Makefile release
+
+release: $(SUBDIRS)
+ @echo $(ORIGISO)
+
+clean: $(SUBCLEAN)
+ @rm -Rf release
+
+$(SUBCLEAN): %.clean:
+ $(MAKE) -C $* -f Makefile clean
diff --git a/fuel/build/patch-packages/tools/correct_deps b/fuel/build/patch-packages/tools/correct_deps
new file mode 100755
index 000000000..cfb7d538f
--- /dev/null
+++ b/fuel/build/patch-packages/tools/correct_deps
@@ -0,0 +1,78 @@
+#!/bin/bash
+##############################################################################
+# 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
+##############################################################################
+
+
+patch_package () {
+ deb=$1
+ pkgdep=$2
+ newrev=$3
+
+
+ tmpdir=`mktemp -d /tmp/patchXXXXX`
+
+ cp $deb $tmpdir
+ pushd $tmpdir > /dev/null
+
+ mkdir -p repack
+ dpkg -x $deb repack
+
+ mkdir -p repack/DEBIAN
+ dpkg -e $deb repack/DEBIAN
+
+
+ pushd repack/DEBIAN > /dev/null
+
+ echo "Before: `cat control | grep '^Depends:'`"
+ sed -i "s/$pkgdep (\([^ ]*\) [^)]*)/$pkgdep (\1 $newrev)/" control
+ echo "After: `cat control | grep '^Depends:'`"
+ popd > /dev/null
+
+ fakeroot dpkg-deb --build repack
+
+ popd > /dev/null
+
+ cp $tmpdir/repack.deb $deb
+ rm -Rf $tmpdir
+}
+
+# Name of package for which to check dependencies to
+PKGDEP=$1
+# The old revision of the package in question
+OLDREV=$2
+# The new revision of the package in question
+NEWREV=$3
+
+if [ -z "$PKGDEP" ]; then
+ echo "No package dependency name"
+ exit 1
+fi
+
+if [ -z "$OLDREV" ]; then
+ echo "No old rev"
+ exit 1
+fi
+
+if [ -z "$NEWREV" ]; then
+ echo "No new rev"
+ exit 1
+fi
+
+
+for deb in *.deb
+do
+ ar p $deb control.tar.gz | tar xzO ./control | grep -q "^Depends:.* ${PKGDEP} ([^ ]* ${OLDREV})"
+ if [ $? -eq 0 ]; then
+ name=`ar p $deb control.tar.gz | tar xzO ./control | grep "^Package:.* " | sed 's/.* //'`
+ echo "**** Changing dependencies line in $deb ($name) ****"
+ patch_package $deb $PKGDEP $NEWREV
+ fi
+done
+
diff --git a/fuel/build/patch-packages/tools/deb_pack b/fuel/build/patch-packages/tools/deb_pack
new file mode 100755
index 000000000..f5d42dec3
--- /dev/null
+++ b/fuel/build/patch-packages/tools/deb_pack
@@ -0,0 +1,63 @@
+#!/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
+
+REV="$(echo $1 | tr '_' '-')"
+if [ -z "$REV" ]; then
+ echo "$ME: Error - no revision info provided"
+ exit 1
+fi
+
+if [ ! -d package ]; then
+ echo "$ME: Error - package directory does not exist"
+ exit 1
+fi
+
+echo "Stepping revision number to $REV"
+
+
+revision_step ()
+{
+ REV=$1
+
+ sed -i "s/^\(Version:.*$\)/\1-eri$REV/" package/DEBIAN/control
+}
+
+md5sum_gen ()
+{
+ pushd package
+ find * -type f | grep -v "^DEBIAN/" | xargs md5sum | sort > DEBIAN/md5sums
+ popd
+}
+
+revision_step $REV
+md5sum_gen
+fakeroot dpkg-deb --build package
+PKGNAME=`grep "^Package: " package/DEBIAN/control | awk '{ print $2 }'`
+PKGREV=`grep "^Version: " package/DEBIAN/control | awk '{ print $2 }'`
+mv package.deb ${PKGNAME}_${PKGREV}.deb
+
+ORIGPKG=`cat .package`
+
+# Add patch into file read by install.sh
+echo "$ORIGPKG>${PKGNAME}_${PKGREV}.deb" > patch-replacements
+
diff --git a/fuel/build/patch-packages/tools/deb_unpack b/fuel/build/patch-packages/tools/deb_unpack
new file mode 100755
index 000000000..aaa60b743
--- /dev/null
+++ b/fuel/build/patch-packages/tools/deb_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=package
+
+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/main/$DEB ];then
+ echo "Could not find package $DEB in source ISO!"
+fi
+
+mkdir -p $DEST
+dpkg -x $ISOROOT/ubuntu/pool/main/$DEB $DEST
+
+mkdir -p $DEST/DEBIAN
+dpkg -e $ISOROOT/ubuntu/pool/main/$DEB $DEST/DEBIAN
+
+echo $DEB > .package \ No newline at end of file
diff --git a/fuel/build/patch-packages/tools/udeb_pack b/fuel/build/patch-packages/tools/udeb_pack
new file mode 100755
index 000000000..e961a7320
--- /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 000000000..ed9cd21aa
--- /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
diff --git a/fuel/build/patch-packages/tr_example/Makefile b/fuel/build/patch-packages/tr_example/Makefile
new file mode 100644
index 000000000..b7cab3590
--- /dev/null
+++ b/fuel/build/patch-packages/tr_example/Makefile
@@ -0,0 +1,30 @@
+##############################################################################
+# 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 package
+ @rm -rf *.deb
+ @rm -rf patch-replacements
+ @rm -rf .package
+
+.PHONY: release
+release:
+ ../tools/deb_unpack python-oslo.messaging_1.3.0-fuel5.1~mira4_all.deb $(ORIGISO)
+ @mkdir -p package/etc
+ @echo "Hello, world" > package/etc/hello.txt
+ ../tools/deb_pack $(REVSTATE)
+ @cp *.deb ../release/packages
+ @cat patch-replacements >> ../release/patch-replacements