Fix some bugs in install script

Change-Id: I982a3c35ae62ffdddad05542efc34e7109e559da
This commit is contained in:
root 2015-09-16 19:00:54 -07:00 committed by Xicheng Chang
parent 8eae6d8048
commit aa1e728264
9 changed files with 6 additions and 131 deletions

View File

@ -394,31 +394,7 @@ if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then
download -u "$SLES_11SP3_PPA_REPO_SOURCE" -u "$SLES_11SP3_PPA_REPO_SOURCE_ASIA" sles_11sp3_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? download -u "$SLES_11SP3_PPA_REPO_SOURCE" -u "$SLES_11SP3_PPA_REPO_SOURCE_ASIA" sles_11sp3_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $?
fi fi
if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then sudo cobbler repo remove --name Ubuntu-14.04-x86_64
sudo mkdir -p /var/lib/cobbler/repo_mirror/sles_11sp3_ppa_repo
found_sles_11sp3_ppa_repo=0
for repo in $(cobbler repo list); do
if [ "$repo" == "sles_11sp3_ppa_repo" ]; then
found_sles_11sp3_ppa_repo=1
fi
done
if [ "$found_sles_11sp3_ppa_repo" == "0" ]; then
sudo cobbler repo add --mirror=/var/lib/cobbler/repo_mirror/sles_11sp3_ppa_repo --name=sles_11sp3_ppa_repo --mirror-locally=Y --arch=x86_64
if [[ "$?" != "0" ]]; then
echo "failed to add sles_11sp3_ppa_repo"
exit 1
else
echo "sles_11sp3_ppa_repo is added"
fi
else
echo "repo sles_11sp3_ppa_repo has already existed."
fi
download -u "$SLES_11SP3_PPA_REPO_SOURCE" -u "$SLES_11SP3_PPA_REPO_SOURCE_ASIA" sles_11sp3_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $?
fi
sudo cobbler reposync sudo cobbler reposync
if [[ "$?" != "0" ]]; then if [[ "$?" != "0" ]]; then
echo "cobbler reposync failed" echo "cobbler reposync failed"
@ -526,24 +502,6 @@ if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then
fi fi
fi fi
if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then
download -u "$SLES_11SP3_IMAGE_SOURCE_ASIA" -u "$SLES_11SP3_IMAGE_SOURCE" sles-11sp3-x86_64.iso copy /var/lib/cobbler/iso/ || exit $?
sudo mkdir -p /mnt/sles-11sp3-x86_64
if [ $(mount | grep -c "/mnt/sles-11sp3-x86_64") -eq 0 ]; then
sudo mount -o loop /var/lib/cobbler/iso/sles-11sp3-x86_64.iso /mnt/sles-11sp3-x86_64
if [[ "$?" != "0" ]]; then
echo "failed to mount image /mnt/sles-11sp3-x86_64"
exit 1
else
echo "/mnt/sles-11sp3-x86_64 is mounted"
fi
else
echo "/mnt/sles-11sp3-x86_64 has already mounted"
fi
download -u "$UVP_11SP3_IMAGE_SOURCE" -u "$UVP_11SP3_IMAGE_SOURCE_ASIA" uvp-os-11sp3-x86_64.tar.gz copy /var/www/cobbler/aux/uvp-11sp3-x86_64.tar.gz || exit $?
fi
# add distro # add distro
if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then
found_centos_6_5_distro=0 found_centos_6_5_distro=0
@ -866,58 +824,6 @@ if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then
fi fi
fi fi
if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then
found_uvp_11sp3_distro=0
distro=$(cobbler distro find --name=uvp-11sp3-x86_64)
if [ "$distro" == "uvp-11sp3-x86_64" ]; then
found_uvp_11sp3_distro=1
fi
if [ "$found_uvp_11sp3_distro" == "0" ]; then
sudo cobbler import --path=/mnt/sles-11sp3-x86_64 --name=uvp-11sp3 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.xml --breed=suse --os-version=sles11sp3
if [[ "$?" != "0" ]]; then
echo "failed to import /mnt/sles-11sp3-x86_64"
exit 1
else
echo "/mnt/sles-11sp3-x86_64 is imported"
fi
else
echo "distro uvp-11sp3-x86_64 has already existed"
sudo cobbler distro edit --name=uvp-11sp3-x86_64 --arch=x86_64 --breed=suse --os-version=sles11sp3
if [[ "$?" != "0" ]]; then
echo "failed to edit distro uvp-11sp3-x86_64"
exit 1
else
echo "distro uvp-11sp3-x86_64 is updated"
fi
fi
uvp_11sp3_found_profile=0
profile=$(cobbler profile find --name=uvp-11sp3-x86_64)
if [ "$profile" == "uvp-11sp3-x86_64" ]; then
uvp_11sp3_found_profile=1
fi
if [ "$uvp_11sp3_found_profile" == "0" ]; then
sudo cobbler profile add --name=uvp-11sp3-x86_64 --repo=sles_11sp3_ppa_repo --distro=uvp-11sp3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.xml --kopts="textmode=1 install=http://$IPADDR/cobbler/ks_mirror/sles-11sp3-x86_64" --kopts-post="noexec=on nohz=off console=tty0 console=ttyS0,115200 hugepagesz=2M hpet=enable selinux=0 iommu=pt default_hugepagesz=2M intel_iommu=on pci=realloc crashkernel=192M@48M highres=on nmi_watchdog=1" --ksmeta="image_kernel_version=3.0.93-0.8 image_url=http://@@http_server@@/cblr/aux/uvp-11sp3-x86_64.tar.gz"
if [[ "$?" != "0" ]]; then
echo "failed to add profile uvp-11sp3-x86_64"
exit 1
else
echo "profile uvp-11sp3-x86_64 is added"
fi
else
echo "profile sles-11sp3-x86_64 has already existed."
sudo cobbler profile edit --name=uvp-11sp3-x86_64 --repo=sles_11sp3_ppa_repo --distro=sles-11sp3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.xml --kopts="textmode=1 install=http://$IPADDR/cobbler/ks_mirror/sles-11sp3-x86_64" --kopts-post="noexec=on nohz=off console=tty0 console=ttyS0,115200 hugepagesz=2M hpet=enable selinux=0 iommu=pt default_hugepagesz=2M intel_iommu=on pci=realloc crashkernel=192M@48M highres=on nmi_watchdog=1" --ksmeta="image_kernel_version=3.0.93-0.8 image_url=http://@@http_server@@/cblr/aux/uvp-11sp3-x86_64.tar.gz"
if [[ "$?" != "0" ]]; then
echo "failed to edit profile uvp-11sp3-x86_64"
exit 1
else
echo "profile uvp-11sp3-x86_64 is updated"
fi
fi
fi
sudo cobbler reposync sudo cobbler reposync
if [[ "$?" != "0" ]]; then if [[ "$?" != "0" ]]; then
echo "cobbler reposync failed" echo "cobbler reposync failed"

View File

@ -63,10 +63,6 @@ if [[ $SUPPORT_SLES_11SP3 != "y" ]]; then
sudo rm -f /etc/compass/os/sles11sp3.conf sudo rm -f /etc/compass/os/sles11sp3.conf
fi fi
if [[ $SUPPORT_UVP_11SP3 != "y" ]]; then
sudo rm -f /etc/compass/os/uvp11sp3.conf
fi
# add apache user to the group of virtualenv user # add apache user to the group of virtualenv user
sudo usermod -a -G `groups $USER|awk '{print$3}'` apache sudo usermod -a -G `groups $USER|awk '{print$3}'` apache

View File

@ -47,10 +47,6 @@ if [[ $LOCAL_REPO = "y" ]]; then
mkdir -p /var/www/compass_web/v2/zypp.repos.d/sles/11sp3 mkdir -p /var/www/compass_web/v2/zypp.repos.d/sles/11sp3
download -u "${LOCAL_REPO_US}/sles/11sp3/sles_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/sles/11sp3/sles_repo.tar.gz" sles-11sp3-x86_64.tar.gz unzip /var/www/compass_web/v2/zypp.repos.d/sles/11sp3 || exit $? download -u "${LOCAL_REPO_US}/sles/11sp3/sles_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/sles/11sp3/sles_repo.tar.gz" sles-11sp3-x86_64.tar.gz unzip /var/www/compass_web/v2/zypp.repos.d/sles/11sp3 || exit $?
fi fi
if [[ $SUPPORT_UVP_11SP3 = "y" ]]; then
mkdir -p /var/www/compass_web/v2/zypp.repos.d/uvp/11sp3
download -u "${LOCAL_REPO_US}/uvp/11sp3/uvp_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/uvp/11sp3/uvp_repo.tar.gz" uvp-11sp3-x86_64.tar.gz unzip /var/www/compass_web/v2/zypp.repos.d/uvp/11sp3 || exit $?
fi
fi fi
sudo service httpd restart sudo service httpd restart

View File

@ -10,7 +10,10 @@ if [ "$tempest" == "true" ]; then
exit 1 exit 1
fi fi
fi fi
sudo yum install -y rsyslog logrotate ntp iproute openssh-clients python python-devel git wget syslinux amqp mod_wsgi httpd squid dhcp bind rsync yum-utils xinetd tftp-server gcc net-snmp-utils net-snmp net-snmp-python unzip openssl openssl098e ca-certificates redis mysql mysql-server mysql-devel python-virtualenv python-setuptools python-pip bc sudo yum install -y rsyslog logrotate ntp iproute openssh-clients python python-devel git wget syslinux amqp mod_wsgi httpd squid dhcp bind rsync yum-utils xinetd tftp-server gcc net-snmp-utils net-snmp net-snmp-python unzip openssl openssl098e ca-certificates mysql mysql-server mysql-devel python-virtualenv python-setuptools python-pip bc libselinux-python
sudo yum --setopt=tsflags=noscripts -y remove redis
sudo yum --enablerepo=remi,remi-test install -y redis
if [[ "$?" != "0" ]]; then if [[ "$?" != "0" ]]; then
echo "failed to install yum dependency" echo "failed to install yum dependency"
exit 1 exit 1

View File

@ -63,8 +63,6 @@ export UBUNTU_14_04_IMAGE_SOURCE=${UBUNTU_14_04_IMAGE_SOURCE:-"https://s3-us-wes
export UBUNTU_14_04_IMAGE_SOURCE_ASIA=${UBUNTU_14_04_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/ubuntu/14.04/Ubuntu-14.04-x86_64.iso"} export UBUNTU_14_04_IMAGE_SOURCE_ASIA=${UBUNTU_14_04_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/ubuntu/14.04/Ubuntu-14.04-x86_64.iso"}
export SLES_11SP3_IMAGE_SOURCE=${SLES_11SP3_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/sles/11sp3/sles-11sp3-x86_64.iso"} export SLES_11SP3_IMAGE_SOURCE=${SLES_11SP3_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/sles/11sp3/sles-11sp3-x86_64.iso"}
export SLES_11SP3_IMAGE_SOURCE_ASIA=${SLES_11SP3_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/sles/11sp3/sles-11sp3-x86_64.iso"} export SLES_11SP3_IMAGE_SOURCE_ASIA=${SLES_11SP3_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/sles/11sp3/sles-11sp3-x86_64.iso"}
export UVP_11SP3_IMAGE_SOURCE=${UVP_11SP3_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/uvp/11sp3/uvp-os-11sp3-x86_64.tar.gz"}
export UVP_11SP3_IMAGE_SOURCE_ASIA=${UVP_11SP3_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/uvp/11sp3/uvp-os-11sp3-x86_64.tar.gz"}
export CENTOS_6_5_PPA_REPO_SOURCE=${CENTOS_6_5_PPA_REPO_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/centos/6.5/centos_6_5_ppa_repo.tar.gz"} export CENTOS_6_5_PPA_REPO_SOURCE=${CENTOS_6_5_PPA_REPO_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/centos/6.5/centos_6_5_ppa_repo.tar.gz"}
export CENTOS_6_5_PPA_REPO_SOURCE_ASIA=${CENTOS_6_5_PPA_REPO_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/centos/6.5/centos_6_5_ppa_repo.tar.gz"} export CENTOS_6_5_PPA_REPO_SOURCE_ASIA=${CENTOS_6_5_PPA_REPO_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/centos/6.5/centos_6_5_ppa_repo.tar.gz"}

View File

@ -26,7 +26,6 @@ export SUPPORT_CENTOS_7_0=${SUPPORT_CENTOS_7_0:-"y"}
export SUPPORT_UBUNTU_12_04=${SUPPORT_UBUNTU_12_04:-"y"} export SUPPORT_UBUNTU_12_04=${SUPPORT_UBUNTU_12_04:-"y"}
export SUPPORT_UBUNTU_14_04=${SUPPORT_UBUNTU_14_04:-"y"} export SUPPORT_UBUNTU_14_04=${SUPPORT_UBUNTU_14_04:-"y"}
export SUPPORT_SLES_11SP3=${SUPPORT_SLES_11SP3:-"n"} export SUPPORT_SLES_11SP3=${SUPPORT_SLES_11SP3:-"n"}
export SUPPORT_UVP_11SP3=${SUPPORT_UVP_11SP3:-"n"}
# DHCP config # DHCP config
export IPADDR=`ifconfig $NIC | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` export IPADDR=`ifconfig $NIC | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`

View File

@ -324,18 +324,6 @@ if [[ -z $SUPPORT_SLES_11SP3 ]]; then
done done
fi fi
if [[ -z $SUPPORT_UVP_11SP3 ]]; then
echo -e "\x1b[32mWould you like to support uvp11sp3?(y/n)\x1b[37m"
while true; do
read ans
case $ans in
y ) export SUPPORT_UVP_11SP3="y"; break;;
n ) export SUPPORT_UVP_11SP3="n"; break;;
* ) echo "I don't understand this";;
esac
done
fi
loadvars NAMESERVER_DOMAINS "ods.com" loadvars NAMESERVER_DOMAINS "ods.com"
loadvars NAMESERVER_REVERSE_ZONES "unused" loadvars NAMESERVER_REVERSE_ZONES "unused"
loadvars WEB_SOURCE 'http://git.openstack.org/stackforge/compass-web' loadvars WEB_SOURCE 'http://git.openstack.org/stackforge/compass-web'

View File

@ -107,6 +107,7 @@ fi
echo "update mysqld" echo "update mysqld"
mkdir -p /var/log/mysql mkdir -p /var/log/mysql
chmod -R 777 /var/log/mysql chmod -R 777 /var/log/mysql
sleep 10
sudo service mysqld restart sudo service mysqld restart
sudo sleep 10 sudo sleep 10
sudo service mysqld status sudo service mysqld status
@ -302,13 +303,6 @@ if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then
download -u "$SLES_11SP3_IMAGE_SOURCE" -u "$SLES_11SP3_IMAGE_SOURCE_ASIA" sles-11sp3-x86_64.iso || exit $? download -u "$SLES_11SP3_IMAGE_SOURCE" -u "$SLES_11SP3_IMAGE_SOURCE_ASIA" sles-11sp3-x86_64.iso || exit $?
fi fi
if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then
echo "download sles11sp3 image"
download -u "$SLES_11SP3_IMAGE_SOURCE" -u "$SLES_11SP3_IMAGE_SOURCE_ASIA" sles-11sp3-x86_64.iso || exit $?
echo "download uvp image"
download -u "$UVP_11SP3_IMAGE_SOURCE" -u "$UVP_11SP3_IMAGE_SOURCE_ASIA" uvp-os-11sp3-x86_64.tar.gz || exit $?
fi
# download local repo # download local repo
if [[ $LOCAL_REPO == "y" ]]; then if [[ $LOCAL_REPO == "y" ]]; then
echo "download gem local repo" echo "download gem local repo"
@ -339,10 +333,6 @@ if [[ $LOCAL_REPO == "y" ]]; then
echo "download sles11sp3 local repo" echo "download sles11sp3 local repo"
download -u "${LOCAL_REPO_US}/sles/11sp3/sles_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/sles/11sp3/sles_repo.tar.gz" sles-11sp3-x86_64.tar.gz || exit $? download -u "${LOCAL_REPO_US}/sles/11sp3/sles_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/sles/11sp3/sles_repo.tar.gz" sles-11sp3-x86_64.tar.gz || exit $?
fi fi
if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then
echo "download uvp11sp3 local repo"
download -u "${LOCAL_REPO_US}/uvp/11sp3/uvp_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/uvp/11sp3/uvp_repo.tar.gz" uvp-11sp3-x86_64.tar.gz || exit $?
fi
fi fi
# Install net-snmp # Install net-snmp

View File

@ -17,6 +17,5 @@ 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_12_04=\${SUPPORT_UBUNTU_12_04:-$SUPPORT_UBUNTU_12_04}
SUPPORT_UBUNTU_14_04=\${SUPPORT_UBUNTU_14_04:-$SUPPORT_UBUNTU_14_04} SUPPORT_UBUNTU_14_04=\${SUPPORT_UBUNTU_14_04:-$SUPPORT_UBUNTU_14_04}
SUPPORT_SLES_11SP3=\${SUPPORT_SLES_11SP3:-$SUPPORT_SLES_11SP3} SUPPORT_SLES_11SP3=\${SUPPORT_SLES_11SP3:-$SUPPORT_SLES_11SP3}
SUPPORT_UVP_11SP3=\${SUPPORT_UVP_11SP3:-$SUPPORT_UVP_11SP3}
EOF EOF
chmod ugo+x $SCRIPT_DIR/env.conf chmod ugo+x $SCRIPT_DIR/env.conf