Skip to content

Commit

Permalink
Update install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kenneth104 authored and minli1 committed Feb 20, 2019
1 parent a938a25 commit 69d74dc
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash
DEFAULT_CEPH_VERSION="luminous"
DEFAULT_CEPH_VERSION="mimic"

# Usage: installCephRepo <ceph-version>
function installCephRepo {
echo "Install new Repos"
yum install --enablerepo="extras,base" -y centos-release-ceph-$1.noarch
rpm -Uvh https://download.ceph.com/rpms/{distro}/x86_64/ceph-$1.el7.noarch.rpm
echo "centos" > /etc/yum/vars/contentdir
}

# Usage: removeCephRepo <ceph-version>
function removeCephRepo {
yum erase -y centos-release-ceph-$1.noarch
rpm -e --nodeps ceph-$1.el7.noarch
}

# Usage: removeXCPngRepo
Expand All @@ -23,17 +23,35 @@ function installXCPngRepo {
major_version=`cat /etc/centos-release | awk '{print $3}' | awk -F. '{print $1}'`
major_minor_version=`cat /etc/centos-release | awk '{print $3}' | awk -F. '{print $1"."$2}'`
cat << EOF >/etc/yum.repos.d/xcp-ng.repo
[xcp-ng-extras_testing]
name=XCP-ng Extras Testing Repository
baseurl=https://updates.xcp-ng.org/${major_version}/${major_minor_version}/extras_testing/x86_64/
enabled=0
gpgcheck=0
[xcp-ng-base]
name=XCP-ng Base Repository
baseurl=https://updates.xcp-ng.org/${major_version}/${major_minor_version}/base/x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-xcpng
[xcp-ng-updates]
name=XCP-ng Updates Repository
baseurl=https://updates.xcp-ng.org/${major_version}/${major_minor_version}/updates/x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-xcpng
[xcp-ng-extras]
name=XCP-ng Extras Repository
baseurl=https://updates.xcp-ng.org/${major_version}/${major_minor_version}/extras/x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-xcpng
EOF
}

# Usage: confirmInstallation
function confirmInstallation {
echo "This script is going to install 'xcp-ng-extras_testing' repository"
echo "This script is going to install 'xcp-ng' repository"
echo "and upgrade 'glibc' and 'qemu-dp' packages."
echo "Please note that Ceph support is experimental and can lead to"
echo "an unstable system and data loss"
Expand Down Expand Up @@ -103,7 +121,7 @@ function unconfigureFirewall {

function installCeph {
echo "Install Ceph API"
yum install --enablerepo="extras,base" -y python-rbd rbd-nbd
yum install -y python-rbd rbd-nbd
}

function uninstallCeph {
Expand All @@ -112,8 +130,8 @@ function uninstallCeph {
}

function upgradeDeps {
yum install --enablerepo="xcp-ng-extras_testing*" -y qemu-dp
yum install --enablerepo="extras,base" -y glibc-2.17-222.el7
yum install --enablerepo="xcp-ng*" -y qemu-dp
yum install --enablerepo="extras,base" -y glibc
}

function downgradeDeps {
Expand Down Expand Up @@ -181,7 +199,9 @@ function installFiles {
ln -s rbd+raw+qdisk /usr/libexec/xapi-storage-script/datapath/rbd+qcow2+qdisk

rm -rf /lib/python2.7/site-packages/xapi/storage/libs/librbd
mkdir /lib/python2.7/site-packages/xapi/storage/libs
mkdir /lib/python2.7/site-packages/xapi/storage/libs/librbd
touch /lib/python2.7/site-packages/xapi/storage/libs/__init__.py

copyFile "xapi/storage/libs/librbd/__init__.py" "/lib/python2.7/site-packages/xapi/storage/libs/librbd/__init__.py"
copyFile "xapi/storage/libs/librbd/ceph_utils.py" "/lib/python2.7/site-packages/xapi/storage/libs/librbd/ceph_utils.py"
Expand Down

0 comments on commit 69d74dc

Please sign in to comment.