diff --git a/conf/templates/cobbler/CentOS-6.6-x86_64/system.tmpl b/conf/templates/cobbler/CentOS-6.6-x86_64/system.tmpl new file mode 100644 index 00000000..3db5e350 --- /dev/null +++ b/conf/templates/cobbler/CentOS-6.6-x86_64/system.tmpl @@ -0,0 +1,65 @@ +{ + "name": "$hostname", + "hostname": "$hostname", + "profile": "$profile", + "gateway": "$gateway", + #import simplejson as json + #set nameservers = json.dumps($nameservers, encoding='utf-8') + "name_servers": $nameservers, + #set search_path = ' '.join($search_path) + "name_servers_search": "$search_path", + "proxy": "$getVar('http_proxy', '')", + "modify_interface": + #set networks = $networks + #set rekeyed = {} + #set promic_nic = "" + #for $nic, $val in $networks.iteritems(): + #set ip_key = '-'.join(('ipaddress', $nic)) + #set netmask_key = '-'.join(('netmask', $nic)) + #set mgmt_key = '-'.join(('management', $nic)) + #set static_key = '-'.join(('static', $nic)) + #set $rekeyed[$ip_key] = $val.ip + #set $rekeyed[$netmask_key] = $val.netmask + #set $rekeyed[$mgmt_key] = $val.is_mgmt + #set $rekeyed[$static_key] = True + + #if $val.is_promiscuous: + #set promic_nic = $nic + #end if + #if $val.is_mgmt: + #set mac_key = '-'.join(('macaddress', $nic)) + #set dns_key = '-'.join(('dnsname', $nic)) + #set $rekeyed[$mac_key] = $mac + #set $rekeyed[$dns_key] = $dns + #end if + #end for + #set nic_info = json.dumps($rekeyed, encoding='utf-8') + $nic_info + , + "ksmeta":{ + #set partition_config = '' + #for k, v in $partition.iteritems(): + #set path = '' + #if v['vol_percentage']: + #set $path = k + ' ' + str(v['vol_percentage']) + '%' + #else: + #set $path = k + ' ' + str(v['vol_size']) + #end if + #set partition_config = ';'.join((partition_config, $path)) + #end for + #set partition_config = partition_config[1:] + #import crypt + #set $password = crypt.crypt($server_credentials.password, "az") + #set no_proxy = ','.join($getVar('no_proxy', [])) + "username": "$server_credentials.username", + "password": "$password", + "promisc_nics": "$promic_nic", + "partition": "$partition_config", + "https_proxy": "$getVar('https_proxy', '')", + "ntp_server": "$ntp_server", + "timezone": "$timezone", + "ignore_proxy": "$no_proxy", + "local_repo": "$getVar('local_repo', '')", + "disk_num": "1" + } +} diff --git a/conf/templates/cobbler/CentOS-7.0-x86_64/system.tmpl b/conf/templates/cobbler/CentOS-7.0-x86_64/system.tmpl new file mode 100644 index 00000000..3db5e350 --- /dev/null +++ b/conf/templates/cobbler/CentOS-7.0-x86_64/system.tmpl @@ -0,0 +1,65 @@ +{ + "name": "$hostname", + "hostname": "$hostname", + "profile": "$profile", + "gateway": "$gateway", + #import simplejson as json + #set nameservers = json.dumps($nameservers, encoding='utf-8') + "name_servers": $nameservers, + #set search_path = ' '.join($search_path) + "name_servers_search": "$search_path", + "proxy": "$getVar('http_proxy', '')", + "modify_interface": + #set networks = $networks + #set rekeyed = {} + #set promic_nic = "" + #for $nic, $val in $networks.iteritems(): + #set ip_key = '-'.join(('ipaddress', $nic)) + #set netmask_key = '-'.join(('netmask', $nic)) + #set mgmt_key = '-'.join(('management', $nic)) + #set static_key = '-'.join(('static', $nic)) + #set $rekeyed[$ip_key] = $val.ip + #set $rekeyed[$netmask_key] = $val.netmask + #set $rekeyed[$mgmt_key] = $val.is_mgmt + #set $rekeyed[$static_key] = True + + #if $val.is_promiscuous: + #set promic_nic = $nic + #end if + #if $val.is_mgmt: + #set mac_key = '-'.join(('macaddress', $nic)) + #set dns_key = '-'.join(('dnsname', $nic)) + #set $rekeyed[$mac_key] = $mac + #set $rekeyed[$dns_key] = $dns + #end if + #end for + #set nic_info = json.dumps($rekeyed, encoding='utf-8') + $nic_info + , + "ksmeta":{ + #set partition_config = '' + #for k, v in $partition.iteritems(): + #set path = '' + #if v['vol_percentage']: + #set $path = k + ' ' + str(v['vol_percentage']) + '%' + #else: + #set $path = k + ' ' + str(v['vol_size']) + #end if + #set partition_config = ';'.join((partition_config, $path)) + #end for + #set partition_config = partition_config[1:] + #import crypt + #set $password = crypt.crypt($server_credentials.password, "az") + #set no_proxy = ','.join($getVar('no_proxy', [])) + "username": "$server_credentials.username", + "password": "$password", + "promisc_nics": "$promic_nic", + "partition": "$partition_config", + "https_proxy": "$getVar('https_proxy', '')", + "ntp_server": "$ntp_server", + "timezone": "$timezone", + "ignore_proxy": "$no_proxy", + "local_repo": "$getVar('local_repo', '')", + "disk_num": "1" + } +} diff --git a/conf/templates/cobbler/Ubuntu-12.04-x86_64/system.tmpl b/conf/templates/cobbler/Ubuntu-12.04-x86_64/system.tmpl index 3db5e350..a7c12cb4 100644 --- a/conf/templates/cobbler/Ubuntu-12.04-x86_64/system.tmpl +++ b/conf/templates/cobbler/Ubuntu-12.04-x86_64/system.tmpl @@ -20,7 +20,6 @@ #set static_key = '-'.join(('static', $nic)) #set $rekeyed[$ip_key] = $val.ip #set $rekeyed[$netmask_key] = $val.netmask - #set $rekeyed[$mgmt_key] = $val.is_mgmt #set $rekeyed[$static_key] = True #if $val.is_promiscuous: diff --git a/conf/templates/cobbler/Ubuntu-14.04-x86_64/system.tmpl b/conf/templates/cobbler/Ubuntu-14.04-x86_64/system.tmpl new file mode 100644 index 00000000..a7c12cb4 --- /dev/null +++ b/conf/templates/cobbler/Ubuntu-14.04-x86_64/system.tmpl @@ -0,0 +1,64 @@ +{ + "name": "$hostname", + "hostname": "$hostname", + "profile": "$profile", + "gateway": "$gateway", + #import simplejson as json + #set nameservers = json.dumps($nameservers, encoding='utf-8') + "name_servers": $nameservers, + #set search_path = ' '.join($search_path) + "name_servers_search": "$search_path", + "proxy": "$getVar('http_proxy', '')", + "modify_interface": + #set networks = $networks + #set rekeyed = {} + #set promic_nic = "" + #for $nic, $val in $networks.iteritems(): + #set ip_key = '-'.join(('ipaddress', $nic)) + #set netmask_key = '-'.join(('netmask', $nic)) + #set mgmt_key = '-'.join(('management', $nic)) + #set static_key = '-'.join(('static', $nic)) + #set $rekeyed[$ip_key] = $val.ip + #set $rekeyed[$netmask_key] = $val.netmask + #set $rekeyed[$static_key] = True + + #if $val.is_promiscuous: + #set promic_nic = $nic + #end if + #if $val.is_mgmt: + #set mac_key = '-'.join(('macaddress', $nic)) + #set dns_key = '-'.join(('dnsname', $nic)) + #set $rekeyed[$mac_key] = $mac + #set $rekeyed[$dns_key] = $dns + #end if + #end for + #set nic_info = json.dumps($rekeyed, encoding='utf-8') + $nic_info + , + "ksmeta":{ + #set partition_config = '' + #for k, v in $partition.iteritems(): + #set path = '' + #if v['vol_percentage']: + #set $path = k + ' ' + str(v['vol_percentage']) + '%' + #else: + #set $path = k + ' ' + str(v['vol_size']) + #end if + #set partition_config = ';'.join((partition_config, $path)) + #end for + #set partition_config = partition_config[1:] + #import crypt + #set $password = crypt.crypt($server_credentials.password, "az") + #set no_proxy = ','.join($getVar('no_proxy', [])) + "username": "$server_credentials.username", + "password": "$password", + "promisc_nics": "$promic_nic", + "partition": "$partition_config", + "https_proxy": "$getVar('https_proxy', '')", + "ntp_server": "$ntp_server", + "timezone": "$timezone", + "ignore_proxy": "$no_proxy", + "local_repo": "$getVar('local_repo', '')", + "disk_num": "1" + } +} diff --git a/install/chef.sh b/install/chef.sh index 1b156b40..89773983 100755 --- a/install/chef.sh +++ b/install/chef.sh @@ -19,7 +19,7 @@ sudo mkdir -p /root/backup/chef sudo rpm -q chef-server if [[ "$?" != "0" ]]; then - download -u $CHEF_SRV -u $CHEF_SRV_HUAWEI `basename $CHEF_SRV` install || exit $? + download -u "$CHEF_SRV" -u "$CHEF_SRV_HUAWEI" `basename $CHEF_SRV` install || exit $? else echo "chef-server has already installed" fi @@ -42,7 +42,7 @@ echo "configure chef client and knife" # configure chef client and knife sudo rpm -q chef if [[ "$?" != "0" ]]; then - download -u $CHEF_CLIENT -u $CHEF_CLIENT_HUAWEI `basename $CHEF_CLIENT` install || exit $? + download -u "$CHEF_CLIENT" -u "$CHEF_CLIENT_HUAWEI" `basename $CHEF_CLIENT` install || exit $? else echo "chef client has already installed" fi diff --git a/install/cobbler.sh b/install/cobbler.sh index f466fb58..99b46c4b 100755 --- a/install/cobbler.sh +++ b/install/cobbler.sh @@ -215,10 +215,9 @@ else exit 1 fi -PPA_REPO_URL=`fastesturl http://mirror.centos.org http://mirrors.hustunique.com` +sudo mkdir -p /var/lib/cobbler/repo_mirror # create centos repo 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 @@ -240,47 +239,10 @@ if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then 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 createrepo centos_6_5_ppa_repo" - exit 1 - else - echo "centos_6_5_ppa_repo is created" - fi + download -u "$CENTOS_6_5_PPA_REPO_SOURCE" centos_6_5_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? fi 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 @@ -302,46 +264,10 @@ if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then fi # 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 - - 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" - - 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 + download "$CENTOS_6_6_PPA_REPO_SOURCE" centos_6_6_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? 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 @@ -363,54 +289,12 @@ if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then 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 + download -u "$CENTOS_7_0_PPA_REPO_SOURCE" 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 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 @@ -431,40 +315,10 @@ if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then echo "repo ubuntu_12_04_ppa_repo has already existed." fi - 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 -Codename: ppa -Version: 0.1 -Architectures: i386 amd64 source -Components: main -Description: ppa repo -EOF - 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 + download -u "$UBUNTU_12_04_PPA_REPO_SOURCE" ubuntu_12_04_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? fi 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 @@ -485,36 +339,7 @@ if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then 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 + download -u "$UBUNTU_14_04_PPA_REPO_SOURCE" ubuntu_14_04_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? fi sudo cobbler reposync @@ -528,7 +353,7 @@ 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 $? + 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 @@ -544,7 +369,7 @@ if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then 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 $? + 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 @@ -560,7 +385,7 @@ if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then 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 $? + 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 @@ -577,7 +402,7 @@ 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 $? + 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 @@ -593,7 +418,7 @@ if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then 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 $? + 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 diff --git a/install/compass_web.sh b/install/compass_web.sh index e542dbaf..a9a97d53 100755 --- a/install/compass_web.sh +++ b/install/compass_web.sh @@ -22,33 +22,33 @@ sudo cp -rf $WEB_HOME/v2 /var/www/compass_web/ if [[ $LOCAL_REPO = "y" ]]; then echo "setting up local repo" mkdir -p /tmp/repo - 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 $? + 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 $? + 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 $? + 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 $? + 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 $? + 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 $? + 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 $? + 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 diff --git a/install/install.conf b/install/install.conf index 8ba06d36..90a463b2 100755 --- a/install/install.conf +++ b/install/install.conf @@ -47,17 +47,23 @@ 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:-"http://mirror.rackspace.com/CentOS/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso"} +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://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=${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://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=${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://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=${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://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=${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://mirrors.ustc.edu.cn/ubuntu-releases/14.04/ubuntu-14.04-server-amd64.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_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_7_0_PPA_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 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 UBNUT_14_04_PPA_REPO_SOURCE=${UBNUT_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 COBBLER_PASSWORD=${COBBLER_PASSWORD:-"cobbler"} # Currently the use of Javascript MVC is set to version 3.2.4 @@ -69,17 +75,6 @@ export CHEF_SRV_HUAWEI=${CHEF_SRV_HUAWEI:-"http://huawei-repo.uubright.com/repos 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"} diff --git a/install/install_func.sh b/install/install_func.sh index be521e3d..63dfc129 100755 --- a/install/install_func.sh +++ b/install/install_func.sh @@ -138,6 +138,7 @@ download() urls=() package="" options=() + echo "download $@" while [ $# -gt 0 ]; do case "$1" in -f | --force) @@ -145,11 +146,22 @@ download() shift 1 ;; -u | --url): - urls=(${urls[@]} $2) + url=$2 + echo "url: $url" + if [ -z "$url" ]; then + echo "url param is empty: $url" + exit 1 + fi + urls=(${urls[@]} $url) shift 2 ;; -p | --package): package=$2 + echo "package: $package" + if [ -z "$package" ]; then + echo "package param is empty: $package" + exit 1 + fi shift 2 ;; -*) diff --git a/install/prepare.sh b/install/prepare.sh index 3b1b5dbb..ab7a9f21 100755 --- a/install/prepare.sh +++ b/install/prepare.sh @@ -236,164 +236,83 @@ else fi # download cobbler related packages -CENTOS_PPA_SOURCE=`fastesturl "http://mirrors.hustunique.com" "http://mirror.centos.org"` -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" - -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 +if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then + download $CENTOS_6_5_PPA_REPO_SOURCE || exit $? fi -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" - -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 +if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then + download $CENTOS_6_6_PPA_REPO_SOURCE || exit $? fi -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 +if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then + download $CENTOS_7_0_PPA_SOURCE || exit $? 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 +if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then + download $UBUNTU_12_04_PPA_REPO_SOURCE || exit $? 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 $? +if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then + download $UBNUT_14_04_PPA_REPO_SOURCE || exit $? fi # download chef related packages -download -u $CHEF_SRV -u $CHEF_SRV_HUAWEI || exit $? -download -u $CHEF_CLIENT -u $CHEF_CLIENT_HUAWEI || exit $? +download -u "$CHEF_SRV" -u "$CHEF_SRV_HUAWEI" || exit $? +download -u "$CHEF_CLIENT" -u "$CHEF_CLIENT_HUAWEI" || exit $? # download os images -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 $? +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 $? fi -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 $? +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 - 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 $? +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 - download -u $UBUNTU_12_04_IMAGE_SOURCE -u $UBUNTU_12_04_IMAGE_SOURCE_ASIA Ubuntu-12.04-x86_64.iso || exit $? +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 - download -u $UBUNTU_14_04_IMAGE_SOURCE -u $UBUNTU_14_04_IMAGE_SOURCE_ASIA Ubuntu-14.04-x86_64.iso || exit $? +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 # download local repo -if [[ $LOCAL_REPO = "y" ]]; then - 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 $? +if [[ $LOCAL_REPO == "y" ]]; then + echo "download local repo" + download -u "${LOCAL_REPO_US}/local_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/local_repo.tar.gz" || exit $? + 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.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 $? + 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.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 $? + 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.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 $? + 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 - 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 $? + 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 fi