所有问题解决方案
我们都已亲身测试

添加/删除可选择的系统模板编号及修改模板导入代码

在模板选择项中添加一个Windows 2003 PHP选择项,如下:
我需要在脚本模板选择项中,插入:echo “**3.Windows 2003 PHP**”
那么后面的模板编号都需要 +1改变
注2: 自定义的模板请打包为tar.gz格式

#<!– 显示可选择模板 –>

clear
cd /tmp/SnapDisk
echo “==========================================”
echo “–Press Enter to use the Default Address–“
(直接回车使用默认下载地址)

read -p “(Please input your download Address):” Myline
(如有自己的下载节点,可填入自定义下载地址)(使用自定义下载地址注意事项!)
echo “”
echo “Select the OS:”
echo “**1.Windows 2003**”
echo “**2.Windows XP**”
echo “**3.Windows 2003 PHP**”

(注:由于这个模板是选择这里插入的,所以下面的模板编号都需要+1)
echo “**4.Windows 2008 R2 XS6.0**—Applies to XenServer version 5.6 and 6.0”
echo “**5.Windows 2008 R2 XS6.1**—Only applies to XenServer version 6.1”
echo “**6.CentOS 5 32bit**”
echo “**7.CentOS 5 64bit**”
echo “**8.CentOS 6 32bit**”
echo “**9.CentOS 6 64bit**”
echo “**10.Debian 5 32bit**”
echo “**11.Debian 6 32bit**”
echo “**12.Debian 6 64bit**”
echo “**13.Ubuntu 10 32bit**”
echo “**14.Ubuntu 10 64bit**”
echo “**15.Ubuntu 12 32bit**—Only applies to XenServer version 6.1 or above”
echo “**16.Ubuntu 12 64bit**—Only applies to XenServer version 6.1 or above”
echo “**17

.Only run the ServerSetup**”
echo “—–please select the os you need!!—–“
read -p “(For example: 1,2,3,5):” OSnum  (输入需要的系统模板编号)
        if [ “$OSnum” = “” ]; then
                echo “input number is error”
                rm -rf /tmp/Auto.sh
                exit 1
        fi
#<!– 显示可选择模板 –>

2、(175-403行)for中的循环数字也需要跟着修改.并添加新下载导入的代码#<!– wget OS,下载 –>      

#<!– wget OS,下载 –>      
cd $tempPath
for((i=1;i<17;i++));do
#<!– “i<17″中的17=总模板数量+1,若添加新模板后.需要修改这个数字,并在下方判断中添加导入步骤 –>
echo “$OSnumtrue” |grep -q “,$i,”
if [ $? -eq 0 ]; then
        case $i in
                #<!– 当选择某个序号时,下载某个模板文件 –>

1)
                #<– 以下表示当选择操作系统编号“1”时执行的步骤 –>
                wget $wgetline/VTP_Windows_2003_XS.tar.gz
                #<!– 下载的文件名 –>
                echo “————————“
                echo “File unziped.”
                echo “Importing file, please wait…”
                echo “————————“
                if [ ! -s VTP_Windows_2003_XS.xva ]; then
                        tar -xzvf  VTP_Windows_2003_XS.tar.gz
                        #<!– 解压的文件名 –>
                fi
                xe vm-import filename=$tempPath/VTP_Windows_2003_XS.xva sr-uuid=$SRuuid
                #<!– 将模板导入到服务器中 –>
                rm -rf VTP_Windows_2003_XS.*
                #<!– 自我删除,进行下一个下载 –>
                ;;
#<!– 新增加的Windows 2003 PHP 执行步骤如下 –>
                3)
                wget $wgetline/VTP_Windows_2003_PHP_XS.tar.gz
                echo “————————“
                echo “File unziped.”
                echo “Importing file, please wait…”
                echo “————————“
                if [ ! -s VTP_Windows_2003__PHP_XS.xva ]; then
                        tar -xzvf VTP_Windows_2003__PHP_XS.tar.gz

                fi
                xe vm-import filename=$tempPath/VTP_Windows_2003_PHP_XS.xva sr-uuid=$SRuuid
                rm -rf VTP_Windows_2003_PHP_XS.*
                ;;
                esac
                fi
                done
                #<!– wget OS,下载 —

赞(0)
未经允许不得转载:无忧解决网 » 添加/删除可选择的系统模板编号及修改模板导入代码

登录

找回密码

注册