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
115
functions
115
functions
@ -223,6 +223,12 @@ GetOSVersion() {
|
|||||||
os_UPDATE=""
|
os_UPDATE=""
|
||||||
if [[ "Debian,Ubuntu" =~ $os_VENDOR ]]; then
|
if [[ "Debian,Ubuntu" =~ $os_VENDOR ]]; then
|
||||||
os_PACKAGE="deb"
|
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
|
else
|
||||||
os_PACKAGE="rpm"
|
os_PACKAGE="rpm"
|
||||||
fi
|
fi
|
||||||
@ -246,6 +252,23 @@ GetOSVersion() {
|
|||||||
os_VENDOR=""
|
os_VENDOR=""
|
||||||
done
|
done
|
||||||
os_PACKAGE="rpm"
|
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
|
fi
|
||||||
export os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
|
export os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
|
||||||
}
|
}
|
||||||
@ -297,6 +320,15 @@ function GetDistro() {
|
|||||||
elif [[ "$os_VENDOR" =~ (Fedora) ]]; then
|
elif [[ "$os_VENDOR" =~ (Fedora) ]]; then
|
||||||
# For Fedora, just use 'f' and the release
|
# For Fedora, just use 'f' and the release
|
||||||
DISTRO="f$os_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
|
else
|
||||||
# Catch-all for now is Vendor + Release + Update
|
# Catch-all for now is Vendor + Release + Update
|
||||||
DISTRO="$os_VENDOR-$os_RELEASE.$os_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
|
# 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
|
# be owned by the installation user, we create the directory and change the
|
||||||
# ownership to the proper user.
|
# ownership to the proper user.
|
||||||
@ -542,7 +587,11 @@ function install_package() {
|
|||||||
|
|
||||||
apt_get install "$@"
|
apt_get install "$@"
|
||||||
else
|
else
|
||||||
yum_install "$@"
|
if is_suse; then
|
||||||
|
zypper_install "$@"
|
||||||
|
else
|
||||||
|
yum_install "$@"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,7 +642,7 @@ function pip_install {
|
|||||||
SUDO_PIP="env"
|
SUDO_PIP="env"
|
||||||
else
|
else
|
||||||
SUDO_PIP="sudo"
|
SUDO_PIP="sudo"
|
||||||
if [[ "$os_PACKAGE" = "deb" ]]; then
|
if [[ "$os_PACKAGE" = "deb" || is_suse ]]; then
|
||||||
CMD_PIP=/usr/bin/pip
|
CMD_PIP=/usr/bin/pip
|
||||||
else
|
else
|
||||||
CMD_PIP=/usr/bin/pip-python
|
CMD_PIP=/usr/bin/pip-python
|
||||||
@ -946,6 +995,68 @@ function _ssh_check_novanet() {
|
|||||||
fi
|
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
|
# Restore xtrace
|
||||||
$XTRACE
|
$XTRACE
|
||||||
|
|
||||||
|
@ -63,11 +63,7 @@ function configure_cinder() {
|
|||||||
cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
|
cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
|
||||||
|
|
||||||
# Set the paths of certain binaries
|
# Set the paths of certain binaries
|
||||||
if [[ "$os_PACKAGE" = "deb" ]]; then
|
CINDER_ROOTWRAP=$(get_rootwrap_location cinder)
|
||||||
CINDER_ROOTWRAP=/usr/local/bin/cinder-rootwrap
|
|
||||||
else
|
|
||||||
CINDER_ROOTWRAP=/usr/bin/cinder-rootwrap
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If Cinder ships the new rootwrap filters files, deploy them
|
# If Cinder ships the new rootwrap filters files, deploy them
|
||||||
# (owned by root) and add a parameter to $CINDER_ROOTWRAP
|
# (owned by root) and add a parameter to $CINDER_ROOTWRAP
|
||||||
|
@ -25,7 +25,11 @@ function configure_database_mysql {
|
|||||||
MYSQL=mysql
|
MYSQL=mysql
|
||||||
else
|
else
|
||||||
MY_CONF=/etc/my.cnf
|
MY_CONF=/etc/my.cnf
|
||||||
MYSQL=mysqld
|
if is_suse; then
|
||||||
|
MYSQL=mysql
|
||||||
|
else
|
||||||
|
MYSQL=mysqld
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start mysql-server
|
# Start mysql-server
|
||||||
|
14
lib/horizon
14
lib/horizon
@ -81,9 +81,17 @@ function init_horizon() {
|
|||||||
sudo a2ensite horizon
|
sudo a2ensite horizon
|
||||||
else
|
else
|
||||||
# Install httpd, which is NOPRIME'd
|
# Install httpd, which is NOPRIME'd
|
||||||
APACHE_NAME=httpd
|
if is_suse; then
|
||||||
APACHE_CONF=conf.d/horizon.conf
|
APACHE_NAME=apache2
|
||||||
sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
|
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
|
fi
|
||||||
|
|
||||||
# Configure apache to run horizon
|
# Configure apache to run horizon
|
||||||
|
8
lib/nova
8
lib/nova
@ -47,11 +47,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the paths of certain binaries
|
# Set the paths of certain binaries
|
||||||
if [[ "$os_PACKAGE" = "deb" ]]; then
|
NOVA_ROOTWRAP=$(get_rootwrap_location nova)
|
||||||
NOVA_ROOTWRAP=/usr/local/bin/nova-rootwrap
|
|
||||||
else
|
|
||||||
NOVA_ROOTWRAP=/usr/bin/nova-rootwrap
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Allow rate limiting to be turned off for testing, like for Tempest
|
# Allow rate limiting to be turned off for testing, like for Tempest
|
||||||
# NOTE: Set API_RATE_LIMIT="False" to turn OFF rate limiting
|
# 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
|
# The user that nova runs as needs to be member of **libvirtd** group otherwise
|
||||||
# nova-compute will be unable to use libvirt.
|
# 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
|
# libvirt detects various settings on startup, as we potentially changed
|
||||||
# the system configuration (modules, filesystems), we need to restart
|
# 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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Qpid was introduced to Ubuntu in precise, disallow it on oneiric
|
if is_service_enabled qpid && ! qpid_is_supported; then
|
||||||
if [ "${DISTRO}" = "oneiric" ] && is_service_enabled qpid ; then
|
echo "Qpid support is not available for this version of your distribution."
|
||||||
echo "You must use Ubuntu Precise or newer for Qpid support."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user