ip addr show $1 | grep -Eo '^\s+inet\s+[\.0-9]+' | awk '{print $2}'
}
+##finds subnet of ip and netmask
+##params: ip, netmask
+function find_subnet {
+ IFS=. read -r i1 i2 i3 i4 <<< "$1"
+ IFS=. read -r m1 m2 m3 m4 <<< "$2"
+ printf "%d.%d.%d.%d\n" "$((i1 & m1))" "$((i2 & m2))" "$((i3 & m3))" "$((i4 & m4))"
+}
+
+##finds netmask of interface
+##params: interface
+##returns long format 255.255.x.x
+function find_netmask {
+ ifconfig $1 | grep -Eo 'netmask\s+[\.0-9]+' | awk '{print $2}'
+}
+
+##finds short netmask of interface
+##params: interface
+##returns short format, ex: /21
+function find_short_netmask {
+ echo "/$(ip addr show $1 | grep -Eo '^\s+inet\s+[\/\.0-9]+' | awk '{print $2}' | cut -d / -f2)"
+}
+
##increments next IP
##params: ip
##assumes a /24 subnet
continue
fi
interface_ip_arr[$if_counter]=$new_ip
- sed -i 's/^.*eth_replace'"$if_counter"'.*$/ config.vm.network "public_network", ip: '\""$new_ip"\"', bridge: '\'"$interface"\''/' Vagrantfile
+ subnet_mask=$(find_netmask $interface)
+ if [ "$if_counter" -eq 1 ]; then
+ private_subnet_mask=$subnet_mask
+ private_short_subnet_mask=$(find_short_netmask $interface)
+ fi
+ sed -i 's/^.*eth_replace'"$if_counter"'.*$/ config.vm.network "public_network", ip: '\""$new_ip"\"', bridge: '\'"$interface"\'', netmask: '\""$subnet_mask"\"'/' Vagrantfile
((if_counter++))
done
sed -i 's/^.*default_gw =.*$/ default_gw = '\""$defaultgw"\"'/' Vagrantfile
fi
-sed -i 's/^.*default_gw:.*$/default_gw:'" $defaultgw"'/' opnfv_ksgen_settings.yml
-
if [ $base_config ]; then
if ! cp -f $base_config opnfv_ksgen_settings.yml; then
echo "{red}ERROR: Unable to copy $base_config to opnfv_ksgen_settings.yml${reset}"
##if single node deployment all the variables will have the same ip
##interface names will be enp0s3, enp0s8, enp0s9 in chef/centos7
+sed -i 's/^.*default_gw:.*$/default_gw:'" $defaultgw"'/' opnfv_ksgen_settings.yml
+
##replace private interface parameter
##private interface will be of hosts, so we need to know the provisioned host interface name
##we add biosdevname=0, net.ifnames=0 to the kickstart to use regular interface naming convention on hosts
if [ "$deployment_type" == "three_network" ]; then
sed -i 's/^.*storage_iface:.*$/ storage_iface: eth1/' opnfv_ksgen_settings.yml
- sed -i 's/^.*network_type:.*$/ network_type: three_network/' opnfv_ksgen_settings.yml
+ sed -i 's/^.*network_type:.*$/network_type: three_network/' opnfv_ksgen_settings.yml
else
sed -i 's/^.*storage_iface:.*$/ storage_iface: eth3/' opnfv_ksgen_settings.yml
fi
done
##replace private_subnet param
- network=.0
- baseaddr="$(echo $next_private_ip | cut -d. -f1-3)"
- private_subnet=$baseaddr$network
- sed -i 's/^.*private_subnet:.*$/ private_subnet:'" $private_subnet"''"\/24"'/' opnfv_ksgen_settings.yml
+ private_subnet=$(find_subnet $next_private_ip $private_subnet_mask)
+ private_subnet=$private_subnet'\'$private_short_subnet_mask
+ sed -i 's/^.*private_subnet:.*$/ private_subnet:'" $private_subnet"'/' opnfv_ksgen_settings.yml
else
printf '%s\n' 'deploy.sh: Unknown network type: $deployment_type' >&2
exit 1
#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
.PHONY: $(SUBDIRS)
$(SUBDIRS):
- @mkdir -p release/packages/ubuntu/pool/main release/puppet/modules release/isoroot
+ @mkdir -p release/packages/ubuntu/pool/main release/packages/ubuntu/pool/debian-installer release/puppet/modules release/isoroot
$(MAKE) -C $@ -f Makefile release
.PHONY: patch-packages
--- /dev/null
+##############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# stefan.k.berg@ericsson.com
+# jonas.bjurel@ericsson.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+Dir {
+ ArchiveDir ".";
+};
+
+TreeDefault {
+ Directory "pool";
+};
+
+BinDirectory "pool/debian-installer" {
+ Packages "dists/precise/main/debian-installer/binary-amd64/Packages";
+ BinOverride "./indices/override.precise.main.debian-installer";
+};
+
+Default {
+ Packages {
+ Extensions ".udeb";
+ Compress ". gzip";
+ };
+};
+
+Contents {
+ Compress "gzip";
+};
copy_packages() {
echo "Copying Debian packages..."
+ cd $TOP/release/packages/ubuntu/pool/debian-installer
+
+ for udeb in `ls -1 | grep '\.udeb$'`
+ do
+ echo " $udeb"
+ cp $udeb $REPO/pool/debian-installer
+ done
+
cd $TOP/release/packages/ubuntu/pool/main
for deb in `ls -1 | grep '\.deb$'`
do
# The below methods are from 15B
APT_REL_CONF="$TOP/install/apt-ftparchive-release.conf"
APT_DEB_CONF="$TOP/install/apt-ftparchive-deb.conf"
+ APT_UDEB_CONF="$TOP/install/apt-ftparchive-udeb.conf"
apt-ftparchive -c "${APT_REL_CONF}" generate "${APT_DEB_CONF}"
+ apt-ftparchive generate "${APT_UDEB_CONF}"
# Fuel also needs this index file
cat dists/precise/main/binary-amd64/Packages | \
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-SUBDIRS := python-nova
+SUBDIRS := python-nova debootstrap
SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
.PHONY: $(SUBDIRS) $(SUBCLEAN) clean
--- /dev/null
+##############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# stefan.k.berg@ericsson.com
+# jonas.bjurel@ericsson.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+TOP := $(shell pwd)
+
+.PHONY: all
+all:
+
+.PHONY: clean
+clean:
+ @rm -rf udebPackage
+ @rm -rf *.udeb
+ @rm -rf patch-replacements
+ @rm -rf .udebpackage
+
+.PHONY: release
+release:
+ ../tools/udeb_unpack debootstrap-udeb_1.0.4*.udeb $(ORIGISO)
+ patch -s -p0 < debootstrap.patch
+ ../tools/udeb_pack $(REVSTATE)
+ @cp *.udeb $(UDEB_DEST)
--- /dev/null
+--- udebPackage/usr/share/debootstrap/scripts/gutsy.orig 2014-11-10 18:21:37.000000000 +0000
++++ udebPackage/usr/share/debootstrap/scripts/gutsy 2015-04-15 09:28:44.290437000 +0000
+@@ -112,7 +112,8 @@
+
+ p; progress $baseprog $bases INSTCORE "Installing core packages" #2
+ ln -sf mawk "$TARGET/usr/bin/awk"
+- x_core_install base-files base-passwd
++ x_core_install base-passwd
++ x_core_install base-files
+ p; progress $baseprog $bases INSTCORE "Installing core packages" #3
+ x_core_install dpkg
+
--- /dev/null
+#!/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`
--- /dev/null
+#!/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