Update package list required for building ISO

Remove unused packages for building environment

Related-bug: #1517958

Change-Id: Id660806a59eb9aa81499a6de54ba1ed05a0fc363
This commit is contained in:
Sergey Kulanov 2015-09-09 21:29:26 +03:00
parent 135894c9f3
commit 18f2c14a92
1 changed files with 43 additions and 112 deletions

View File

@ -17,123 +17,54 @@
# This script will install all the required packages necessary for
# building a Fuel ISO.
# - We need not try to install rubygems on trusty, because it doesn't exists
# install yum and yum-utils from trusty, so it can handle the meta-data
# of OSCI rpm repositories. Works around ISO build failure (LP #1381535).
update_yum_utils ()
{
local pkgs="yum_3.4.3-2ubuntu1_all.deb yum-utils_1.1.31-2_all.deb"
# required for new yum-utils
local deps="python-iniparse"
local mirror="https://launchpad.net/ubuntu/+archive/primary/+files"
sudo apt-get install $deps
for pkg in $pkgs; do
rm -f $pkg >/dev/null 2>&1
wget "${mirror}/${pkg}"
sudo dpkg -i $pkg
done
}
DISTRO=$(lsb_release -c -s)
case "${DISTRO}" in
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
;;
precise)
GEMPKG="ruby ruby-dev rubygems"
# be sure, we will use nodejs from chris-lea
sudo tee /etc/apt/preferences.d/fuel-pin-300 <<EOF
Package: *nodejs*
Pin: release o=LP-PPA-chris-lea-node.js
Pin-Priority: 1000
EOF
# we need to use add-apt-repository command
sudo apt-get -y install software-properties-common python-software-properties
if hash nodejs 2> /dev/null; then
echo "Nodejs found, checking if it has proper version"
# Install correct nodejs from chris-lea
if ! dpkg-query -W -f='${Version}\n' nodejs | grep -q "1chl1"; then
# we don't have nodejs from chris-lea, need remove previous version
sudo apt-get -y remove nodejs npm
# install chris-lea repo, the package itself will be installed later
sudo add-apt-repository -y ppa:chris-lea/node.js
fi
else
# just add repository, package nodejs will be installed from
sudo add-apt-repository -y ppa:chris-lea/node.js
fi
sudo apt-get update && sudo apt-get -y install nodejs
;;
*)
echo "We currently doesn't support building on your distribution ${DISTRO}"
exit 1;
esac
# Check if docker is installed
if hash docker 2>/dev/null; then
echo "Docker binary found, checking if service is running..."
ps cax | grep docker > /dev/null
if [ $? -eq 0 ]; then
echo "Docker is running."
else
echo "Process is not running, starting it..."
sudo service docker start
fi
else
# Install docker repository
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
# Install docker repository
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get -y install -y apt-transport-https
fi
# Add the repository to APT sources
echo deb http://mirror.yandex.ru/mirrors/docker/ docker main | sudo tee /etc/apt/sources.list.d/docker.list
# Import the repository key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# Install docker
sudo apt-get update
sudo apt-get -y install lxc-docker-1.5.0
sudo apt-get install -y apt-transport-https
fi
# Add the repository to APT sources
echo deb http://mirror.yandex.ru/mirrors/docker/ docker main | sudo tee /etc/apt/sources.list.d/docker.list
# Import the repository key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# Install docker
sudo apt-get update
sudo apt-get -y install lxc-docker-1.6.2
# add user to docker group
sudo usermod -a -G docker "$(whoami)"
# Install software
sudo apt-get update
sudo apt-get -y install build-essential make git $GEMPKG debootstrap createrepo \
python-setuptools yum yum-utils libmysqlclient-dev isomd5sum bc \
python-nose libvirt-bin python-ipaddr python-paramiko python-yaml \
python-pip kpartx extlinux unzip genisoimage syslinux debmirror \
lrzip python-daemon python-dev libparse-debcontrol-perl reprepro devscripts \
xorriso rpm
sudo gem install bundler -v 1.2.1
sudo gem install builder
sudo pip install xmlbuilder jinja2 pbr
sudo npm install -g gulp
sudo chown -R `whoami`.`id -gn` `npm config get cache`
# we need linux-image-generic-lts-vivid kernel because of bug: https://bugs.launchpad.net/mos/+bug/1484485
sudo apt-get -y install \
build-essential \
createrepo \
debmirror \
debootstrap \
devscripts \
dosfstools \
extlinux \
git \
isomd5sum \
libparse-debcontrol-perl \
linux-image-generic-lts-vivid \
lrzip \
python-jinja2 \
python-yaml \
reprepro \
rpm \
syslinux \
unzip \
xorriso \
yum \
yum-utils
# Add account to sudoers
if sudo grep "`whoami` ALL=(ALL) NOPASSWD: ALL" /etc/sudoers; then
echo "Required /etc/sudoers record found"
else
echo "Required /etc/sudoers record not found, adding it..."
echo "`whoami` ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
fi
echo "Updating /etc/sudoers.d/fuel-iso"
cat << EOF | sudo tee /etc/sudoers.d/fuel-iso
Defaults env_keep += "http_proxy https_proxy no_proxy"
${USER} ALL=(ALL) NOPASSWD:ALL
EOF
case "${DISTRO}" in
precise)
update_yum_utils
;;
esac
# Fix tmp folder ownership
[ -d ~/tmp ] && sudo chown -R `whoami`.`id -gn` ~/tmp || mkdir ~/tmp
echo "Dependency check completed, please proceed with 'make iso' command"
echo "Dependency check completed, please reboot system and proceed with 'make iso' command"