Merge pull request #184 from chmouel/install-packages-only-for-services-distros
Install packages only for services distros
This commit is contained in:
commit
5334ca0210
2 changed files with 64 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
dnsmasq-base
|
dnsmasq-base
|
||||||
dnsmasq-utils # for dhcp_release
|
dnsmasq-utils # for dhcp_release only available in dist:oneiric
|
||||||
kpartx
|
kpartx
|
||||||
parted
|
parted
|
||||||
arping # used for send_arp_for_ha option in nova-network
|
arping # used for send_arp_for_ha option in nova-network
|
||||||
|
|
61
stack.sh
61
stack.sh
|
@ -22,7 +22,9 @@
|
||||||
|
|
||||||
# Warn users who aren't on natty, but allow them to override check and attempt
|
# Warn users who aren't on natty, but allow them to override check and attempt
|
||||||
# installation with ``FORCE=yes ./stack``
|
# installation with ``FORCE=yes ./stack``
|
||||||
if ! egrep -q 'natty|oneiric' /etc/lsb-release; then
|
DISTRO=$(lsb_release -c -s)
|
||||||
|
|
||||||
|
if [[ ! ${DISTRO} =~ (natty|oneiric) ]]; then
|
||||||
echo "WARNING: this script has only been tested on natty and oneiric"
|
echo "WARNING: this script has only been tested on natty and oneiric"
|
||||||
if [[ "$FORCE" != "yes" ]]; then
|
if [[ "$FORCE" != "yes" ]]; then
|
||||||
echo "If you wish to run this script anyway run with FORCE=yes"
|
echo "If you wish to run this script anyway run with FORCE=yes"
|
||||||
|
@ -372,10 +374,65 @@ fi
|
||||||
#
|
#
|
||||||
# Openstack uses a fair number of other projects.
|
# Openstack uses a fair number of other projects.
|
||||||
|
|
||||||
|
# - We are going to install packages only for the services needed.
|
||||||
|
# - We are parsing the packages files and detecting metadatas.
|
||||||
|
# - If there is a NOPRIME as comment mean we are not doing the install
|
||||||
|
# just yet.
|
||||||
|
# - If we have the meta-keyword distro:DISTRO or
|
||||||
|
# distro:DISTRO1,DISTRO2 it will be installed only for those
|
||||||
|
# distros (case insensitive).
|
||||||
|
function get_packages() {
|
||||||
|
local file_to_parse="general"
|
||||||
|
local service
|
||||||
|
|
||||||
|
for service in ${ENABLED_SERVICES//,/ }; do
|
||||||
|
if [[ $service == n-* ]]; then
|
||||||
|
if [[ ! $file_to_parse =~ nova ]]; then
|
||||||
|
file_to_parse="${file_to_parse} nova"
|
||||||
|
fi
|
||||||
|
elif [[ $service == g-* ]]; then
|
||||||
|
if [[ ! $file_to_parse =~ glance ]]; then
|
||||||
|
file_to_parse="${file_to_parse} glance"
|
||||||
|
fi
|
||||||
|
elif [[ $service == key* ]]; then
|
||||||
|
if [[ ! $file_to_parse =~ keystone ]]; then
|
||||||
|
file_to_parse="${file_to_parse} keystone"
|
||||||
|
fi
|
||||||
|
elif [[ -e $FILES/apts/${service} ]]; then
|
||||||
|
file_to_parse="${file_to_parse} $service"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for file in ${file_to_parse}; do
|
||||||
|
local fname=${FILES}/apts/${file}
|
||||||
|
local OIFS line package distros distro
|
||||||
|
[[ -e $fname ]] || { echo "missing: $fname"; exit 1 ;}
|
||||||
|
|
||||||
|
OIFS=$IFS
|
||||||
|
IFS=$'\n'
|
||||||
|
for line in $(<${fname}); do
|
||||||
|
if [[ $line =~ "NOPRIME" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $line =~ (.*)#.*dist:([^ ]*) ]]; then # We are using BASH regexp matching feature.
|
||||||
|
package=${BASH_REMATCH[1]}
|
||||||
|
distros=${BASH_REMATCH[2]}
|
||||||
|
for distro in ${distros//,/ }; do #In bash ${VAR,,} will lowecase VAR
|
||||||
|
[[ ${distro,,} == ${DISTRO,,} ]] && echo $package
|
||||||
|
done
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ${line%#*}
|
||||||
|
done
|
||||||
|
IFS=$OIFS
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# install apt requirements
|
# install apt requirements
|
||||||
apt_get update
|
apt_get update
|
||||||
apt_get install `cat $FILES/apts/* | cut -d\# -f1 | grep -Ev "mysql-server|rabbitmq-server|memcached"`
|
apt_get install $(get_packages)
|
||||||
|
|
||||||
# install python requirements
|
# install python requirements
|
||||||
sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install --use-mirrors `cat $FILES/pips/*`
|
sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install --use-mirrors `cat $FILES/pips/*`
|
||||||
|
|
Loading…
Reference in a new issue