From 23098a88717d03c5c88d050d86f745c014edb442 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Wed, 18 Jun 2014 10:04:18 +0200 Subject: [PATCH] Scripts to configure yum and upgrade system The first script in this changeset configures yum to use a proxy (if VM_PROXY is set) and adds the RDO repo. The second script updates the packages installed in a yum-based system. Partial-Bug: 1312764 Implements: blueprint openstack-training-labs Change-Id: Iad42b6aad2bf48329cb2c3bb2bc7a1d698d9c608 --- labs/scripts/yum_init.sh | 27 +++++++++++++++++++++++++++ labs/scripts/yum_update.sh | 12 ++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 labs/scripts/yum_init.sh create mode 100644 labs/scripts/yum_update.sh diff --git a/labs/scripts/yum_init.sh b/labs/scripts/yum_init.sh new file mode 100644 index 00000000..95c761cb --- /dev/null +++ b/labs/scripts/yum_init.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +TOP_DIR=$(cd $(dirname "$0")/.. && pwd) +source "$TOP_DIR/config/paths" +source "$CONFIG_DIR/openstack" +# Pick up VM_PROXY +source "$CONFIG_DIR/localrc" +source "$LIB_DIR/functions.guest" + +indicate_current_auto + +exec_logfile + +function set_yum_proxy { + local YUM_FILE=/etc/yum.conf + if [ -z "${VM_PROXY-}" ]; then return 0; fi + echo "proxy=${VM_PROXY}" | sudo tee -a $YUM_FILE +} + +set_yum_proxy + +# Enable RDO repo +if [[ ${OPENSTACK_RELEASE:-} = icehouse ]]; then + sudo yum install "http://repos.fedorapeople.org/repos/openstack/openstack-$OPENSTACK_RELEASE/rdo-release-$OPENSTACK_RELEASE-3.noarch.rpm" +else + echo 2>&1 "ERROR Unknown OpenStack release." + return 1 +fi diff --git a/labs/scripts/yum_update.sh b/labs/scripts/yum_update.sh new file mode 100644 index 00000000..6cb13e34 --- /dev/null +++ b/labs/scripts/yum_update.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +TOP_DIR=$(cd $(dirname "$0")/.. && pwd) +source "$TOP_DIR/config/paths" +source "$CONFIG_DIR/openstack" +source "$LIB_DIR/functions.guest" + +indicate_current_auto + +exec_logfile + +# Upgrade installed packages +sudo yum -y update