add multi os version support in compass installation
Change-Id: Ide2988ad571b66036491195e6b22428c016d9b57 Partial-Bug: 1404040
This commit is contained in:
parent
7423682471
commit
7c65b99d98
@ -3,5 +3,5 @@ DSPLAY_NAME = 'Ceph Firefly'
|
||||
PARENT = 'ceph'
|
||||
PACKAGE_INSTALLER = 'chef_installer'
|
||||
OS_INSTALLER = 'cobbler'
|
||||
SUPPORTED_OS_PATTERNS = ['(?i)centos.*', '(?i)ubuntu.*']
|
||||
SUPPORTED_OS_PATTERNS = ['(?i)centos-6\.5.*', '(?i)ubuntu-12\.04.*']
|
||||
DEPLOYABLE = True
|
||||
|
@ -4,5 +4,5 @@ PARENT = 'openstack'
|
||||
DISTRIBUTED_SYSTEM = 'openstack_ceph'
|
||||
PACKAGE_INSTALLER = 'chef_installer'
|
||||
OS_INSTALLER = 'cobbler'
|
||||
SUPPORTED_OS_PATTERNS = ['(?i)centos.*', '(?i)ubuntu.*']
|
||||
SUPPORTED_OS_PATTERNS = ['(?i)centos-6\.5.*', '(?i)ubuntu-12\.04.*']
|
||||
DEPLOYABLE = True
|
||||
|
@ -3,5 +3,5 @@ DISPLAY_NAME = 'OpenStack Icehouse'
|
||||
PARENT = 'openstack'
|
||||
PACKAGE_INSTALLER = 'chef_installer'
|
||||
OS_INSTALLER = 'cobbler'
|
||||
SUPPORTED_OS_PATTERNS = ['(?i)centos.*', '(?i)ubuntu.*']
|
||||
SUPPORTED_OS_PATTERNS = ['(?i)centos-6\.5.*', '(?i)ubuntu-12\.04.*']
|
||||
DEPLOYABLE = True
|
||||
|
@ -1,4 +1,3 @@
|
||||
NAME = 'openstack'
|
||||
PARENT = 'general'
|
||||
DISTRIBUTED_SYSTEM = 'openstack'
|
||||
SUPPORTED_OSES = ['CentOS6.5', 'Ubuntu12.04']
|
||||
|
@ -1,5 +1,5 @@
|
||||
NAME = 'os_only'
|
||||
PARENT = 'general'
|
||||
OS_INSTALLER = 'cobbler'
|
||||
SUPPORTED_OS_PATTERNS = ['(?i)centos.*', '(?i)ubuntu.*']
|
||||
SUPPORTED_OS_PATTERNS = ['(?i)centos-6\.5.*', '(?i)ubuntu-12\.04.*']
|
||||
DEPLOYABLE = True
|
||||
|
3
conf/os/centos6.6.conf
Normal file
3
conf/os/centos6.6.conf
Normal file
@ -0,0 +1,3 @@
|
||||
NAME = 'CentOS-6.6-x86_64'
|
||||
PARENT = 'CentOS'
|
||||
DEPLOYABLE = True
|
3
conf/os/centos7.0.conf
Normal file
3
conf/os/centos7.0.conf
Normal file
@ -0,0 +1,3 @@
|
||||
NAME = 'CentOS-7.0-x86_64'
|
||||
PARENT = 'CentOS'
|
||||
DEPLOYABLE = True
|
3
conf/os/ubuntu14.04.conf
Normal file
3
conf/os/ubuntu14.04.conf
Normal file
@ -0,0 +1,3 @@
|
||||
NAME = 'Ubuntu-14.04-x86_64'
|
||||
PARENT = 'Ubuntu'
|
||||
DEPLOYABLE = True
|
@ -19,13 +19,11 @@ sudo mkdir -p /root/backup/chef
|
||||
|
||||
sudo rpm -q chef-server
|
||||
if [[ "$?" != "0" ]]; then
|
||||
CHEF_SRV_SOURCE=`fastesturl "$CHEF_SRV" "$CHEF_SRV_HUAWEI"`
|
||||
download $CHEF_SRV_SOURCE chef-server install || exit $?
|
||||
download -u $CHEF_SRV -u $CHEF_SRV_HUAWEI `basename $CHEF_SRV` install || exit $?
|
||||
else
|
||||
echo "chef-server has already installed"
|
||||
fi
|
||||
|
||||
|
||||
echo "reconfigure chef server"
|
||||
# configure chef-server
|
||||
sudo chef-server-ctl cleanse
|
||||
@ -42,13 +40,12 @@ fi
|
||||
|
||||
echo "configure chef client and knife"
|
||||
# configure chef client and knife
|
||||
if [[ `rpm -q chef` ]]; then
|
||||
sudo rpm -e `rpm -q chef`
|
||||
sudo rpm -q chef
|
||||
if [[ "$?" != "0" ]]; then
|
||||
download -u $CHEF_CLIENT -u $CHEF_CLIENT_HUAWEI `basename $CHEF_CLIENT` install || exit $?
|
||||
else
|
||||
echo "going to install chef client"
|
||||
echo "chef client has already installed"
|
||||
fi
|
||||
CENTOS_CHEF_CLIENT_SOURCE=`fastesturl "$CENTOS_CHEF_CLIENT" "$CENTOS_CHEF_CLIENT_HUAWEI"`
|
||||
download $CENTOS_CHEF_CLIENT_SOURCE `basename $CENTOS_CHEF_CLIENT_SOURCE` install || exit $?
|
||||
|
||||
sudo mkdir -p ~/.chef
|
||||
|
||||
|
@ -22,6 +22,7 @@ else
|
||||
find /usr/lib -name manage_bind.py |xargs perl -pi.old -e 's/(\s+)(self\.logger\s+\= logger)/$1$2\n$1if self\.logger is None:\n$1 import clogger\n$1 self\.logger = clogger.Logger\(\)/'
|
||||
fi
|
||||
|
||||
# cobbler snippet uses netaddr to calc subnet and ip addr
|
||||
sudo pip install netaddr
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to install pip packages"
|
||||
@ -163,7 +164,6 @@ mkdir -p /var/log/cobbler/tasks
|
||||
mkdir -p /var/log/cobbler/anamon
|
||||
chmod -R 777 /var/log/cobbler
|
||||
|
||||
|
||||
sudo service httpd restart
|
||||
sudo service cobblerd restart
|
||||
sudo cobbler get-loaders
|
||||
@ -215,96 +215,227 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PPA_REPO_URL=`fastesturl http://mirror.centos.org http://mirrors.hustunique.com`
|
||||
# create centos repo
|
||||
sudo rm -rf /var/lib/cobbler/repo_mirror/centos_ppa_repo
|
||||
sudo mkdir -p /var/lib/cobbler/repo_mirror/centos_ppa_repo
|
||||
found_centos_ppa_repo=0
|
||||
for repo in $(cobbler repo list); do
|
||||
if [ "$repo" == "centos_ppa_repo" ]; then
|
||||
found_centos_ppa_repo=1
|
||||
fi
|
||||
done
|
||||
if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then
|
||||
sudo rm -rf /var/lib/cobbler/repo_mirror/centos_6_5_ppa_repo
|
||||
sudo mkdir -p /var/lib/cobbler/repo_mirror/centos_6_5_ppa_repo
|
||||
found_centos_6_5_ppa_repo=0
|
||||
for repo in $(cobbler repo list); do
|
||||
if [ "$repo" == "centos_6_5_ppa_repo" ]; then
|
||||
found_centos_6_5_ppa_repo=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$found_centos_ppa_repo" == "0" ]; then
|
||||
sudo cobbler repo add --mirror=/var/lib/cobbler/repo_mirror/centos_ppa_repo --name=centos_ppa_repo --mirror-locally=Y --arch=${CENTOS_IMAGE_ARCH}
|
||||
if [ "$found_centos_6_5_ppa_repo" == "0" ]; then
|
||||
sudo cobbler repo add --mirror=/var/lib/cobbler/repo_mirror/centos_6_5_ppa_repo --name=centos_6_5_ppa_repo --mirror-locally=Y --arch=x86_64
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add centos_6_5_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "centos_6_5_ppa_repo is added"
|
||||
fi
|
||||
else
|
||||
echo "repo centos_6_5_ppa_repo has already existed."
|
||||
fi
|
||||
|
||||
# download packages
|
||||
cd /var/lib/cobbler/repo_mirror/centos_6_5_ppa_repo/
|
||||
centos_6_5_ppa_repo_packages="
|
||||
ntp-4.2.6p5-1.el6.centos.x86_64.rpm
|
||||
openssh-clients-5.3p1-94.el6.x86_64.rpm
|
||||
iproute-2.6.32-31.el6.x86_64.rpm
|
||||
wget-1.12-1.8.el6.x86_64.rpm
|
||||
ntpdate-4.2.6p5-1.el6.centos.x86_64.rpm
|
||||
yum-plugin-priorities-1.1.30-14.el6.noarch.rpm
|
||||
parted-2.1-21.el6.x86_64.rpm"
|
||||
for f in $centos_6_5_ppa_repo_packages; do
|
||||
download -u $PPA_REPO_URL/centos/6.5/os/x86_64/Packages/$f $f copy /var/lib/cobbler/repo_mirror/centos_6_5_ppa_repo/ || exit $?
|
||||
done
|
||||
|
||||
centos_6_5_ppa_repo_rsyslog_packages="
|
||||
json-c-0.10-2.el6.x86_64.rpm
|
||||
libestr-0.1.9-1.el6.x86_64.rpm
|
||||
libgt-0.3.11-1.el6.x86_64.rpm
|
||||
liblogging-1.0.4-1.el6.x86_64.rpm
|
||||
rsyslog-mmjsonparse-7.6.3-1.el6.x86_64.rpm
|
||||
rsyslog-7.6.3-1.el6.x86_64.rpm"
|
||||
|
||||
for f in $centos_6_5_ppa_repo_rsyslog_packages; do
|
||||
download -u http://rpms.adiscon.com/v7-stable/epel-6/x86_64/RPMS/$f $f copy /var/lib/cobbler/repo_mirror/centos_6_5_ppa_repo/ || exit $?
|
||||
done
|
||||
|
||||
# download chef client for centos ppa repo
|
||||
download -u $CENTOS_6_5_CHEF_CLIENT -u $CENTOS_6_5_CHEF_CLIENT_HUAWEI `basename $CENTOS_6_5_CHEF_CLIENT` copy /var/lib/cobbler/repo_mirror/centos_6_5_ppa_repo/
|
||||
|
||||
# create centos repo
|
||||
cd ..
|
||||
sudo createrepo centos_6_5_ppa_repo
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add centos_ppa_repo"
|
||||
echo "failed to createrepo centos_6_5_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "centos_ppa_repo is added"
|
||||
echo "centos_6_5_ppa_repo is created"
|
||||
fi
|
||||
else
|
||||
echo "repo centos_ppa_repo has already existed."
|
||||
fi
|
||||
|
||||
# download packages
|
||||
cd /var/lib/cobbler/repo_mirror/centos_ppa_repo/
|
||||
PPA_REPO_URL=`fastesturl http://mirrors.hustunique.com http://mirror.centos.org`
|
||||
centos_ppa_repo_packages="
|
||||
ntp-4.2.6p5-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_TYPE,,}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
openssh-clients-5.3p1-94.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
openssh-5.3p1-94.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
iproute-2.6.32-31.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
wget-1.12-1.8.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
ntpdate-4.2.6p5-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_TYPE,,}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
yum-plugin-priorities-1.1.30-14.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.noarch.rpm
|
||||
parted-2.1-21.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"
|
||||
if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then
|
||||
sudo rm -rf /var/lib/cobbler/repo_mirror/centos_6_6_ppa_repo
|
||||
sudo mkdir -p /var/lib/cobbler/repo_mirror/centos_6_6_ppa_repo
|
||||
found_centos_6_6_ppa_repo=0
|
||||
for repo in $(cobbler repo list); do
|
||||
if [ "$repo" == "centos_6_6_ppa_repo" ]; then
|
||||
found_centos_6_6_ppa_repo=1
|
||||
fi
|
||||
done
|
||||
|
||||
for f in $centos_ppa_repo_packages; do
|
||||
download $PPA_REPO_URL/${CENTOS_IMAGE_TYPE,,}/${CENTOS_IMAGE_VERSION}/os/${CENTOS_IMAGE_ARCH}/Packages/$f $f copy /var/lib/cobbler/repo_mirror/centos_ppa_repo/ || exit $?
|
||||
done
|
||||
if [ "$found_centos_6_6_ppa_repo" == "0" ]; then
|
||||
sudo cobbler repo add --mirror=/var/lib/cobbler/repo_mirror/centos_6_6_ppa_repo --name=centos_6_6_ppa_repo --mirror-locally=Y --arch=x86_64
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add centos_6_6_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "centos_6_6_ppa_repo is added"
|
||||
fi
|
||||
else
|
||||
echo "repo centos_6_6_ppa_repo has already existed."
|
||||
fi
|
||||
|
||||
centos_ppa_repo_rsyslog_packages="
|
||||
json-c-0.10-2.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
libestr-0.1.9-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
libgt-0.3.11-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
liblogging-1.0.4-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
rsyslog-7.6.3-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"
|
||||
for f in $centos_ppa_repo_rsyslog_packages; do
|
||||
download http://rpms.adiscon.com/v7-stable/epel-${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/RPMS/$f $f copy /var/lib/cobbler/repo_mirror/centos_ppa_repo/ || exit $?
|
||||
done
|
||||
# download packages
|
||||
cd /var/lib/cobbler/repo_mirror/centos_6_6_ppa_repo/
|
||||
centos_6_6_ppa_repo_packages="
|
||||
ntp-4.2.6p5-1.el6.centos.x86_64.rpm
|
||||
openssh-5.3p1-104.el6.x86_64.rpm
|
||||
openssh-clients-5.3p1-104.el6.x86_64.rpm
|
||||
iproute-2.6.32-32.el6_5.x86_64.rpm
|
||||
wget-1.12-5.el6.x86_64.rpm
|
||||
ntpdate-4.2.6p5-1.el6.centos.x86_64.rpm
|
||||
yum-plugin-priorities-1.1.30-30.el6.noarch.rpm
|
||||
parted-2.1-25.el6.x86_64.rpm"
|
||||
for f in $centos_6_6_ppa_repo_packages; do
|
||||
download -u $PPA_REPO_URL/centos/6.6/os/x86_64/Packages/$f $f copy /var/lib/cobbler/repo_mirror/centos_6_6_ppa_repo/ || exit $?
|
||||
done
|
||||
|
||||
# download chef client for centos ppa repo
|
||||
CENTOS_CHEF_CLIENT_SOURCE=`fastesturl "$CENTOS_CHEF_CLIENT" "$CENTOS_CHEF_CLIENT_HUAWEI"`
|
||||
download $CENTOS_CHEF_CLIENT_SOURCE `basename $CENTOS_CHEF_CLIENT_SOURCE` copy /var/lib/cobbler/repo_mirror/centos_ppa_repo/
|
||||
centos_6_6_ppa_repo_rsyslog_packages="
|
||||
json-c-0.10-2.el6.x86_64.rpm
|
||||
libestr-0.1.9-1.el6.x86_64.rpm
|
||||
libgt-0.3.11-1.el6.x86_64.rpm
|
||||
liblogging-1.0.4-1.el6.x86_64.rpm
|
||||
rsyslog-mmjsonparse-7.6.3-1.el6.x86_64.rpm
|
||||
rsyslog-7.6.3-1.el6.x86_64.rpm"
|
||||
|
||||
# create centos repo
|
||||
cd ..
|
||||
sudo createrepo centos_ppa_repo
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to createrepo centos_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "centos_ppa_repo is created"
|
||||
for f in $centos_6_6_ppa_repo_rsyslog_packages; do
|
||||
download -u http://rpms.adiscon.com/v7-stable/epel-6/x86_64/RPMS/$f $f copy /var/lib/cobbler/repo_mirror/centos_6_6_ppa_repo/ || exit $?
|
||||
done
|
||||
|
||||
download -u $CENTOS_6_6_CHEF_CLIENT -u $CENTOS_6_6_CHEF_CLIENT_HUAWEI $CENTOS_6_6_CHEF_CLIENT_SOURCE `basename $CENTOS_6_6_CHEF_CLIENT` copy /var/lib/cobbler/repo_mirror/centos_6_6_ppa_repo/
|
||||
|
||||
cd ..
|
||||
sudo createrepo centos_6_6_ppa_repo
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to createrepo centos_6_6_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "centos_6_6_ppa_repo is created"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then
|
||||
sudo rm -rf /var/lib/cobbler/repo_mirror/centos_7_0_ppa_repo
|
||||
sudo mkdir -p /var/lib/cobbler/repo_mirror/centos_7_0_ppa_repo
|
||||
found_centos_7_0_ppa_repo=0
|
||||
for repo in $(cobbler repo list); do
|
||||
if [ "$repo" == "centos_7_0_ppa_repo" ]; then
|
||||
found_centos_7_0_ppa_repo=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$found_centos_7_0_ppa_repo" == "0" ]; then
|
||||
sudo cobbler repo add --mirror=/var/lib/cobbler/repo_mirror/centos_7_0_ppa_repo --name=centos_7_0_ppa_repo --mirror-locally=Y --arch=x86_64
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add centos_7_0_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "centos_7_0_ppa_repo is added"
|
||||
fi
|
||||
else
|
||||
echo "repo centos_7_0_ppa_repo has already existed."
|
||||
fi
|
||||
|
||||
# download packages
|
||||
cd /var/lib/cobbler/repo_mirror/centos_7_0_ppa_repo/
|
||||
centos_7_0_ppa_repo_packages="
|
||||
ntp-4.2.6p5-18.el7.centos.x86_64.rpm
|
||||
openssh-6.4p1-8.el7.x86_64.rpm
|
||||
openssh-clients-6.4p1-8.el7.x86_64.rpm
|
||||
iproute-3.10.0-13.el7.x86_64.rpm
|
||||
wget-1.14-10.el7.x86_64.rpm
|
||||
ntpdate-4.2.6p5-18.el7.centos.x86_64.rpm
|
||||
yum-plugin-priorities-1.1.31-24.el7.noarch.rpm
|
||||
json-c-0.11-3.el7.x86_64.rpm
|
||||
parted-3.1-17.el7.x86_64.rpm
|
||||
autogen-5.18-5.el7.x86_64.rpm
|
||||
autogen-libopts-5.18-5.el7.x86_64.rpm
|
||||
net-tools-2.0-0.17.20131004git.el7.x86_64.rpm"
|
||||
for f in $centos_7_0_ppa_repo_packages; do
|
||||
download -u $PPA_REPO_URL/centos/7.0.1406/os/x86_64/Packages/$f $f copy /var/lib/cobbler/repo_mirror/centos_7_0_ppa_repo/ || exit $?
|
||||
done
|
||||
|
||||
centos_7_0_ppa_repo_rsyslog_packages="
|
||||
libestr-0.1.9-1.el7.x86_64.rpm
|
||||
libgt-0.3.11-1.el7.x86_64.rpm
|
||||
liblogging-1.0.4-1.el7.x86_64.rpm
|
||||
rsyslog-mmjsonparse-7.6.3-1.el7.x86_64.rpm
|
||||
rsyslog-7.6.3-1.el7.x86_64.rpm"
|
||||
|
||||
for f in $centos_7_0_ppa_repo_rsyslog_packages; do
|
||||
download -u http://rpms.adiscon.com/v7-stable/epel-7/x86_64/RPMS/$f $f copy /var/lib/cobbler/repo_mirror/centos_7_0_ppa_repo/ || exit $?
|
||||
done
|
||||
|
||||
# download chef client for centos ppa repo
|
||||
CENTOS_7_0_CHEF_CLIENT_SOURCE=`fastesturl "$CENTOS_7_0_CHEF_CLIENT" "$CENTOS_7_0_CHEF_CLIENT_HUAWEI"`
|
||||
download -u $CENTOS_7_0_CHEF_CLIENT -u $CENTOS_7_0_CHEF_CLIENT_HUAWEI `basename $CENTOS_7_0_CHEF_CLIENT` copy /var/lib/cobbler/repo_mirror/centos_7_0_ppa_repo/
|
||||
|
||||
# create centos repo
|
||||
cd ..
|
||||
sudo createrepo centos_7_0_ppa_repo
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to createrepo centos_7_0_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "centos_7_0_ppa_repo is created"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# create ubuntu repo
|
||||
sudo rm -rf /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo
|
||||
sudo mkdir -p /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo
|
||||
found_ubuntu_ppa_repo=0
|
||||
for repo in $(cobbler repo list); do
|
||||
if [ "$repo" == "ubuntu_ppa_repo" ]; then
|
||||
found_ubuntu_ppa_repo=1
|
||||
fi
|
||||
done
|
||||
if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then
|
||||
sudo rm -rf /var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo
|
||||
sudo mkdir -p /var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo
|
||||
found_ubuntu_12_04_ppa_repo=0
|
||||
for repo in $(cobbler repo list); do
|
||||
if [ "$repo" == "ubuntu_12_04_ppa_repo" ]; then
|
||||
found_ubuntu_12_04_ppa_repo=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$found_ubuntu_ppa_repo" == "0" ]; then
|
||||
sudo cobbler repo add --mirror=/var/lib/cobbler/repo_mirror/ubuntu_ppa_repo --name=ubuntu_ppa_repo --mirror-locally=Y --arch=${UBUNTU_IMAGE_ARCH} --apt-dists=ppa --apt-components=main
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add ubuntu_ppa_repo"
|
||||
exit 1
|
||||
if [ "$found_ubuntu_12_04_ppa_repo" == "0" ]; then
|
||||
sudo cobbler repo add --mirror=/var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo --name=ubuntu_12_04_ppa_repo --mirror-locally=Y --arch=x86_64 --apt-dists=ppa --apt-components=main
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add ubuntu_12_04_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "ubuntu_12_04_ppa_repo is added"
|
||||
fi
|
||||
else
|
||||
echo "ubuntu_ppa_repo is added"
|
||||
echo "repo ubuntu_12_04_ppa_repo has already existed."
|
||||
fi
|
||||
else
|
||||
echo "repo ubuntu_ppa_repo has already existed."
|
||||
fi
|
||||
|
||||
cd /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo/
|
||||
if [ ! -e /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo/conf/distributions ]; then
|
||||
echo "create ubuntu ppa repo distribution"
|
||||
mkdir -p /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo/conf
|
||||
cat << EOF > /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo/conf/distributions
|
||||
cd /var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo/
|
||||
if [ ! -e /var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo/conf/distributions ]; then
|
||||
echo "create ubuntu 12.04 ppa repo distribution"
|
||||
mkdir -p /var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo/conf
|
||||
cat << EOF > /var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo/conf/distributions
|
||||
Origin: ppa
|
||||
Label: ppa_repo
|
||||
Suite: stable
|
||||
@ -314,22 +445,76 @@ Architectures: i386 amd64 source
|
||||
Components: main
|
||||
Description: ppa repo
|
||||
EOF
|
||||
chmod 644 /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo/conf/distributions
|
||||
else
|
||||
echo "ubuntu ppa repo distribution file exists."
|
||||
chmod 644 /var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo/conf/distributions
|
||||
else
|
||||
echo "ubuntu 12.04 ppa repo distribution file exists."
|
||||
fi
|
||||
|
||||
# download chef client for ubuntu ppa repo
|
||||
download -u $UBUNTU_12_04_CHEF_CLIENT -u $UBUNTU_12_04_CHEF_CLIENT_HUAWEI `basename $UBUNTU_12_04_CHEF_CLIENT` copy /var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo/ || exit $?
|
||||
|
||||
cd ..
|
||||
find ubuntu_12_04_ppa_repo -name \*.deb -exec reprepro -Vb ubuntu_12_04_ppa_repo includedeb ppa {} \;
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "failed to create ubuntu_12_04_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "ubuntu_12_04_ppa_repo is created"
|
||||
fi
|
||||
fi
|
||||
|
||||
# download chef client for ubuntu ppa repo
|
||||
UBUNTU_CHEF_CLIENT_SOURCE=`fastesturl "$UBUNTU_CHEF_CLIENT" "$UBUNTU_CHEF_CLIENT_HUAWEI"`
|
||||
download $UBUNTU_CHEF_CLIENT_SOURCE `basename $UBUNTU_CHEF_CLIENT` copy /var/lib/cobbler/repo_mirror/ubuntu_ppa_repo/ || exit $?
|
||||
if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then
|
||||
sudo rm -rf /var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo
|
||||
sudo mkdir -p /var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo
|
||||
found_ubuntu_14_04_ppa_repo=0
|
||||
for repo in $(cobbler repo list); do
|
||||
if [ "$repo" == "ubuntu_14_04_ppa_repo" ]; then
|
||||
found_ubuntu_14_04_ppa_repo=1
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
find ubuntu_ppa_repo -name \*.deb -exec reprepro -Vb ubuntu_ppa_repo includedeb ppa {} \;
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "failed to create ubuntu_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "ubuntu_ppa_repo is created"
|
||||
if [ "$found_ubuntu_14_04_ppa_repo" == "0" ]; then
|
||||
sudo cobbler repo add --mirror=/var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo --name=ubuntu_14_04_ppa_repo --mirror-locally=Y --arch=x86_64 --apt-dists=ppa --apt-components=main
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add ubuntu_14_04_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "ubuntu_14_04_ppa_repo is added"
|
||||
fi
|
||||
else
|
||||
echo "repo ubuntu_14_04_ppa_repo has already existed."
|
||||
fi
|
||||
|
||||
cd /var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo/
|
||||
if [ ! -e /var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo/conf/distributions ]; then
|
||||
echo "create ubuntu 14.04 ppa repo distribution"
|
||||
mkdir -p /var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo/conf
|
||||
cat << EOF > /var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo/conf/distributions
|
||||
Origin: ppa
|
||||
Label: ppa_repo
|
||||
Suite: stable
|
||||
Codename: ppa
|
||||
Version: 0.1
|
||||
Architectures: i386 amd64 source
|
||||
Components: main
|
||||
Description: ppa repo
|
||||
EOF
|
||||
chmod 644 /var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo/conf/distributions
|
||||
else
|
||||
echo "ubuntu 14.04 ppa repo distribution file exists."
|
||||
fi
|
||||
|
||||
# download chef client for ubuntu ppa repo
|
||||
download -u $UBUNTU_14_04_CHEF_CLIENT -u $UBUNTU_14_04_CHEF_CLIENT_HUAWEI `basename $UBUNTU_14_04_CHEF_CLIENT` copy /var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo/ || exit $?
|
||||
|
||||
cd ..
|
||||
find ubuntu_14_04_ppa_repo -name \*.deb -exec reprepro -Vb ubuntu_14_04_ppa_repo includedeb ppa {} \;
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "failed to create ubuntu_14_04_ppa_repo"
|
||||
exit 1
|
||||
else
|
||||
echo "ubuntu_14_04_ppa_repo is created"
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo cobbler reposync
|
||||
@ -342,144 +527,360 @@ fi
|
||||
|
||||
# import cobbler distro
|
||||
sudo mkdir -p /var/lib/cobbler/iso
|
||||
CENTOS_SOURCE=`fastesturl $CENTOS_IMAGE_SOURCE_ASIA $CENTOS_IMAGE_SOURCE`
|
||||
download "$CENTOS_SOURCE" ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}.iso copy /var/lib/cobbler/iso/ || exit $?
|
||||
sudo mkdir -p /mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}
|
||||
if [ $(mount | grep -c "/mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} ") -eq 0 ]; then
|
||||
sudo mount -o loop /var/lib/cobbler/iso/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}.iso /mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to mount image /mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}"
|
||||
exit 1
|
||||
if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then
|
||||
download -u $CENTOS_6_5_IMAGE_SOURCE_ASIA -u $CENTOS_6_5_IMAGE_SOURCE CentOS-6.5-x86_64.iso copy /var/lib/cobbler/iso/ || exit $?
|
||||
sudo mkdir -p /mnt/CentOS-6.5-x86_64
|
||||
if [ $(mount | grep -c "/mnt/CentOS-6.5-x86_64") -eq 0 ]; then
|
||||
sudo mount -o loop /var/lib/cobbler/iso/CentOS-6.5-x86_64.iso /mnt/CentOS-6.5-x86_64
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to mount image /mnt/CentOS-6.5-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/CentOS-6.5-x86_64 is mounted"
|
||||
fi
|
||||
else
|
||||
echo "/mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} is mounted"
|
||||
echo "/mnt/CentOS-6.5-x86_64 has already mounted"
|
||||
fi
|
||||
else
|
||||
echo "/mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} has already mounted"
|
||||
fi
|
||||
|
||||
UBUNTU_SOURCE=`fastesturl $UBUNTU_IMAGE_SOURCE_ASIA $UBUNTU_IMAGE_SOURCE`
|
||||
download "$UBUNTU_SOURCE" ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}.iso copy /var/lib/cobbler/iso/ || exit $?
|
||||
sudo mkdir -p /mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}
|
||||
if [ $(mount | grep -c "/mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} ") -eq 0 ]; then
|
||||
sudo mount -o loop /var/lib/cobbler/iso/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}.iso /mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to mount image /mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}"
|
||||
exit 1
|
||||
if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then
|
||||
download -u $CENTOS_6_6_IMAGE_SOURCE_ASIA -u $CENTOS_6_6_IMAGE_SOURCE CentOS-6.6-x86_64.iso copy /var/lib/cobbler/iso/ || exit $?
|
||||
sudo mkdir -p /mnt/CentOS-6.6-x86_64
|
||||
if [ $(mount | grep -c "/mnt/CentOS-6.6-x86_64") -eq 0 ]; then
|
||||
sudo mount -o loop /var/lib/cobbler/iso/CentOS-6.6-x86_64.iso /mnt/CentOS-6.6-x86_64
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to mount image /mnt/CentOS-6.6-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/CentOS-6.6-x86_64 is mounted"
|
||||
fi
|
||||
else
|
||||
echo "/mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} is mounted"
|
||||
echo "/mnt/CentOS-6.6-x86_64 has already mounted"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then
|
||||
download -u $CENTOS_7_0_IMAGE_SOURCE_ASIA -u $CENTOS_7_0_IMAGE_SOURCE CentOS-7.0-x86_64.iso copy /var/lib/cobbler/iso/ || exit $?
|
||||
sudo mkdir -p /mnt/CentOS-7.0-x86_64
|
||||
if [ $(mount | grep -c "/mnt/CentOS-7.0-x86_64") -eq 0 ]; then
|
||||
sudo mount -o loop /var/lib/cobbler/iso/CentOS-7.0-x86_64.iso /mnt/CentOS-7.0-x86_64
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to mount image /mnt/CentOS-7.0-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/CentOS-7.0-x86_64 is mounted"
|
||||
fi
|
||||
else
|
||||
echo "/mnt/CentOS-7.0-x86_64 has already mounted"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then
|
||||
download -u $UBUNTU_12_04_IMAGE_SOURCE_ASIA -u $UBUNTU_12_04_IMAGE_SOURCE Ubuntu-12.04-x86_64.iso copy /var/lib/cobbler/iso/ || exit $?
|
||||
sudo mkdir -p /mnt/Ubuntu-12.04-x86_64
|
||||
if [ $(mount | grep -c "/mnt/Ubuntu-12.04-x86_64") -eq 0 ]; then
|
||||
sudo mount -o loop /var/lib/cobbler/iso/Ubuntu-12.04-x86_64.iso /mnt/Ubuntu-12.04-x86_64
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to mount image /mnt/Ubuntu-12.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/Ubuntu-12.04-x86_64 is mounted"
|
||||
fi
|
||||
else
|
||||
echo "/mnt/Ubuntu-12.04-x86_64 has already mounted"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then
|
||||
download -u $UBUNTU_14_04_IMAGE_SOURCE_ASIA -u $UBUNTU_14_04_IMAGE_SOURCE Ubuntu-14.04-x86_64.iso copy /var/lib/cobbler/iso/ || exit $?
|
||||
sudo mkdir -p /mnt/Ubuntu-14.04-x86_64
|
||||
if [ $(mount | grep -c "/mnt/Ubuntu-14.04-x86_64") -eq 0 ]; then
|
||||
sudo mount -o loop /var/lib/cobbler/iso/Ubuntu-14.04-x86_64.iso /mnt/Ubuntu-14.04-x86_64
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to mount image /mnt/Ubuntu-12.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/Ubuntu-14.04-x86_64 is mounted"
|
||||
fi
|
||||
else
|
||||
echo "/mnt/Ubuntu-14.04-x86_64 has already mounted"
|
||||
fi
|
||||
else
|
||||
echo "/mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} has already mounted"
|
||||
fi
|
||||
|
||||
# add distro
|
||||
found_centos_distro=0
|
||||
for distro in $(cobbler distro list); do
|
||||
if [ "$distro" == "${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}" ]; then
|
||||
found_centos_distro=1
|
||||
fi
|
||||
done
|
||||
if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then
|
||||
found_centos_6_5_distro=0
|
||||
for distro in $(cobbler distro list); do
|
||||
if [ "$distro" == "CentOS-6.5-x86_64" ]; then
|
||||
found_centos_6_5_distro=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$found_centos_distro" == "0" ]; then
|
||||
sudo cobbler import --path=/mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} --name=${CENTOS_IMAGE_NAME} --arch=${CENTOS_IMAGE_ARCH} --kickstart=/var/lib/cobbler/kickstarts/default.ks --breed=redhat
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to import /mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}"
|
||||
exit 1
|
||||
if [ "$found_centos_6_5_distro" == "0" ]; then
|
||||
sudo cobbler import --path=/mnt/CentOS-6.5-x86_64 --name=CentOS-6.5 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.ks --breed=redhat
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to import /mnt/CentOS-6.5-x_86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/CentOS-6.5-x86_64 is imported"
|
||||
fi
|
||||
else
|
||||
echo "/mnt/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} is imported"
|
||||
echo "distro CentOS-6.5-x86_64 has already existed"
|
||||
sudo cobbler distro edit --name=CentOS-6.5-x86_64 --arch=x86_64 --breed=redhat
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit distro CentOS-6.5-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "distro CentOS-6.5-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "distro ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} has already existed"
|
||||
sudo cobbler distro edit --name=${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} --arch=${CENTOS_IMAGE_ARCH} --breed=redhat
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit distro ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}"
|
||||
exit 1
|
||||
|
||||
centos_6_5_found_profile=0
|
||||
for profile in $(cobbler profile list); do
|
||||
if [ "$profile" == "CentOS-6.5-x86_64" ]; then
|
||||
centos_6_5_found_profile=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$centos_6_5_found_profile" == "0" ]; then
|
||||
sudo cobbler profile add --name="CentOS-6.5-x86_64" --repo=centos_6_5_ppa_repo --distro=CentOS-6.5-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/CentOS-6.5-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.ks
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add profile CentOS-6.5-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile CentOS-6.5-x86_64 is added"
|
||||
fi
|
||||
else
|
||||
echo "distro ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} is updated"
|
||||
echo "profile CentOS-6.5-x86_64 has already existed."
|
||||
sudo cobbler profile edit --name=CentOS-6.5-x86_64 --repo=centos_6_5_ppa_repo --distro=CentOS-6.5-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/CentOS-6.5-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.ks
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit profile CentOS-6.5-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile CentOS-6.5-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
found_ubuntu_distro=0
|
||||
for distro in $(cobbler distro list); do
|
||||
if [ "$distro" == "${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}" ]; then
|
||||
found_ubuntu_distro=1
|
||||
fi
|
||||
done
|
||||
if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then
|
||||
found_centos_6_6_distro=0
|
||||
for distro in $(cobbler distro list); do
|
||||
if [ "$distro" == "CentOS-6.6-x86_64" ]; then
|
||||
found_centos_6_6_distro=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$found_ubuntu_distro" == "0" ]; then
|
||||
sudo cobbler import --path=/mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} --name=${UBUNTU_IMAGE_NAME} --arch=${UBUNTU_IMAGE_ARCH} --kickstart=/var/lib/cobbler/kickstarts/default.seed --breed=ubuntu
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to import /mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}"
|
||||
exit 1
|
||||
if [ "$found_centos_6_6_distro" == "0" ]; then
|
||||
sudo cobbler import --path=/mnt/CentOS-6.6-x86_64 --name=CentOS-6.6 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.ks --breed=redhat
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to import /mnt/CentOS-6.6-x_86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/CentOS-6.6-x86_64 is imported"
|
||||
fi
|
||||
else
|
||||
echo "/mnt/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} is imported"
|
||||
echo "distro CentOS-6.6-x86_64 has already existed"
|
||||
sudo cobbler distro edit --name=CentOS-6.6-x86_64 --arch=x86_64 --breed=redhat
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit distro CentOS-6.6-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "distro CentOS-6.6-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "distro ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} has already existed"
|
||||
sudo cobbler distro edit --name=${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} --arch=${UBUNTU_IMAGE_ARCH} --breed=ubuntu
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit distro ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}"
|
||||
exit 1
|
||||
|
||||
centos_6_6_found_profile=0
|
||||
for profile in $(cobbler profile list); do
|
||||
if [ "$profile" == "CentOS-6.6-x86_64" ]; then
|
||||
centos_6_6_found_profile=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$centos_6_6_found_profile" == "0" ]; then
|
||||
sudo cobbler profile add --name="CentOS-6.6-x86_64" --repo=centos_6_6_ppa_repo --distro=CentOS-6.6-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/CentOS-6.6-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.ks
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add profile CentOS-6.6-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile CentOS-6.6-x86_64 is added"
|
||||
fi
|
||||
else
|
||||
echo "distro ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} is updated"
|
||||
echo "profile CentOS-6.6-x86_64 has already existed."
|
||||
sudo cobbler profile edit --name=CentOS-6.6-x86_64 --repo=centos_6_6_ppa_repo --distro=CentOS-6.6-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/CentOS-6.6-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.ks
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit profile CentOS-6.6-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile CentOS-6.6-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# add profile
|
||||
centos_found_profile=0
|
||||
for profile in $(cobbler profile list); do
|
||||
if [ "$profile" == "${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}" ]; then
|
||||
centos_found_profile=1
|
||||
fi
|
||||
done
|
||||
if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then
|
||||
found_centos_7_0_distro=0
|
||||
for distro in $(cobbler distro list); do
|
||||
if [ "$distro" == "CentOS-7.0-x86_64" ]; then
|
||||
found_centos_7_0_distro=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$centos_found_profile" == "0" ]; then
|
||||
sudo cobbler profile add --name="${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}" --repo=centos_ppa_repo --distro="${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}" --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}" --kickstart=/var/lib/cobbler/kickstarts/default.ks
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add profile ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}"
|
||||
exit 1
|
||||
if [ "$found_centos_7_0_distro" == "0" ]; then
|
||||
sudo cobbler import --path=/mnt/CentOS-7.0-x86_64 --name=CentOS-7.0 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.ks --breed=redhat
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to import /mnt/CentOS-7.0-x_86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/CentOS-7.0-x86_64 is imported"
|
||||
fi
|
||||
else
|
||||
echo "profile ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} is added"
|
||||
echo "distro CentOS-7.0-x86_64 has already existed"
|
||||
sudo cobbler distro edit --name=CentOS-7.0-x86_64 --arch=x86_64 --breed=redhat
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit distro CentOS-7.0-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "distro CentOS-7.0-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "profile ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} has already existed."
|
||||
sudo cobbler profile edit --name="${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}" --repo=centos_ppa_repo --distro="${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}" --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}" --kickstart=/var/lib/cobbler/kickstarts/default.ks
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit profile ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}"
|
||||
exit 1
|
||||
|
||||
centos_7_0_found_profile=0
|
||||
for profile in $(cobbler profile list); do
|
||||
if [ "$profile" == "CentOS-7.0-x86_64" ]; then
|
||||
centos_7_0_found_profile=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$centos_7_0_found_profile" == "0" ]; then
|
||||
sudo cobbler profile add --name="CentOS-7.0-x86_64" --repo=centos_7_0_ppa_repo --distro=CentOS-7.0-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/CentOS-7.0-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.ks
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add profile CentOS-7.0-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile CentOS-7.0-x86_64 is added"
|
||||
fi
|
||||
else
|
||||
echo "profile ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH} is updated"
|
||||
echo "profile CentOS-7.0-x86_64 has already existed."
|
||||
sudo cobbler profile edit --name=CentOS-7.0-x86_64 --repo=centos_7_0_ppa_repo --distro=CentOS-7.0-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/CentOS-7.0-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.ks
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit profile CentOS-7.0-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile CentOS-7.0-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
ubuntu_found_profile=0
|
||||
for profile in $(cobbler profile list); do
|
||||
if [ "$profile" == "${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}" ]; then
|
||||
ubuntu_found_profile=1
|
||||
fi
|
||||
done
|
||||
if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then
|
||||
found_ubuntu_12_04_distro=0
|
||||
for distro in $(cobbler distro list); do
|
||||
if [ "$distro" == "Ubuntu-12.04-x86_64" ]; then
|
||||
found_ubuntu_12_04_distro=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$ubuntu_found_profile" == "0" ]; then
|
||||
sudo cobbler profile add --name="${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}" --repo=ubuntu_ppa_repo --distro="${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}" --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}" --kickstart=/var/lib/cobbler/kickstarts/default.seed --kopts="netcfg/choose_interface=auto"
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add profile ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}"
|
||||
exit 1
|
||||
if [ "$found_ubuntu_12_04_distro" == "0" ]; then
|
||||
sudo cobbler import --path=/mnt/Ubuntu-12.04-x86_64 --name=Ubuntu-12.04 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.seed --breed=ubuntu
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to import /mnt/Ubuntu-12.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/Ubuntu-12.04-x86_64 is imported"
|
||||
fi
|
||||
else
|
||||
echo "profile ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} is added"
|
||||
echo "distro Ubuntu-12.04-x86_64 has already existed"
|
||||
sudo cobbler distro edit --name=Ubuntu-12.04-x86_64 --arch=x86_64 --breed=ubuntu
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit distro Ubuntu-12.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "distro Ubuntu-12.04-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "profile ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} has already existed."
|
||||
sudo cobbler profile edit --name="${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}" --repo=ubuntu_ppa_repo --distro="${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}" --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}" --kickstart=/var/lib/cobbler/kickstarts/default.seed --kopts="netcfg/choose_interface=auto"
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit profile ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}"
|
||||
exit 1
|
||||
|
||||
ubuntu_12_04_found_profile=0
|
||||
for profile in $(cobbler profile list); do
|
||||
if [ "$profile" == "Ubuntu-12.04-x86_64" ]; then
|
||||
ubuntu_12_04_found_profile=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$ubuntu_12_04_found_profile" == "0" ]; then
|
||||
sudo cobbler profile add --name=Ubuntu-12.04-x86_64 --repo=ubuntu_12_04_ppa_repo --distro=Ubuntu-12.04-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/Ubuntu-12.04-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.seed --kopts="netcfg/choose_interface=auto"
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add profile Ubuntu-12.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile Ubuntu-12.04-x86_64 is added"
|
||||
fi
|
||||
else
|
||||
echo "profile ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH} is updated"
|
||||
echo "profile Ubuntu-12.04-x86_64 has already existed."
|
||||
sudo cobbler profile edit --name=Ubuntu-12.04-x86_64 --repo=ubuntu_12_04_ppa_repo --distro=Ubuntu-12.04-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/Ubuntu-12.04-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.seed --kopts="netcfg/choose_interface=auto"
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit profile Ubuntu-12.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile Ubuntu-12.04-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
sudo cobbler repo remove --name=Ubuntu-12.04-x86_64
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then
|
||||
found_ubuntu_14_04_distro=0
|
||||
for distro in $(cobbler distro list); do
|
||||
if [ "$distro" == "Ubuntu-14.04-x86_64" ]; then
|
||||
found_ubuntu_14_04_distro=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$found_ubuntu_14_04_distro" == "0" ]; then
|
||||
sudo cobbler import --path=/mnt/Ubuntu-14.04-x86_64 --name=Ubuntu-14.04 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.seed --breed=ubuntu
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to import /mnt/Ubuntu-14.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "/mnt/Ubuntu-14.04-x86_64 is imported"
|
||||
fi
|
||||
else
|
||||
echo "distro Ubuntu-14.04-x86_64 has already existed"
|
||||
sudo cobbler distro edit --name=Ubuntu-14.04-x86_64 --arch=x86_64 --breed=ubuntu
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit distro Ubuntu-14.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "distro Ubuntu-14.04-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
|
||||
ubuntu_14_04_found_profile=0
|
||||
for profile in $(cobbler profile list); do
|
||||
if [ "$profile" == "Ubuntu-14.04-x86_64" ]; then
|
||||
ubuntu_14_04_found_profile=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$ubuntu_14_04_found_profile" == "0" ]; then
|
||||
sudo cobbler profile add --name=Ubuntu-14.04-x86_64 --repo=ubuntu_14_04_ppa_repo --distro=Ubuntu-14.04-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/Ubuntu-14.04-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.seed --kopts="netcfg/choose_interface=auto"
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to add profile Ubuntu-14.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile Ubuntu-14.04-x86_64 is added"
|
||||
fi
|
||||
else
|
||||
echo "profile Ubuntu-14.04-x86_64 has already existed."
|
||||
sudo cobbler profile edit --name=Ubuntu-14.04-x86_64 --repo=ubuntu_14_04_ppa_repo --distro=Ubuntu-14.04-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/Ubuntu-14.04-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.seed --kopts="netcfg/choose_interface=auto"
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to edit profile Ubuntu-14.04-x86_64"
|
||||
exit 1
|
||||
else
|
||||
echo "profile Ubuntu-14.04-x86_64 is updated"
|
||||
fi
|
||||
fi
|
||||
sudo cobbler repo remove --name=Ubuntu-14.04-x86_64
|
||||
fi
|
||||
|
||||
#clean ubuntu repo
|
||||
sudo cobbler repo remove --name=${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}
|
||||
|
||||
sudo cobbler reposync
|
||||
if [[ "$?" != "0" ]]; then
|
||||
|
@ -38,6 +38,26 @@ sudo ln -s -f /opt/compass/bin/compass_wsgi.py /var/www/compass/compass.wsgi
|
||||
sudo cp -rf $COMPASSDIR/bin/chef/* /opt/compass/bin/
|
||||
sudo cp -rf $COMPASSDIR/bin/cobbler/* /opt/compass/bin/
|
||||
|
||||
if [[ $SUPPORT_CENTOS_6_5 != "y" ]]; then
|
||||
sudo rm -f /etc/compass/os/centos6.5.conf
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_CENTOS_6_6 != "y" ]]; then
|
||||
sudo rm -f /etc/compass/os/centos6.6.conf
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_CENTOS_7_0 != "y" ]]; then
|
||||
sudo rm -f /etc/compass/os/centos7.0.conf
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_UBUNTU_12_04 != "y" ]]; then
|
||||
sudo rm -f /etc/compass/os/ubuntu12.04.conf
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_UBUNTU_14_04 != "y" ]]; then
|
||||
sudo rm -f /etc/compass/os/ubuntu14.04.conf
|
||||
fi
|
||||
|
||||
# add apache user to the group of virtualenv user
|
||||
sudo usermod -a -G `groups $USER|awk '{print$3}'` apache
|
||||
|
||||
@ -94,11 +114,13 @@ sudo rm -rf /var/lib/redis/dump.rdb
|
||||
sudo killall -9 redis-server
|
||||
sudo rm -rf /var/run/redis/redis.pid
|
||||
sudo service redis restart
|
||||
sleep 10
|
||||
echo "Checking if redis is running"
|
||||
sudo service redis status
|
||||
if [[ "$?" == "0" ]]; then
|
||||
echo "redis is running"
|
||||
else
|
||||
ps -ef | grep redis
|
||||
echo "redis is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -22,18 +22,34 @@ sudo cp -rf $WEB_HOME/v2 /var/www/compass_web/
|
||||
if [[ $LOCAL_REPO = "y" ]]; then
|
||||
echo "setting up local repo"
|
||||
mkdir -p /tmp/repo
|
||||
fastesturl $LOCAL_REPO_HUAWEI $LOCAL_REPO_US
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to determine the fastest local repo source"
|
||||
exit 1
|
||||
fi
|
||||
read -r LOCAL_REPO_SOURCE</tmp/url
|
||||
download $LOCAL_REPO_SOURCE local_repo.tar.gz unzip /tmp/repo || exit $?
|
||||
download -u ${LOCAL_REPO_US}/local_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/local_repo.tar.gz local_repo.tar.gz unzip /tmp/repo || exit $?
|
||||
mv -f /tmp/repo/local_repo/* /var/www/compass_web/v2/
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to setup local repo"
|
||||
exit 1
|
||||
fi
|
||||
download -u ${LOCAL_REPO_US}/gem_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/gem_repo.tar.gz gem_repo.tar.gz unzip /var/www/compass_web/v2 || exit $?
|
||||
download -u ${LOCAL_REPO_US}/cirros-0.3.2-x86_64-disk.img -u ${LOCAL_REPO_HUAWEI}/cirros-0.3.2-x86_64-disk.img cirros-0.3.2-x86_64-disk.img copy /var/www/compass_web/v2 || exit $?
|
||||
if [[ $SUPPORT_CENTOS_6_5 = "y" ]]; then
|
||||
mkdir -p /var/www/compass_web/v2/yum.repos.d/centos/6.5
|
||||
download -u ${LOCAL_REPO_US}/centos/6.5/centos_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/centos/6.5/centos_repo.tag.gz CentOS-6.5-x86_64.tar.gz unzip /var/www/compass_web/v2/yum.repos.d/centos/6.5 || exit $?
|
||||
fi
|
||||
if [[ $SUPPORT_CENTOS_6_6 = "y" ]]; then
|
||||
mkdir -p /var/www/compass_web/v2/yum.repos.d/centos/6.6
|
||||
download -u ${LOCAL_REPO_US}/centos/6.6/centos_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/centos/6.6/centos_repo.tag.gz CentOS-6.6-x86_64.tar.gz unzip /var/www/compass_web/v2/yum.repos.d/centos/6.6 || exit $?
|
||||
fi
|
||||
if [[ $SUPPORT_CENTOS_7_0 = "y" ]]; then
|
||||
mkdir -p /var/www/compass_web/v2/yum.repos.d/centos/7.0
|
||||
download -u ${LOCAL_REPO_US}/centos/7.0/centos_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/centos/7.0/centos_repo.tag.gz CentOS-7.0-x86_64.tar.gz unzip /var/www/compass_web/v2/yum.repos.d/centos/7.0 || exit $?
|
||||
fi
|
||||
if [[ $SUPPORT_UBUNTU_12_04 = "y" ]]; then
|
||||
mkdir -p /var/www/compass_web/v2/apt.repos.d/ubuntu/12.04
|
||||
download -u ${LOCAL_REPO_US}/ubuntu/12.04/ubuntu_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/ubuntu/12.04/ubuntu_repo.tar.gz Ubuntu-12.04-x86_64.tar.gz unzip /var/www/compass_web/v2/apt.repos.d/ubuntu/12.04 || exit $?
|
||||
fi
|
||||
if [[ $SUPPORT_UBUNTU_14_04 = "y" ]]; then
|
||||
mkdir -p /var/www/compass_web/v2/apt.repos.d/ubuntu/14.04
|
||||
download -u ${LOCAL_REPO_US}/ubuntu/14.04/ubuntu_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/ubuntu/14.04/ubuntu_repo.tar.gz Ubuntu-14.04-x86_64.tar.gz unzip /var/www/compass_web/v2/apt.repos.d/ubuntu/14.04 || exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo service httpd restart
|
||||
|
@ -32,6 +32,11 @@ export CBLR_PASSWD=${CBLR_PASSWD:-}
|
||||
|
||||
# set default local repo flag
|
||||
export LOCAL_REPO=${LOCAL_REPO:-}
|
||||
export SUPPORT_CENTOS_6_5=${SUPPORT_CENTOS_6_5:-}
|
||||
export SUPPORT_CENTOS_6_6=${SUPPORT_CENTOS_6_6:-}
|
||||
export SUPPORT_CENTOS_7_0=${SUPPORT_CENTOS_7_0:-}
|
||||
export SUPPORT_UBUNTU_12_04=${SUPPORT_UBUNTU_12_04:-}
|
||||
export SUPPORT_UBUNTU_14_04=${SUPPORT_UBUNTU_14_04:-}
|
||||
|
||||
export IMAGE_TYPE=${IMAGE_TYPE:-"CentOS"}
|
||||
export IMAGE_TYPE_OTHER=${IMAGE_TYPE_OTHER:-"el"}
|
||||
@ -41,25 +46,17 @@ export IMAGE_VERSION=${IMAGE_VERSION:-"${IMAGE_VERSION_MAJOR}.${IMAGE_VERSION_MI
|
||||
export IMAGE_NAME=${IMAGE_NAME:-"${IMAGE_TYPE}-${IMAGE_VERSION}"}
|
||||
export IMAGE_ARCH=${IMAGE_ARCH:-"x86_64"}
|
||||
|
||||
export CENTOS_IMAGE_TYPE=${CENTOS_IMAGE_TYPE:-"CentOS"}
|
||||
export CENTOS_IMAGE_TYPE_OTHER=${CENTOS_IMAGE_TYPE_OTHER:-"el"}
|
||||
export CENTOS_IMAGE_VERSION_MAJOR=${CENTOS_IMAGE_VERSION_MAJOR:-"6"}
|
||||
export CENTOS_IMAGE_VERSION_MINOR=${CENTOS_IMAGE_VERSION_MINOR:-"5"}
|
||||
export CENTOS_IMAGE_VERSION=${CENTOS_IMAGE_VERSION:-"${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_VERSION_MINOR}"}
|
||||
export CENTOS_IMAGE_NAME=${CENTOS_IMAGE_NAME:-"${CENTOS_IMAGE_TYPE}-${CENTOS_IMAGE_VERSION}"}
|
||||
export CENTOS_IMAGE_ARCH=${CENTOS_IMAGE_ARCH:-"x86_64"}
|
||||
export CENTOS_IMAGE_SOURCE=${CENTOS_IMAGE_SOURCE:-"http://mirror.rackspace.com/${CENTOS_IMAGE_TYPE,,}/${CENTOS_IMAGE_VERSION}/isos/${CENTOS_IMAGE_ARCH}/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}-minimal.iso"}
|
||||
export CENTOS_IMAGE_SOURCE_ASIA=${CENTOS_IMAGE_SOURCE_ASIA:-"http://mirrors.hustunique.com/${CENTOS_IMAGE_TYPE,,}/${CENTOS_IMAGE_VERSION}/isos/${CENTOS_IMAGE_ARCH}/${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}-minimal.iso"}
|
||||
export UBUNTU_IMAGE_TYPE=${UBUNTU_IMAGE_TYPE:-"Ubuntu"}
|
||||
export UBUNTU_IMAGE_VERSION_MAJOR=${UBUNTU_IMAGE_VERSION_MAJOR:-"12"}
|
||||
export UBUNTU_IMAGE_VERSION_MINOR=${UBUNTU_IMAGE_VERSION_MINOR:-"04"}
|
||||
export UBUNTU_IMAGE_PATCH_VERSION=${UBUNTU_IMAGE_PATCH_VERSION:=".4"}
|
||||
export UBUNTU_IMAGE_VERSION=${UBUNTU_IMAGE_VERSION:-"${UBUNTU_IMAGE_VERSION_MAJOR}.${UBUNTU_IMAGE_VERSION_MINOR}"}
|
||||
export UBUNTU_IMAGE_NAME=${UBUNTU_IMAGE_NAME:-"${UBUNTU_IMAGE_TYPE}-${UBUNTU_IMAGE_VERSION}"}
|
||||
export UBUNTU_IMAGE_ARCH=${UBUNTU_IMAGE_ARCH:-"x86_64"}
|
||||
export UBUNTU_IMAGE_ARCH_OTHER=${UBUNTU_IMAGE_ARCH_OTHER:-"amd64"}
|
||||
export UBUNTU_IMAGE_SOURCE=${UBUNTU_IMAGE_SOURCE:-"http://releases.ubuntu.com/${UBUNTU_IMAGE_VERSION}/${UBUNTU_IMAGE_TYPE,,}-${UBUNTU_IMAGE_VERSION}${UBUNTU_IMAGE_PATCH_VERSION}-server-${UBUNTU_IMAGE_ARCH_OTHER}.iso"}
|
||||
export UBUNTU_IMAGE_SOURCE_ASIA=${UBUNTU_IMAGE_SOURCE_ASIA:-"http://mirrors.ustc.edu.cn/ubuntu-releases/${UBUNTU_IMAGE_VERSION}/${UBUNTU_IMAGE_TYPE,,}-${UBUNTU_IMAGE_VERSION}${UBUNTU_IMAGE_PATCH_VERSION}-server-${UBUNTU_IMAGE_ARCH_OTHER}.iso"}
|
||||
|
||||
export CENTOS_6_5_IMAGE_SOURCE=${CENTOS_6_5_IMAGE_SOURCE:-"http://mirror.rackspace.com/CentOS/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso"}
|
||||
export CENTOS_6_5_IMAGE_SOURCE_ASIA=${CENTOS_6_5_IMAGE_SOURCE_ASIA:-"http://mirrors.hustunique.com/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso"}
|
||||
export CENTOS_6_6_IMAGE_SOURCE=${CENTOS_6_6_IMAGE_SOURCE:-"http://mirror.rackspace.com/CentOS/6.6/isos/x86_64/CentOS-6.6-x86_64-minimal.iso"}
|
||||
export CENTOS_6_6_IMAGE_SOURCE_ASIA=${CENTOS_6_6_IMAGE_SOURCE_ASIA:-"http://mirrors.hustunique.com/centos/6.6/isos/x86_64/CentOS-6.6-x86_64-minimal.iso"}
|
||||
export CENTOS_7_0_IMAGE_SOURCE=${CENTOS_7_0_IMAGE_SOURCE:-"http://mirror.rackspace.com/CentOS/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-Minimal.iso"}
|
||||
export CENTOS_7_0_IMAGE_SOURCE_ASIA=${CENTOS_7_0_IMAGE_SOURCE_ASIA:-"http://mirrors.hustunique.com/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-Minimal.iso"}
|
||||
export UBUNTU_12_04_IMAGE_SOURCE=${UBUNTU_12_04_IMAGE_SOURCE:-"http://releases.ubuntu.com/12.04/ubuntu-12.04.4-server-amd64.iso"}
|
||||
export UBUNTU_12_04_IMAGE_SOURCE_ASIA=${UBUNTU_12_04_IMAGE_SOURCE_ASIA:-"http://mirrors.ustc.edu.cn/ubuntu-releases/12.04/ubuntu-12.04.4-server-amd64.iso"}
|
||||
export UBUNTU_14_04_IMAGE_SOURCE=${UBUNTU_14_04_IMAGE_SOURCE:-"http://releases.ubuntu.com/12.04/ubuntu-14.04-server-amd64.iso"}
|
||||
export UBUNTU_14_04_IMAGE_SOURCE_ASIA=${UBUNTU_14_04_IMAGE_SOURCE_ASIA:-"http://mirrors.ustc.edu.cn/ubuntu-releases/14.04/ubuntu-14.04-server-amd64.iso"}
|
||||
|
||||
export COBBLER_PASSWORD=${COBBLER_PASSWORD:-"cobbler"}
|
||||
|
||||
@ -69,10 +66,20 @@ export JS_MVC=${JS_MVC:-"javascriptmvc-3.2.4"}
|
||||
# set the chef packages download path
|
||||
export CHEF_SRV=${CHEF_SRV:-"http://opscode-omnibus-packages.s3.amazonaws.com/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-server-11.0.8-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
||||
export CHEF_SRV_HUAWEI=${CHEF_SRV_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-server-11.0.8-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
||||
export CENTOS_CHEF_CLIENT=${CENTOS_CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${CENTOS_IMAGE_TYPE_OTHER}/${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/chef-11.10.4-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"}
|
||||
export CENTOS_CHEF_CLIENT_HUAWEI=${CENTOS_CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/${CENTOS_IMAGE_TYPE_OTHER}/${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/chef-11.10.4-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"}
|
||||
export UBUNTU_CHEF_CLIENT=${UBUNTU_CHEF_CLIENT:-"http://opscode-omnibus-packages.s3.amazonaws.com/${UBUNTU_IMAGE_TYPE,,}/${UBUNTU_IMAGE_VERSION}/${UBUNTU_IMAGE_ARCH}/chef_11.10.4-1.${UBUNTU_IMAGE_TYPE,,}.${UBUNTU_IMAGE_VERSION}_${UBUNTU_IMAGE_ARCH_OTHER}.deb"}
|
||||
export UBUNTU_CHEF_CLIENT_HUAWEI=${UBUNTU_CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/${UBUNTU_IMAGE_TYPE,,}/${UBUNTU_IMAGE_VERSION}/${UBUNTU_IMAGE_ARCH}/chef_11.10.4-1.${UBUNTU_IMAGE_TYPE,,}.${UBUNTU_IMAGE_VERSION}_${UBUNTU_IMAGE_ARCH_OTHER}.deb"}
|
||||
export CHEF_CLIENT=${CHEF_CLIENT:-"https://opscode-omnibus-packages.s3.amazonaws.com/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-11.10.4-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
||||
export CHEF_CLIENT_HUAWEI=${CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/${IMAGE_TYPE_OTHER}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/chef-11.10.4-1.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.${IMAGE_ARCH}.rpm"}
|
||||
|
||||
export CENTOS_6_5_CHEF_CLIENT=${CENTOS_6_5_CHEF_CLIENT:-"https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-11.10.4-1.el6.x86_64.rpm"}
|
||||
export CENTOS_6_5_CHEF_CLIENT_HUAWEI=${CENTOS_6_5_CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/el/6/x86_64/chef-11.10.4-1.el6.x86_64.rpm"}
|
||||
export CENTOS_6_6_CHEF_CLIENT=${CENTOS_6_6_CHEF_CLIENT:-"https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-11.10.4-1.el6.x86_64.rpm"}
|
||||
export CENTOS_6_6_CHEF_CLIENT_HUAWEI=${CENTOS_6_6_CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/el/6/x86_64/chef-11.10.4-1.el6.x86_64.rpm"}
|
||||
export CENTOS_7_0_CHEF_CLIENT=${CENTOS_7_0_CHEF_CLIENT:-"https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.0.3-1.x86_64.rpm"}
|
||||
export CENTOS_7_0_CHEF_CLIENT_HUAWEI=${CENTOS_7_0_CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/el/6/x86_64/chef-12.0.3-1.x86_64.rpm"}
|
||||
export UBUNTU_12_04_CHEF_CLIENT=${UBUNTU_12_04_CHEF_CLIENT:-"https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.10.4-1.ubuntu.12.04_amd64.deb"}
|
||||
export UBUNTU_12_04_CHEF_CLIENT_HUAWEI=${UBUNTU_12_04_CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/ubuntu/12.04/x86_64/chef_11.10.4-1.ubuntu.12.04_amd64.deb"}
|
||||
export UBUNTU_14_04_CHEF_CLIENT=${UBUNTU_14_04_CHEF_CLIENT:-"https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/13.04/x86_64/chef_12.0.3-1_amd64.deb"}
|
||||
export UBUNTU_14_04_CHEF_CLIENT_HUAWEI=${UBUNTU_14_04_CHEF_CLIENT_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/ubuntu/13.04/x86_64/chef_11.10.4-1.ubuntu.12.04_amd64.deb"}
|
||||
|
||||
# Set Chef password for Chef web UI
|
||||
export CHEF_PASSWD=${CHEF_PASSWD:-"root1234"}
|
||||
|
||||
@ -88,5 +95,5 @@ export COMPASSDIR=${SCRIPT_DIR}/..
|
||||
export TESTMODE=${TESTMODE:-"False"}
|
||||
|
||||
# Set Local Repo sources
|
||||
export LOCAL_REPO_US=${LOCAL_REPO_US:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/local_repo.tar.gz"}
|
||||
export LOCAL_REPO_HUAWEI=${LOCAL_REPO_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass/local_repo.tar.gz"}
|
||||
export LOCAL_REPO_US=${LOCAL_REPO_US:-"https://s3-us-west-1.amazonaws.com/compass-local-repo"}
|
||||
export LOCAL_REPO_HUAWEI=${LOCAL_REPO_HUAWEI:-"http://huawei-repo.uubright.com/repos/compass"}
|
||||
|
@ -15,7 +15,13 @@ export NIC=installation
|
||||
|
||||
# default local repo config is "n"
|
||||
export LOCAL_REPO=${LOCAL_REPO:-"y"}
|
||||
|
||||
|
||||
export SUPPORT_CENTOS_6_5=${SUPPORT_CENTOS_6_5:-"y"}
|
||||
export SUPPORT_CENTOS_6_6=${SUPPORT_CENTOS_6_6:-"n"}
|
||||
export SUPPORT_CENTOS_7_0=${SUPPORT_CENTOS_7_0:-"n"}
|
||||
export SUPPORT_UBUNTU_12_04=${SUPPORT_UBUNTU_12_04:-"y"}
|
||||
export SUPPORT_UBUNTU_14_04=${SUPPORT_UBUNTU_14_04:-"n"}
|
||||
|
||||
# DHCP config
|
||||
export IPADDR=`ifconfig $NIC | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
|
||||
export NETMASK=$(ifconfig $NIC |grep Mask | cut -f 4 -d ':')
|
||||
|
@ -246,6 +246,67 @@ if [[ -z $LOCAL_REPO ]]; then
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z $SUPPORT_CENTOS_6_5 ]]; then
|
||||
echo -e "\x1b[32mWould you like to support centos6.5?(y/n)\x1b[37m"
|
||||
while true; do
|
||||
read ans
|
||||
case $ans in
|
||||
y ) export SUPPORT_CENTOS_6_5="y"; break;;
|
||||
n ) export SUPPORT_CENTOS_6_5="n"; break;;
|
||||
* ) echo "I don't understand this";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z $SUPPORT_CENTOS_6_6 ]]; then
|
||||
echo -e "\x1b[32mWould you like to support centos6.6?(y/n)\x1b[37m"
|
||||
while true; do
|
||||
read ans
|
||||
case $ans in
|
||||
y ) export SUPPORT_CENTOS_6_6="y"; break;;
|
||||
n ) export SUPPORT_CENTOS_6_6="n"; break;;
|
||||
* ) echo "I don't understand this";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z $SUPPORT_CENTOS_7_0 ]]; then
|
||||
echo -e "\x1b[32mWould you like to support centos7.0?(y/n)\x1b[37m"
|
||||
while true; do
|
||||
read ans
|
||||
case $ans in
|
||||
y ) export SUPPORT_CENTOS_7_0="y"; break;;
|
||||
n ) export SUPPORT_CENTOS_7_0="n"; break;;
|
||||
* ) echo "I don't understand this";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z $SUPPORT_UBUNTU_12_04 ]]; then
|
||||
echo -e "\x1b[32mWould you like to support ubuntu12.04?(y/n)\x1b[37m"
|
||||
while true; do
|
||||
read ans
|
||||
case $ans in
|
||||
y ) export SUPPORT_UBUNTU_12_04="y"; break;;
|
||||
n ) export SUPPORT_UBUNTU_12_04="n"; break;;
|
||||
* ) echo "I don't understand this";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z $SUPPORT_UBUNTU_14_04 ]]; then
|
||||
echo -e "\x1b[32mWould you like to support ubuntu14.04?(y/n)\x1b[37m"
|
||||
while true; do
|
||||
read ans
|
||||
case $ans in
|
||||
y ) export SUPPORT_UBUNTU_14_04="y"; break;;
|
||||
n ) export SUPPORT_UBUNTU_14_04="n"; break;;
|
||||
* ) echo "I don't understand this";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
loadvars NAMESERVER_DOMAINS "ods.com"
|
||||
loadvars NAMESERVER_REVERSE_ZONES "unused"
|
||||
loadvars WEB_SOURCE 'http://git.openstack.org/stackforge/compass-web'
|
||||
|
@ -9,14 +9,18 @@ fastesturl()
|
||||
while [ $1 ]; do
|
||||
url=$1
|
||||
result=($(curl --max-time 20 -o /dev/null --header "Range: bytes=0-20000" -s -w "%{http_code} %{time_total}" $url))
|
||||
code=${result[0]}
|
||||
time=${result[1]}
|
||||
if [[ ${good_code[*]} =~ $code ]]; then
|
||||
if [ $(echo "$shortest > $time" | bc) -eq 1 ]; then
|
||||
shortest=$time
|
||||
fastest_url=$url
|
||||
if [[ "$?" == "0" ]]; then
|
||||
code=${result[0]}
|
||||
time=${result[1]}
|
||||
if [[ ${good_code[*]} =~ $code ]]; then
|
||||
if [ $(echo "$shortest > $time" | bc) -eq 1 ]; then
|
||||
shortest=$time
|
||||
fastest_url=$url
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "ignore failed url $url" >&2
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if [[ -z $fastest_url ]]; then
|
||||
@ -131,7 +135,7 @@ download()
|
||||
{
|
||||
#download params: <download url> [<package name>] [<action after package downloaded>]
|
||||
force=0
|
||||
url=""
|
||||
urls=()
|
||||
package=""
|
||||
options=()
|
||||
while [ $# -gt 0 ]; do
|
||||
@ -141,7 +145,7 @@ download()
|
||||
shift 1
|
||||
;;
|
||||
-u | --url):
|
||||
url=$2
|
||||
urls=(${urls[@]} $2)
|
||||
shift 2
|
||||
;;
|
||||
-p | --package):
|
||||
@ -159,24 +163,34 @@ download()
|
||||
esac
|
||||
done
|
||||
set ${options[@]}
|
||||
if [ -z "$url" ]; then
|
||||
url=$1
|
||||
if [ ${#urls[@]} -eq 0 ]; then
|
||||
urls+=($1)
|
||||
shift 1
|
||||
fi
|
||||
if [ -z "$package" ]; then
|
||||
url=${urls[0]}
|
||||
package=${1:-$(basename $url)}
|
||||
shift 1
|
||||
fi
|
||||
echo "download options: $@"
|
||||
action=${1:-""}
|
||||
downloaded=0
|
||||
echo "download $package from $url and run $action"
|
||||
if [[ "$force" == "0" || "$force" == "false" ]]; then
|
||||
if [[ -f /tmp/${package} || -L /tmp/${package} ]]; then
|
||||
echo "$package already exists"
|
||||
downloaded=1
|
||||
fi
|
||||
fi
|
||||
if [ ${#urls[@]} -eq 1 ]; then
|
||||
url=${urls[0]}
|
||||
else
|
||||
echo "download $package from fastest urls ${url[@]}"
|
||||
url=`fastesturl ${urls[@]}`
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to get fastest url from ${urls[@]}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [[ "$url" =~ (http|https|ftp):// ]]; then
|
||||
if [[ "$downloaded" == "0" ]]; then
|
||||
echo "downloading $url to /tmp/${package}"
|
||||
|
@ -237,51 +237,166 @@ fi
|
||||
|
||||
# download cobbler related packages
|
||||
CENTOS_PPA_SOURCE=`fastesturl "http://mirrors.hustunique.com" "http://mirror.centos.org"`
|
||||
centos_ppa_repo_packages="
|
||||
ntp-4.2.6p5-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_TYPE,,}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
openssh-clients-5.3p1-94.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
iproute-2.6.32-31.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
wget-1.12-1.8.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
ntpdate-4.2.6p5-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_TYPE,,}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
yum-plugin-priorities-1.1.30-14.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.noarch.rpm
|
||||
parted-2.1-21.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"
|
||||
centos_6_5_ppa_repo_packages="
|
||||
ntp-4.2.6p5-1.el6.centos.x86_64.rpm
|
||||
openssh-clients-5.3p1-94.el6.x86_64.rpm
|
||||
iproute-2.6.32-31.el6.x86_64.rpm
|
||||
wget-1.12-1.8.el6.x86_64.rpm
|
||||
ntpdate-4.2.6p5-1.el6.centos.x86_64.rpm
|
||||
yum-plugin-priorities-1.1.30-14.el6.noarch.rpm
|
||||
parted-2.1-21.el6.x86_64.rpm"
|
||||
|
||||
for f in $centos_ppa_repo_packages; do
|
||||
download $CENTOS_PPA_SOURCE/${CENTOS_IMAGE_TYPE,,}/${CENTOS_IMAGE_VERSION}/os/${CENTOS_IMAGE_ARCH}/Packages/$f $f || exit $?
|
||||
done
|
||||
if [[ $SUPPORT_CENTOS_6_5 = "y" ]]; then
|
||||
for f in $centos_6_5_ppa_repo_packages; do
|
||||
download $CENTOS_PPA_SOURCE/centos/6.5/os/x86_64/Packages/$f $f || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
centos_ppa_repo_rsyslog_packages="
|
||||
json-c-0.10-2.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
libestr-0.1.9-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
libgt-0.3.11-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
liblogging-1.0.4-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm
|
||||
rsyslog-7.6.3-1.${CENTOS_IMAGE_TYPE_OTHER}${CENTOS_IMAGE_VERSION_MAJOR}.${CENTOS_IMAGE_ARCH}.rpm"
|
||||
centos_6_6_ppa_repo_packages="
|
||||
ntp-4.2.6p5-1.el6.centos.x86_64.rpm
|
||||
openssh-5.3p1-104.el6.x86_64.rpm
|
||||
openssh-clients-5.3p1-104.el6.x86_64.rpm
|
||||
iproute-2.6.32-32.el6_5.x86_64.rpm
|
||||
wget-1.12-5.el6.x86_64.rpm
|
||||
ntpdate-4.2.6p5-1.el6.centos.x86_64.rpm
|
||||
yum-plugin-priorities-1.1.30-30.el6.noarch.rpm
|
||||
parted-2.1-25.el6.x86_64.rpm"
|
||||
|
||||
for f in $centos_ppa_repo_rsyslog_packages; do
|
||||
download http://rpms.adiscon.com/v7-stable/epel-${CENTOS_IMAGE_VERSION_MAJOR}/${CENTOS_IMAGE_ARCH}/RPMS/$f $f || exit $?
|
||||
done
|
||||
if [[ $SUPPORT_CENTOS_6_6 = "y" ]]; then
|
||||
for f in $centos_6_6_ppa_repo_packages; do
|
||||
download $CENTOS_PPA_SOURCE/centos/6.6/os/x86_64/Packages/$f $f || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
CENTOS_CHEF_CLIENT_SOURCE=`fastesturl "$CENTOS_CHEF_CLIENT" "$CENTOS_CHEF_CLIENT_HUAWEI"`
|
||||
download $CENTOS_CHEF_CLIENT_SOURCE `basename $CENTOS_CHEF_CLIENT_SOURCE` || exit $?
|
||||
UBUNTU_CHEF_CLIENT_SOURCE=`fastesturl "$UBUNTU_CHEF_CLIENT" "$UBUNTU_CHEF_CLIENT_HUAWEI"`
|
||||
download $UBUNTU_CHEF_CLIENT_SOURCE `basename $UBUNTU_CHEF_CLIENT_SOURCE` || exit $?
|
||||
centos_7_0_ppa_repo_packages="
|
||||
ntp-4.2.6p5-18.el7.centos.x86_64.rpm
|
||||
openssh-6.4p1-8.el7.x86_64.rpm
|
||||
openssh-clients-6.4p1-8.el7.x86_64.rpm
|
||||
iproute-3.10.0-13.el7.x86_64.rpm
|
||||
wget-1.14-10.el7.x86_64.rpm
|
||||
ntpdate-4.2.6p5-18.el7.centos.x86_64.rpm
|
||||
yum-plugin-priorities-1.1.31-24.el7.noarch.rpm
|
||||
json-c-0.11-3.el7.x86_64.rpm
|
||||
parted-3.1-17.el7.x86_64.rpm
|
||||
autogen-5.18-5.el7.x86_64.rpm
|
||||
autogen-libopts-5.18-5.el7.x86_64.rpm
|
||||
net-tools-2.0-0.17.20131004git.el7.x86_64.rpm"
|
||||
|
||||
if [[ $SUPPORT_CENTOS_7_0 = "y" ]]; then
|
||||
for f in $centos_7_0_ppa_repo_packages; do
|
||||
download $CENTOS_PPA_SOURCE/centos/7.0.1406/os/x86_64/Packages/$f $f || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
centos_6_5_ppa_repo_rsyslog_packages="
|
||||
json-c-0.10-2.el6.x86_64.rpm
|
||||
libestr-0.1.9-1.el6.x86_64.rpm
|
||||
libgt-0.3.11-1.el6.x86_64.rpm
|
||||
liblogging-1.0.4-1.el6.x86_64.rpm
|
||||
rsyslog-mmjsonparse-7.6.3-1.el6.x86_64.rpm
|
||||
rsyslog-7.6.3-1.el6.x86_64.rpm"
|
||||
|
||||
if [[ $SUPPORT_CENTOS_6_5 = "y" ]]; then
|
||||
for f in $centos_6_5_ppa_repo_rsyslog_packages; do
|
||||
download http://rpms.adiscon.com/v7-stable/epel-6/x86_64/RPMS/$f $f || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
centos_6_6_ppa_repo_rsyslog_packages="
|
||||
json-c-0.10-2.el6.x86_64.rpm
|
||||
libestr-0.1.9-1.el6.x86_64.rpm
|
||||
libgt-0.3.11-1.el6.x86_64.rpm
|
||||
liblogging-1.0.4-1.el6.x86_64.rpm
|
||||
rsyslog-mmjsonparse-7.6.3-1.el6.x86_64.rpm
|
||||
rsyslog-7.6.3-1.el6.x86_64.rpm"
|
||||
|
||||
|
||||
if [[ $SUPPORT_CENTOS_6_6 = "y" ]]; then
|
||||
for f in $centos_6_6_ppa_repo_rsyslog_packages; do
|
||||
download http://rpms.adiscon.com/v7-stable/epel-6/x86_64/RPMS/$f $f || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
centos_7_0_ppa_repo_rsyslog_packages="
|
||||
libestr-0.1.9-1.el7.x86_64.rpm
|
||||
libgt-0.3.11-1.el7.x86_64.rpm
|
||||
liblogging-1.0.4-1.el7.x86_64.rpm
|
||||
rsyslog-mmjsonparse-7.6.3-1.el7.x86_64.rpm
|
||||
rsyslog-7.6.3-1.el7.x86_64.rpm"
|
||||
|
||||
if [[ $SUPPORT_CENTOS_7_0 = "y" ]]; then
|
||||
for f in $centos_7_0_ppa_repo_rsyslog_packages; do
|
||||
download http://rpms.adiscon.com/v7-stable/epel-7/x86_64/RPMS/$f $f || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_CENTOS_6_5 = "y" ]]; then
|
||||
download -u $CENTOS_6_5_CHEF_CLIENT -u $CENTOS_6_5_CHEF_CLIENT_HUAWEI || exit $?
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_CENTOS_6_6 = "y" ]]; then
|
||||
download -u $CENTOS_6_6_CHEF_CLIENT -u $CENTOS_6_6_CHEF_CLIENT_HUAWEI || exit $?
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_CENTOS_7_0 = "y" ]]; then
|
||||
download -u $CENTOS_7_0_CHEF_CLIENT -u $CENTOS_7_0_CHEF_CLIENT_HUAWEI || exit $?
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_UBUNTU_12_04 = "y" ]]; then
|
||||
download -u $UBUNTU_12_04_CHEF_CLIENT -u $UBUNTU_12_04_CHEF_CLIENT_HUAWEI || exit $?
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_UBUNTU_14_04 = "y" ]]; then
|
||||
download -u $UBUNTU_14_04_CHEF_CLIENT -u $UBUNTU_14_04_CHEF_CLIENT_HUAWEI || exit $?
|
||||
fi
|
||||
|
||||
# download chef related packages
|
||||
CHEF_SRV_SOURCE=`fastesturl "$CHEF_SRV" "$CHEF_SRV_HUAWEI"`
|
||||
download $CHEF_SRV_SOURCE chef-server || exit $?
|
||||
download -u $CHEF_SRV -u $CHEF_SRV_HUAWEI || exit $?
|
||||
download -u $CHEF_CLIENT -u $CHEF_CLIENT_HUAWEI || exit $?
|
||||
|
||||
# download os images
|
||||
CENTOS_ISO_SOURCE=`fastesturl $CENTOS_IMAGE_SOURCE $CENTOS_IMAGE_SOURCE_ASIA`
|
||||
download $CENTOS_ISO_SOURCE ${CENTOS_IMAGE_NAME}-${CENTOS_IMAGE_ARCH}.iso || exit $?
|
||||
if [[ $SUPPORT_CENTOS_6_5 = "y" ]]; then
|
||||
download -u $CENTOS_6_5_IMAGE_SOURCE -u $CENTOS_6_5_IMAGE_SOURCE_ASIA CentOS-6.5-x86_64.iso || exit $?
|
||||
fi
|
||||
|
||||
UBUNTU_ISO_SOURCE=`fastesturl $UBUNTU_IMAGE_SOURCE $UBUNTU_IMAGE_SOURCE_ASIA`
|
||||
download $UBUNTU_ISO_SOURCE ${UBUNTU_IMAGE_NAME}-${UBUNTU_IMAGE_ARCH}.iso || exit $?
|
||||
if [[ $SUPPORT_CENTOS_6_6 = "y" ]]; then
|
||||
download -u $CENTOS_6_6_IMAGE_SOURCE -u $CENTOS_6_6_IMAGE_SOURCE_ASIA CentOS-6.6-x86_64.iso || exit $?
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_CENTOS_7_0 = "y" ]]; then
|
||||
download -u $CENTOS_7_0_IMAGE_SOURCE -u $CENTOS_7_0_IMAGE_SOURCE_ASIA $CENTOS_7_0_ISO_SOURCE CentOS-7.0-x86_64.iso || exit $?
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_UBUNTU_12_04 = "y" ]]; then
|
||||
download -u $UBUNTU_12_04_IMAGE_SOURCE -u $UBUNTU_12_04_IMAGE_SOURCE_ASIA Ubuntu-12.04-x86_64.iso || exit $?
|
||||
fi
|
||||
|
||||
if [[ $SUPPORT_UBUNTU_14_04 = "y" ]]; then
|
||||
download -u $UBUNTU_14_04_IMAGE_SOURCE -u $UBUNTU_14_04_IMAGE_SOURCE_ASIA Ubuntu-14.04-x86_64.iso || exit $?
|
||||
fi
|
||||
|
||||
# download local repo
|
||||
if [[ $LOCAL_REPO = "y" ]]; then
|
||||
LOCAL_REPO_SOURCE=`fastesturl $LOCAL_REPO_US $LOCAL_REPO_HUAWEI`
|
||||
download $LOCAL_REPO_SOURCE local_repo.tar.gz || exit $?
|
||||
download -u ${LOCAL_REPO_US}/local_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/local_repo.tar.gz || exit $?
|
||||
download -u ${LOCAL_REPO_US}/gem_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/gem_repo.tar.gz || exit $?
|
||||
download -u ${LOCAL_REPO_US}/cirros-0.3.2-x86_64-disk.img -u ${LOCAL_REPO_HUAWEI}/cirros-0.3.2-x86_64-disk.img || exit $?
|
||||
if [[ $SUPPORT_CENTOS_6_5 = "y" ]]; then
|
||||
download -u ${LOCAL_REPO_US}/centos/6.5/centos_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/centos/6.5/centos_repo.tag.gz CentOS-6.5-x86_64.tar.gz|| exit $?
|
||||
fi
|
||||
if [[ $SUPPORT_CENTOS_6_6 = "y" ]]; then
|
||||
download -u ${LOCAL_REPO_US}/centos/6.6/centos_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/centos/6.6/centos_repo.tag.gz CentOS-6.6-x86_64.tar.gz|| exit $?
|
||||
fi
|
||||
if [[ $SUPPORT_CENTOS_7_0 = "y" ]]; then
|
||||
download -u ${LOCAL_REPO_US}/centos/7.0/centos_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/centos/7.0/centos_repo.tag.gz CentOS-7.0-x86_64.tar.gz|| exit $?
|
||||
fi
|
||||
if [[ $SUPPORT_UBUNTU_12_04 = "y" ]]; then
|
||||
download -u ${LOCAL_REPO_US}/ubuntu/12.04/ubuntu_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/ubuntu/12.04/ubuntu_repo.tar.gz Ubuntu-12.04-x86_64.tar.gz || exit $?
|
||||
fi
|
||||
if [[ $SUPPORT_UBUNTU_14_04 = "y" ]]; then
|
||||
download -u ${LOCAL_REPO_US}/ubuntu/14.04/ubuntu_repo.tar.gz -u ${LOCAL_REPO_HUAWEI}/ubuntu/14.04/ubuntu_repo.tar.gz Ubuntu-14.04-x86_64.tar.gz || exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install net-snmp
|
||||
echo "install snmp config"
|
||||
if [[ ! -e /etc/snmp ]]; then
|
||||
|
@ -11,5 +11,10 @@ NEXTSERVER=\${NEXTSERVER:-$NEXTSERVER}
|
||||
IP_START=\${IP_START:-$IP_START}
|
||||
IP_END=\${IP_END:-$IP_END}
|
||||
LOCAL_REPO=\${LOCAL_REPO:-$LOCAL_REPO}
|
||||
SUPPORT_CENTOS_6_5=\${SUPPORT_CENTOS_6_5:-$SUPPORT_CENTOS_6_5}
|
||||
SUPPORT_CENTOS_6_6=\${SUPPORT_CENTOS_6_6:-$SUPPORT_CENTOS_6_6}
|
||||
SUPPORT_CENTOS_7_0=\${SUPPORT_CENTOS_7_0:-$SUPPORT_CENTOS_7_0}
|
||||
SUPPORT_UBUNTU_12_04=\${SUPPORT_UBUNTU_12_04:-$SUPPORT_UBUNTU_12_04}
|
||||
SUPPORT_UBUNTU_14_04=\${SUPPORT_UBUNTU_14_04:-$SUPPORT_UBUNTU_14_04}
|
||||
EOF
|
||||
chmod ugo+x $SCRIPT_DIR/env.conf
|
||||
|
Loading…
x
Reference in New Issue
Block a user