From 9c54aae1d0ded23a9794fb06b42e748d21800870 Mon Sep 17 00:00:00 2001 From: baigk Date: Tue, 29 Dec 2015 21:37:38 +0800 Subject: [PATCH] modify the iso and ppa source modify the iso and ppa source Change-Id: I91b4a73e6f4aea69bd083acbabbfe1d2c849d8fd Signed-off-by: baigk --- install/cobbler.sh | 634 ++++------------------------------ install/compass.sh | 20 +- install/compass_web.sh | 30 -- install/install.conf | 38 +- install/install.conf.template | 8 +- install/install.sh | 84 ----- install/install_func.sh | 34 +- install/prepare.sh | 86 +---- install/setup_env.sh | 8 +- 9 files changed, 104 insertions(+), 838 deletions(-) diff --git a/install/cobbler.sh b/install/cobbler.sh index 2540543f..80176a79 100755 --- a/install/cobbler.sh +++ b/install/cobbler.sh @@ -213,606 +213,108 @@ if [[ "$?" != "0" ]]; then exit 1 fi -sudo cobbler sync -if [[ "$?" != "0" ]]; then - echo "failed to sync cobbler" - exit 1 -fi - -sudo mkdir -p /var/lib/cobbler/repo_mirror -# create centos repo -if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then - 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_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 +for i in $UBUNTU_14_04_03_IMAGE_SOURCE; do + sudo mkdir -p /var/lib/cobbler/iso + download -u "$i" `basename "$i"` copy /var/lib/cobbler/iso/ || exit $? + name=`basename "$i" | sed -e 's/.iso//g' -e 's/-amd64//g' -e 's/-x86_64//g'`-x86_64 + if [[ `mount | grep "$name"` -eq 0 ]]; then + sudo mkdir -p /mnt/$name + sudo mount -o loop /var/lib/cobbler/iso/`basename $i` /mnt/$name if [[ "$?" != "0" ]]; then - echo "failed to add centos_6_5_ppa_repo" + echo "failed to mount image /mnt/$name" 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 - download -u "$CENTOS_6_5_PPA_REPO_SOURCE" -u "$CENTOS_6_5_PPA_REPO_SOURCE_ASIA" centos_6_5_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? -fi - -if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then - 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 - - 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 + cobbler import --path=/mnt/$name \ + --name $name \ + --arch=x86_64 \ + --kickstart=/var/lib/cobbler/kickstarts/default.seed \ + --breed=ubuntu if [[ "$?" != "0" ]]; then - echo "failed to add centos_6_6_ppa_repo" + echo "failed to import /mnt/$i" exit 1 - else - echo "centos_6_6_ppa_repo is added" fi - else - echo "repo centos_6_6_ppa_repo has already existed." fi +done - # download packages - download -u "$CENTOS_6_6_PPA_REPO_SOURCE" -u "$CENTOS_6_6_PPA_REPO_SOURCE_ASIA" centos_6_6_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? -fi - -if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then - 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 +for i in $CENTOS_7_2_IMAGE_SOURCE; do + sudo mkdir -p /var/lib/cobbler/iso + download -u "$i" `basename "$i"` copy /var/lib/cobbler/iso/ || exit $? + name=`basename "$i" | sed -e 's/.iso//g' -e 's/-amd64//g' -e 's/-x86_64//g'`-x86_64 + if [[ `mount | grep "$name"` -eq 0 ]]; then + sudo mkdir -p /mnt/$name + sudo mount -o loop /var/lib/cobbler/iso/`basename $i` /mnt/$name if [[ "$?" != "0" ]]; then - echo "failed to add centos_7_0_ppa_repo" + echo "failed to mount image /mnt/$name" 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 - download -u "$CENTOS_7_0_PPA_REPO_SOURCE" -u "$CENTOS_7_0_PPA_REPO_SOURCE_ASIA" centos_7_0_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? -fi - - -# create ubuntu repo -if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then - 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_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 + cobbler import --path=/mnt/$name \ + --name $name \ + --arch=x86_64 \ + --kickstart=/var/lib/cobbler/kickstarts/default.ks \ + --breed=redhat if [[ "$?" != "0" ]]; then - echo "failed to add ubuntu_12_04_ppa_repo" + echo "failed to import /mnt/$i" exit 1 - else - echo "ubuntu_12_04_ppa_repo is added" fi - else - echo "repo ubuntu_12_04_ppa_repo has already existed." fi + +done - download -u "$UBUNTU_12_04_PPA_REPO_SOURCE" -u "$UBUNTU_12_04_PPA_REPO_SOURCE_ASIA" ubuntu_12_04_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? -fi +cobbler repo list | xargs -n 1 cobbler repo remove --name -if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then - 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 +mkdir -p /var/lib/cobbler/repo_mirror - 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 +for i in $UBUNTU_14_04_03_PPA_REPO_SOURCE; do + download -u "$i" `basename "$i"` unzip /var/lib/cobbler/repo_mirror || exit $? + filename=`basename $i | sed 's/.tar.gz//g'` + cobbler repo add --name $filename --mirror=/var/lib/cobbler/repo_mirror/$filename \ + --mirror-locally=Y --arch=x86_64 --apt-dists=trusty --apt-components=main - download -u "$UBUNTU_14_04_PPA_REPO_SOURCE" -u "$UBUNTU_14_04_PPA_REPO_SOURCE_ASIA" ubuntu_14_04_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? -fi + if [[ "$?" != "0" ]]; then + echo "failed to add repo $i" + exit 1 + fi +done -if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then - 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 +for i in $CENTOS_7_2_PPA_REPO_SOURCE; do + download -u "$i" `basename "$i"` unzip /var/lib/cobbler/repo_mirror || exit $? + filename=`basename $i | sed 's/.tar.gz//g'` + cobbler repo add --name $filename --mirror=/var/lib/cobbler/repo_mirror/$filename \ + --mirror-locally=Y --arch=x86_64 + if [[ "$?" != "0" ]]; then + echo "failed to add repo $i" + exit 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 +for i in $UBUNTU_14_04_03_IMAGE_SOURCE; do + name=`basename "$i" | sed -e 's/.iso//g' -e 's/-amd64//g' -e 's/-x86_64//g'`-x86_64 + cobbler profile edit --name=$name \ + --distro=$name --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/$name" \ + --kickstart=/var/lib/cobbler/kickstarts/default.seed \ + --kopts="netcfg/choose_interface=auto console='ttyS0,115200n8' console=tty0 biosdevname=0" \ + --kopts-post="console='ttyS0,115200n8' console=tty0 biosdevname=0" +done - 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 +for i in $CENTOS_7_2_IMAGE_SOURCE; do + name=`basename "$i" | sed -e 's/.iso//g' -e 's/-amd64//g' -e 's/-x86_64//g'`-x86_64 + cobbler profile edit --name=$name \ + --distro=$name --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/$name" \ + --kickstart=/var/lib/cobbler/kickstarts/default.ks +done sudo cobbler reposync if [[ "$?" != "0" ]]; then echo "cobbler reposync failed" exit 1 -else - echo "cobbler repos are synced" -fi - -# import cobbler distro -sudo mkdir -p /var/lib/cobbler/iso -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-6.5-x86_64 has already mounted" - fi -fi - -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/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 -fi - -if [[ $SUPPORT_SLES_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 -fi - -# add distro -if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then - found_centos_6_5_distro=0 - distro=$(cobbler distro find --name=CentOS-6.5-x86_64) - if [ "$distro" == "CentOS-6.5-x86_64" ]; then - found_centos_6_5_distro=1 - fi - - 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 "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 - - centos_6_5_found_profile=0 - profile=$(cobbler profile find --name=CentOS-6.5-x86_64) - if [ "$profile" == "CentOS-6.5-x86_64" ]; then - centos_6_5_found_profile=1 - fi - - 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 "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 - -if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then - found_centos_6_6_distro=0 - distro=$(cobbler distro find --name=CentOS-6.6-x86_64) - if [ "$distro" == "CentOS-6.6-x86_64" ]; then - found_centos_6_6_distro=1 - fi - - 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 "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 - - centos_6_6_found_profile=0 - profile=$(cobbler profile find --name=CentOS-6.6-x86_64) - if [ "$profile" == "CentOS-6.6-x86_64" ]; then - centos_6_6_found_profile=1 - fi - - 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 "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 - -if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then - found_centos_7_0_distro=0 - distro=$(cobbler distro find --name=CentOS-7.0-x86_64) - if [ "$distro" == "CentOS-7.0-x86_64" ]; then - found_centos_7_0_distro=1 - fi - - 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 "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 - - 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-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 - -if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then - found_ubuntu_12_04_distro=0 - distro=$(cobbler distro find --name=Ubuntu-12.04-x86_64) - if [ "$distro" == "Ubuntu-12.04-x86_64" ]; then - found_ubuntu_12_04_distro=1 - fi - - 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 "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 - - ubuntu_12_04_found_profile=0 - profile=$(cobbler profile find --name=Ubuntu-12.04-x86_64) - if [ "$profile" == "Ubuntu-12.04-x86_64" ]; then - ubuntu_12_04_found_profile=1 - fi - - 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-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 - remove_repo=$(cobbler repo find --name=Ubuntu-12.04-x86_64) - if [ "$remove_repo" == "Ubuntu-12.04-x86_64" ]; then - sudo cobbler repo remove --name=Ubuntu-12.04-x86_64 - fi -fi - -if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then - found_ubuntu_14_04_distro=0 - distro=$(cobbler distro find --name=Ubuntu-14.04-x86_64) - if [ "$distro" == "Ubuntu-14.04-x86_64" ]; then - found_ubuntu_14_04_distro=1 - fi - - 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 - profile=$(cobbler profile find --name=Ubuntu-14.04-x86_64) - if [ "$profile" == "Ubuntu-14.04-x86_64" ]; then - ubuntu_14_04_found_profile=1 - fi - - 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 - remove_repo=$(cobbler repo find --name=Ubuntu-14.04-x86_64) - if [ "$remove_repo" == "Ubuntu-14.04-x86_64" ]; then - sudo cobbler repo remove --name=Ubuntu-14.04-x86_64 - fi -fi - -if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then - found_sles_11sp3_distro=0 - distro=$(cobbler distro find --name=sles-11sp3-x86_64) - if [ "$distro" == "sles-11sp3-x86_64" ]; then - found_sles_11sp3_distro=1 - fi - - if [ "$found_sles_11sp3_distro" == "0" ]; then - sudo cobbler import --path=/mnt/sles-11sp3-x86_64 --name=sles-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 sles-11sp3-x86_64 has already existed" - sudo cobbler distro edit --name=sles-11sp3-x86_64 --arch=x86_64 --breed=suse --os-version=sles11sp3 - if [[ "$?" != "0" ]]; then - echo "failed to edit distro sles-11sp3-x86_64" - exit 1 - else - echo "distro sles-11sp3-x86_64 is updated" - fi - fi - - sles_11sp3_found_profile=0 - profile=$(cobbler profile find --name=sles-11sp3-x86_64) - if [ "$profile" == "sles-11sp3-x86_64" ]; then - sles_11sp3_found_profile=1 - fi - - if [ "$sles_11sp3_found_profile" == "0" ]; then - sudo cobbler profile add --name=sles-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" - if [[ "$?" != "0" ]]; then - echo "failed to add profile sles-11sp3-x86_64" - exit 1 - else - echo "profile sles-11sp3-x86_64 is added" - fi - else - echo "profile sles-11sp3-x86_64 has already existed." - sudo cobbler profile edit --name=sles-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" - if [[ "$?" != "0" ]]; then - echo "failed to edit profile sles-11sp3-x86_64" - exit 1 - else - echo "profile sles-11sp3-x86_64 is updated" - fi - fi -fi - -sudo cobbler reposync -if [[ "$?" != "0" ]]; then - echo "cobbler reposync failed" - exit 1 -else - echo "cobbler repos are synced" fi sudo cobbler sync if [[ "$?" != "0" ]]; then echo "cobbler sync failed" exit 1 -else - echo "cobbler are synced" fi echo "Checking cobbler is OK" @@ -820,8 +322,6 @@ sudo cobbler check if [[ "$?" != "0" ]]; then echo "cobbler check failed" exit 1 -else - echo "cobbler check passed" fi echo "Cobbler configuration complete!" diff --git a/install/compass.sh b/install/compass.sh index dbb92c0e..895df3a9 100755 --- a/install/compass.sh +++ b/install/compass.sh @@ -39,30 +39,14 @@ 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 +if [[ $SUPPORT_CENTOS_7_2 != "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 +if [[ $SUPPORT_UBUNTU_14_04_03 != "y" ]]; then sudo rm -f /etc/compass/os/ubuntu14.04.conf fi -if [[ $SUPPORT_SLES_11SP3 != "y" ]]; then - sudo rm -f /etc/compass/os/sles11sp3.conf -fi - # add apache user to the group of virtualenv user sudo usermod -a -G `groups $USER|awk '{print$3}'` apache diff --git a/install/compass_web.sh b/install/compass_web.sh index cf7aacc9..00227ec0 100755 --- a/install/compass_web.sh +++ b/install/compass_web.sh @@ -22,36 +22,6 @@ rm -rf /var/www/compass_web/* sudo mkdir -p /var/www/compass_web/v2.5 sudo cp -rf $WEB_HOME/v2.5/target/* /var/www/compass_web/v2.5/ -if [[ $LOCAL_REPO = "y" ]]; then - echo "setting up local repo" - 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.tar.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.tar.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.tar.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 - if [[ $SUPPORT_SLES_11SP3 = "y" ]]; then - 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 $? - fi -fi - sudo systemctl restart httpd.service sleep 10 diff --git a/install/install.conf b/install/install.conf index d939c872..61c804b3 100755 --- a/install/install.conf +++ b/install/install.conf @@ -40,12 +40,8 @@ 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 SUPPORT_SLES_11SP3=${SUPPORT_SLES_11SP3:-} +export SUPPORT_CENTOS_7_2=${SUPPORT_CENTOS_7_2:-} +export SUPPORT_UBUNTU_14_04_03=${SUPPORT_UBUNTU_14_04_03:-} export IMAGE_TYPE=${IMAGE_TYPE:-"CentOS"} export IMAGE_TYPE_OTHER=${IMAGE_TYPE_OTHER:-"el"} @@ -55,32 +51,10 @@ 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_6_5_IMAGE_SOURCE=${CENTOS_6_5_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/centos/6.5/CentOS-6.5-x86_64.iso"} -export CENTOS_6_5_IMAGE_SOURCE_ASIA=${CENTOS_6_5_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/centos/6.5/CentOS-6.5-x86_64.iso"} -export CENTOS_6_6_IMAGE_SOURCE=${CENTOS_6_6_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/centos/6.6/CentOS-6.6-x86_64.iso"} -export CENTOS_6_6_IMAGE_SOURCE_ASIA=${CENTOS_6_6_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/centos/6.6/CentOS-6.6-x86_64.iso"} -export CENTOS_7_0_IMAGE_SOURCE=${CENTOS_7_0_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/centos/7.0/CentOS-7.0-x86_64.iso"} -export CENTOS_7_0_IMAGE_SOURCE_ASIA=${CENTOS_7_0_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/centos/7.0/CentOS-7.0-x86_64.iso"} -export UBUNTU_12_04_IMAGE_SOURCE=${UBUNTU_12_04_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/ubuntu/12.04/Ubuntu-12.04-x86_64.iso"} -export UBUNTU_12_04_IMAGE_SOURCE_ASIA=${UBUNTU_12_04_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/ubuntu/12.04/Ubuntu-12.04-x86_64.iso"} -export UBUNTU_14_04_IMAGE_SOURCE=${UBUNTU_14_04_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/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_ASIA=${SLES_11SP3_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/sles/11sp3/sles-11sp3-x86_64.iso"} - -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_6_PPA_REPO_SOURCE=${CENTOS_6_6_PPA_REPO_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/centos/6.6/centos_6_6_ppa_rep.tar.gz"} -export CENTOS_6_6_PPA_REPO_SOURCE_ASIA=${CENTOS_6_6_PPA_REPO_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/centos/6.6/centos_6_6_ppa_rep.tar.gz"} -export CENTOS_7_0_PPA_REPO_SOURCE=${CENTOS_7_0_PPA_REPO_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/centos/7.0/centos_7_0_ppa_rep.tar.gz"} -export CENTOS_7_0_PPA_REPO_SOURCE_ASIA=${CENTOS_7_0_PPA_REPO_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/centos/7.0/centos_7_0_ppa_rep.tar.gz"} -export UBUNTU_12_04_PPA_REPO_SOURCE=${UBUNTU_12_04_PPA_REPO_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/ubuntu/12.04/ubuntu_12_04_ppa_repo.tar.gz"} -export UBUNTU_12_04_PPA_REPO_SOURCE_ASIA=${UBUNTU_12_04_PPA_REPO_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/ubuntu/12.04/ubuntu_12_04_ppa_repo.tar.gz"} -export UBUNTU_14_04_PPA_REPO_SOURCE=${UBUNTU_14_04_PPA_REPO_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/ubuntu/14.04/ubuntu_14_04_ppa_repo.tar.gz"} -export UBUNTU_14_04_PPA_REPO_SOURCE_ASIA=${UBUNTU_14_04_PPA_REPO_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/ubuntu/14.04/ubuntu_14_04_ppa_repo.tar.gz"} -export SLES_11SP3_PPA_REPO_SOURCE=${SLES_11SP3_PPA_REPO_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/sles/11sp3/sles_11sp3_ppa_repo.tar.gz"} -export SLES_11SP3_PPA_REPO_SOURCE_ASIA=${SLES_11SP3_PPA_REPO_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/sles/11sp3/sles_11sp3_ppa_repo.tar.gz"} +export CENTOS_7_2_IMAGE_SOURCE=${CENTOS_7_2_IMAGE_SOURCE:-"http://205.177.226.235:9999/CentOS-7-x86_64-Minimal-1511.iso"} +export UBUNTU_14_04_03_IMAGE_SOURCE=${UBUNTU_14_04_03_IMAGE_SOURCE:-"http://205.177.226.235:9999/ubuntu-14.04.3-server-amd64.iso"} +export CENTOS_7_2_PPA_REPO_SOURCE=${CENTOS_7_2_PPA_REPO_SOURCE:-"http://205.177.226.235:9999/centos7-juno-ppa.tar.gz"} +export UBUNTU_14_04_03_PPA_REPO_SOURCE=${UBUNTU_14_04_03_PPA_REPO_SOURCE:-"http://205.177.226.235:9999/trusty-liberty-ppa.tar.gz"} export COBBLER_PASSWORD=${COBBLER_PASSWORD:-"cobbler"} diff --git a/install/install.conf.template b/install/install.conf.template index 66c760f6..4d4df8f5 100755 --- a/install/install.conf.template +++ b/install/install.conf.template @@ -20,12 +20,8 @@ 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:-"y"} -export SUPPORT_CENTOS_7_0=${SUPPORT_CENTOS_7_0:-"y"} -export SUPPORT_UBUNTU_12_04=${SUPPORT_UBUNTU_12_04:-"y"} -export SUPPORT_UBUNTU_14_04=${SUPPORT_UBUNTU_14_04:-"y"} -export SUPPORT_SLES_11SP3=${SUPPORT_SLES_11SP3:-"n"} +export SUPPORT_CENTOS_7_2=${SUPPORT_CENTOS_7_2:-"y"} +export SUPPORT_UBUNTU_14_04_03=${SUPPORT_UBUNTU_14_04_03:-"y"} # DHCP config # export IPADDR=`ifconfig $NIC | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` diff --git a/install/install.sh b/install/install.sh index b96b066f..6fc8fe60 100755 --- a/install/install.sh +++ b/install/install.sh @@ -242,90 +242,6 @@ if [ $? -ne 0 ]; then exit 1 fi -if [[ -z $LOCAL_REPO ]]; then - echo -e "\x1b[32mWould you like to set up a local repository?(y/n)\x1b[37m" - while true; do - read ans - case $ans in - y ) export LOCAL_REPO="y"; break;; - n ) export LOCAL_REPO="n"; break;; - * ) echo "I don't understand this";; - 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 - -if [[ -z $SUPPORT_SLES_11SP3 ]]; then - echo -e "\x1b[32mWould you like to support sles11sp3?(y/n)\x1b[37m" - while true; do - read ans - case $ans in - y ) export SUPPORT_SLES_11SP3="y"; break;; - n ) export SUPPORT_SLES_11SP3="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/openstack/compass-web' diff --git a/install/install_func.sh b/install/install_func.sh index defd8fef..9f011fe6 100755 --- a/install/install_func.sh +++ b/install/install_func.sh @@ -161,7 +161,7 @@ download() action=${1:-""} downloaded=0 if [[ "$force" == "0" || "$force" == "false" ]]; then - if [[ -f /tmp/${package} || -L /tmp/${package} ]]; then + if [[ -f /opt/${package} || -L /opt/${package} ]]; then echo "$package already exists" downloaded=1 fi @@ -178,28 +178,28 @@ download() fi fi if [[ "$url" =~ (http|https|ftp):// ]]; then - echo "download $url to /tmp/${package}" - if [[ -f /tmp/${package} || -L /tmp/${package} ]]; then - curl -f -L -z /tmp/${package} -o /tmp/${package}.tmp $url + echo "download $url to /opt/${package}" + if [[ -f /opt/${package} || -L /opt/${package} ]]; then + curl -f -L -z /opt/${package} -o /opt/${package}.opt $url else - curl -f -L -o /tmp/${package}.tmp $url + curl -f -L -o /opt/${package}.opt $url fi if [[ "$?" != "0" ]]; then echo "failed to download $package" exit 1 else echo "successfully download $package" - if [[ -f /tmp/${package}.tmp || -L /tmp/${package}.tmp ]]; then - mv -f /tmp/${package}.tmp /tmp/${package} + if [[ -f /opt/${package}.opt || -L /opt/${package}.opt ]]; then + mv -f /opt/${package}.opt /opt/${package} fi fi else - echo "copy $url to /tmp/${package}" - cp -rf $url /tmp/${package} + echo "copy $url to /opt/${package}" + cp -rf $url /opt/${package} fi fi - if [[ ! -f /tmp/${package} && ! -L /tmp/${package} ]]; then - echo "/tmp/$package is not created" + if [[ ! -f /opt/${package} && ! -L /opt/${package} ]]; then + echo "/opt/$package is not created" exit 1 fi if [[ -z "$action" ]]; then @@ -209,8 +209,8 @@ download() echo "execute $action after downloading $package" fi if [[ "$action" == "install" ]]; then - echo "install /tmp/$package" - sudo rpm -Uvh /tmp/$package + echo "install /opt/$package" + sudo rpm -Uvh /opt/$package if [[ "$?" != "0" ]]; then echo "failed to install $package" exit 1 @@ -219,8 +219,8 @@ download() fi elif [[ "$action" == "copy" ]]; then destdir=$2 - echo "copy /tmp/$package to $destdir" - sudo cp -rn /tmp/$package $destdir + echo "copy /opt/$package to $destdir" + sudo cp -rn /opt/$package $destdir if [[ "$?" != "0" ]]; then echo "failed to copy $package to $destdir" exit 1 @@ -229,8 +229,8 @@ download() fi elif [[ "$action" == "unzip" ]]; then destdir=$2 - echo "unzip /tmp/$package to $destdir" - sudo tar -C $destdir -xzvf /tmp/$package + echo "unzip /opt/$package to $destdir" + sudo tar -C $destdir -xzvf /opt/$package if [[ "$?" != "0" ]]; then echo "failed to unzip $package to $destdir" exit 1 diff --git a/install/prepare.sh b/install/prepare.sh index 1c52afbb..613bcbf3 100755 --- a/install/prepare.sh +++ b/install/prepare.sh @@ -249,28 +249,12 @@ fi # download cobbler related packages -if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then - download -u $CENTOS_6_5_PPA_REPO_SOURCE -u $CENTOS_6_5_PPA_REPO_SOURCE_ASIA || exit $? +if [[ $SUPPORT_CENTOS_7_2 == "y" ]]; then + download -u $CENTOS_7_2_PPA_REPO_SOURCE || exit $? fi -if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then - download -u $CENTOS_6_6_PPA_REPO_SOURCE -u $CENTOS_6_6_PPA_REPO_SOURCE_ASIA|| exit $? -fi - -if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then - download -u $CENTOS_7_0_PPA_REPO_SOURCE -u $CENTOS_7_0_PPA_REPO_SOURCE_ASIA || exit $? -fi - -if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then - download -u $UBUNTU_12_04_PPA_REPO_SOURCE -u $UBUNTU_12_04_PPA_REPO_SOURCE_ASIA || exit $? -fi - -if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then - download -u $UBUNTU_14_04_PPA_REPO_SOURCE -u $UBUNTU_14_04_PPA_REPO_SOURCE_ASIA || exit $? -fi - -if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then - download -u $SLES_11SP3_PPA_REPO_SOURCE -u $SLES_11SP3_PPA_REPO_SOURCE_ASIA || exit $? +if [[ $SUPPORT_UBUNTU_14_04_03 == "y" ]]; then + download -u $UBUNTU_14_04_03_PPA_REPO_SOURCE || exit $? fi # download chef related packages @@ -278,66 +262,12 @@ fi # download -u "$CHEF_CLIENT" -u "$CHEF_CLIENT_HUAWEI" || exit $? # download os images -if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then - echo "download centos6.5 image" - download -u "$CENTOS_6_5_IMAGE_SOURCE" -u "$CENTOS_6_5_IMAGE_SOURCE_ASIA" CentOS-6.5-x86_64.iso || exit $? +if [[ $SUPPORT_CENTOS_7_2 == "y" ]]; then + download -u "$CENTOS_7_2_IMAGE_SOURCE" || exit $? fi -if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then - echo "download centos6.6 image" - 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 - echo "download centos7.0 image" - download -u "$CENTOS_7_0_IMAGE_SOURCE" -u "$CENTOS_7_0_IMAGE_SOURCE_ASIA" CentOS-7.0-x86_64.iso || exit $? -fi - -if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then - echo "download ubuntu12.04 image" - 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 - echo "download ubuntu14.04 image" - download -u "$UBUNTU_14_04_IMAGE_SOURCE" -u "$UBUNTU_14_04_IMAGE_SOURCE_ASIA" Ubuntu-14.04-x86_64.iso || exit $? -fi - -if [[ $SUPPORT_SLES_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 $? -fi - -# download local repo -if [[ $LOCAL_REPO == "y" ]]; then - echo "download gem local repo" - download -u "${LOCAL_REPO_US}/gem_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/gem_repo.tar.gz" || exit $? - echo "download openstack os image local repo" - 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 - echo "download centos6.5 local repo" - download -u "${LOCAL_REPO_US}/centos/6.5/centos_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/centos/6.5/centos_repo.tar.gz" CentOS-6.5-x86_64.tar.gz || exit $? - fi - if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then - echo "download centos6.6 local repo" - download -u "${LOCAL_REPO_US}/centos/6.6/centos_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/centos/6.6/centos_repo.tar.gz" CentOS-6.6-x86_64.tar.gz || exit $? - fi - if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then - echo "download centos7.0 local repo" - download -u "${LOCAL_REPO_US}/centos/7.0/centos_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/centos/7.0/centos_repo.tar.gz" CentOS-7.0-x86_64.tar.gz || exit $? - fi - if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then - echo "download ubuntu12.04 local repo" - 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 - echo "download ubuntu14.04 local repo" - 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 - if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then - 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 $? - fi +if [[ $SUPPORT_UBUNTU_14_04_03 == "y" ]]; then + download -u "$UBUNTU_14_04_03_IMAGE_SOURCE" || exit $? fi # Install net-snmp diff --git a/install/setup_env.sh b/install/setup_env.sh index 673441d6..5ff48c52 100755 --- a/install/setup_env.sh +++ b/install/setup_env.sh @@ -11,11 +11,7 @@ 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} -SUPPORT_SLES_11SP3=\${SUPPORT_SLES_11SP3:-$SUPPORT_SLES_11SP3} +SUPPORT_CENTOS_7_2=\${SUPPORT_CENTOS_7_2:-$SUPPORT_CENTOS_7_2} +SUPPORT_UBUNTU_14_04_03=\${SUPPORT_UBUNTU_14_04_03:-$SUPPORT_UBUNTU_14_04_03} EOF chmod ugo+x $SCRIPT_DIR/env.conf