Add partial openSUSE/SLE support
Note that this is the first part of the support. A second part involves dealing with the package names. Among the changes: - add several functions to determine some distro-specific behavior (how to call usermod, if some features are available on the distro, etc.) - correctly detect openSUSE and SLE in GetOSVersion, and set DISTRO accordingly - new is_suse() function to check if running on a SUSE-based distro - use zypper to install packages - adapt apache virtual host configuration for openSUSE - some simple fixes (path to pip, mysql service name) Change-Id: Id2f7c9e18a1c4a7b7cea262ea7959d183e4b0cf0
This commit is contained in:
parent
ff828ce3f6
commit
856a11e0e4
113
functions
113
functions
@ -223,6 +223,12 @@ GetOSVersion() {
|
||||
os_UPDATE=""
|
||||
if [[ "Debian,Ubuntu" =~ $os_VENDOR ]]; then
|
||||
os_PACKAGE="deb"
|
||||
elif [[ "SUSE LINUX" =~ $os_VENDOR ]]; then
|
||||
lsb_release -d -s | grep -q openSUSE
|
||||
if [[ $? -eq 0 ]]; then
|
||||
os_VENDOR="openSUSE"
|
||||
fi
|
||||
os_PACKAGE="rpm"
|
||||
else
|
||||
os_PACKAGE="rpm"
|
||||
fi
|
||||
@ -246,6 +252,23 @@ GetOSVersion() {
|
||||
os_VENDOR=""
|
||||
done
|
||||
os_PACKAGE="rpm"
|
||||
elif [[ -r /etc/SuSE-release ]]; then
|
||||
for r in openSUSE "SUSE Linux"; do
|
||||
if [[ "$r" = "SUSE Linux" ]]; then
|
||||
os_VENDOR="SUSE LINUX"
|
||||
else
|
||||
os_VENDOR=$r
|
||||
fi
|
||||
|
||||
if [[ -n "`grep \"$r\" /etc/SuSE-release`" ]]; then
|
||||
os_CODENAME=`grep "CODENAME = " /etc/SuSE-release | sed 's:.* = ::g'`
|
||||
os_RELEASE=`grep "VERSION = " /etc/SuSE-release | sed 's:.* = ::g'`
|
||||
os_UPDATE=`grep "PATCHLEVEL = " /etc/SuSE-release | sed 's:.* = ::g'`
|
||||
break
|
||||
fi
|
||||
os_VENDOR=""
|
||||
done
|
||||
os_PACKAGE="rpm"
|
||||
fi
|
||||
export os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
|
||||
}
|
||||
@ -297,6 +320,15 @@ function GetDistro() {
|
||||
elif [[ "$os_VENDOR" =~ (Fedora) ]]; then
|
||||
# For Fedora, just use 'f' and the release
|
||||
DISTRO="f$os_RELEASE"
|
||||
elif [[ "$os_VENDOR" =~ (openSUSE) ]]; then
|
||||
DISTRO="opensuse-$os_RELEASE"
|
||||
elif [[ "$os_VENDOR" =~ (SUSE LINUX) ]]; then
|
||||
# For SLE, also use the service pack
|
||||
if [[ -z "$os_UPDATE" ]]; then
|
||||
DISTRO="sle${os_RELEASE}"
|
||||
else
|
||||
DISTRO="sle${os_RELEASE}sp${os_UPDATE}"
|
||||
fi
|
||||
else
|
||||
# Catch-all for now is Vendor + Release + Update
|
||||
DISTRO="$os_VENDOR-$os_RELEASE.$os_UPDATE"
|
||||
@ -305,6 +337,19 @@ function GetDistro() {
|
||||
}
|
||||
|
||||
|
||||
# Determine if current distribution is a SUSE-based distribution
|
||||
# (openSUSE, SLE).
|
||||
# is_suse
|
||||
function is_suse {
|
||||
if [[ -z "$os_VENDOR" ]]; then
|
||||
GetOSVersion
|
||||
fi
|
||||
|
||||
[[ "$os_VENDOR" = "openSUSE" || "$os_VENDOR" = "SUSE LINUX" ]]
|
||||
return $?
|
||||
}
|
||||
|
||||
|
||||
# git clone only if directory doesn't exist already. Since ``DEST`` might not
|
||||
# be owned by the installation user, we create the directory and change the
|
||||
# ownership to the proper user.
|
||||
@ -541,9 +586,13 @@ function install_package() {
|
||||
NO_UPDATE_REPOS=True
|
||||
|
||||
apt_get install "$@"
|
||||
else
|
||||
if is_suse; then
|
||||
zypper_install "$@"
|
||||
else
|
||||
yum_install "$@"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@ -593,7 +642,7 @@ function pip_install {
|
||||
SUDO_PIP="env"
|
||||
else
|
||||
SUDO_PIP="sudo"
|
||||
if [[ "$os_PACKAGE" = "deb" ]]; then
|
||||
if [[ "$os_PACKAGE" = "deb" || is_suse ]]; then
|
||||
CMD_PIP=/usr/bin/pip
|
||||
else
|
||||
CMD_PIP=/usr/bin/pip-python
|
||||
@ -946,6 +995,68 @@ function _ssh_check_novanet() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# zypper wrapper to set arguments correctly
|
||||
# zypper_install package [package ...]
|
||||
function zypper_install() {
|
||||
[[ "$OFFLINE" = "True" ]] && return
|
||||
local sudo="sudo"
|
||||
[[ "$(id -u)" = "0" ]] && sudo="env"
|
||||
$sudo http_proxy=$http_proxy https_proxy=$https_proxy \
|
||||
zypper --non-interactive install --auto-agree-with-licenses "$@"
|
||||
}
|
||||
|
||||
|
||||
# Add a user to a group.
|
||||
# add_user_to_group user group
|
||||
function add_user_to_group() {
|
||||
local user=$1
|
||||
local group=$2
|
||||
|
||||
if [[ -z "$os_VENDOR" ]]; then
|
||||
GetOSVersion
|
||||
fi
|
||||
|
||||
# SLE11 and openSUSE 12.2 don't have the usual usermod
|
||||
if ! is_suse || [[ "$os_VENDOR" = "openSUSE" && "$os_RELEASE" != "12.2" ]]; then
|
||||
sudo usermod -a -G "$group" "$user"
|
||||
else
|
||||
sudo usermod -A "$group" "$user"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Get the location of the $module-rootwrap executables, where module is cinder
|
||||
# or nova.
|
||||
# get_rootwrap_location module
|
||||
function get_rootwrap_location() {
|
||||
local module=$1
|
||||
|
||||
if [[ -z "$os_PACKAGE" ]]; then
|
||||
GetOSVersion
|
||||
fi
|
||||
|
||||
if [[ "$os_PACKAGE" = "deb" || is_suse ]]; then
|
||||
echo "/usr/local/bin/$module-rootwrap"
|
||||
else
|
||||
echo "/usr/bin/$module-rootwrap"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Check if qpid can be used on the current distro.
|
||||
# qpid_is_supported
|
||||
function qpid_is_supported() {
|
||||
if [[ -z "$DISTRO" ]]; then
|
||||
GetDistro
|
||||
fi
|
||||
|
||||
# Qpid was introduced to Ubuntu in precise, disallow it on oneiric; it is
|
||||
# not in openSUSE either right now.
|
||||
[[ "$DISTRO" = "oneiric" || is_suse ]]
|
||||
return $?
|
||||
}
|
||||
|
||||
# Restore xtrace
|
||||
$XTRACE
|
||||
|
||||
|
@ -63,11 +63,7 @@ function configure_cinder() {
|
||||
cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
|
||||
|
||||
# Set the paths of certain binaries
|
||||
if [[ "$os_PACKAGE" = "deb" ]]; then
|
||||
CINDER_ROOTWRAP=/usr/local/bin/cinder-rootwrap
|
||||
else
|
||||
CINDER_ROOTWRAP=/usr/bin/cinder-rootwrap
|
||||
fi
|
||||
CINDER_ROOTWRAP=$(get_rootwrap_location cinder)
|
||||
|
||||
# If Cinder ships the new rootwrap filters files, deploy them
|
||||
# (owned by root) and add a parameter to $CINDER_ROOTWRAP
|
||||
|
@ -25,8 +25,12 @@ function configure_database_mysql {
|
||||
MYSQL=mysql
|
||||
else
|
||||
MY_CONF=/etc/my.cnf
|
||||
if is_suse; then
|
||||
MYSQL=mysql
|
||||
else
|
||||
MYSQL=mysqld
|
||||
fi
|
||||
fi
|
||||
|
||||
# Start mysql-server
|
||||
if [[ "$os_PACKAGE" = "rpm" ]]; then
|
||||
|
@ -81,10 +81,18 @@ function init_horizon() {
|
||||
sudo a2ensite horizon
|
||||
else
|
||||
# Install httpd, which is NOPRIME'd
|
||||
if is_suse; then
|
||||
APACHE_NAME=apache2
|
||||
APACHE_CONF=vhosts.d/horizon.conf
|
||||
# Append wsgi to the list of modules to load
|
||||
grep -q "^APACHE_MODULES=.*wsgi" /etc/sysconfig/apache2 ||
|
||||
sudo sed '/^APACHE_MODULES=/s/^\(.*\)"$/\1 wsgi"/' -i /etc/sysconfig/apache2
|
||||
else
|
||||
APACHE_NAME=httpd
|
||||
APACHE_CONF=conf.d/horizon.conf
|
||||
sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# Configure apache to run horizon
|
||||
sudo sh -c "sed -e \"
|
||||
|
8
lib/nova
8
lib/nova
@ -47,11 +47,7 @@ else
|
||||
fi
|
||||
|
||||
# Set the paths of certain binaries
|
||||
if [[ "$os_PACKAGE" = "deb" ]]; then
|
||||
NOVA_ROOTWRAP=/usr/local/bin/nova-rootwrap
|
||||
else
|
||||
NOVA_ROOTWRAP=/usr/bin/nova-rootwrap
|
||||
fi
|
||||
NOVA_ROOTWRAP=$(get_rootwrap_location nova)
|
||||
|
||||
# Allow rate limiting to be turned off for testing, like for Tempest
|
||||
# NOTE: Set API_RATE_LIMIT="False" to turn OFF rate limiting
|
||||
@ -252,7 +248,7 @@ EOF'
|
||||
|
||||
# The user that nova runs as needs to be member of **libvirtd** group otherwise
|
||||
# nova-compute will be unable to use libvirt.
|
||||
sudo usermod -a -G libvirtd `whoami`
|
||||
add_user_to_group `whoami` libvirtd
|
||||
|
||||
# libvirt detects various settings on startup, as we potentially changed
|
||||
# the system configuration (modules, filesystems), we need to restart
|
||||
|
5
stack.sh
5
stack.sh
@ -113,9 +113,8 @@ if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|f16|f17) ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Qpid was introduced to Ubuntu in precise, disallow it on oneiric
|
||||
if [ "${DISTRO}" = "oneiric" ] && is_service_enabled qpid ; then
|
||||
echo "You must use Ubuntu Precise or newer for Qpid support."
|
||||
if is_service_enabled qpid && ! qpid_is_supported; then
|
||||
echo "Qpid support is not available for this version of your distribution."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user