免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5196 | 回复: 2
打印 上一主题 下一主题

[其他] 如何通过脚本实现icc自动安装 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-09-04 14:03 |显示全部楼层 |倒序浏览
在测试中经常会出现需要首先安装编译环境,比如icc、mpi等,安装过程中会出现一些交互选项,我如何使用脚本一下实现所有的默认安装呢。
举例子如图,在执行mpi的安装过程中,解压后执行install.sh 之后开始mpi安装,它有几步,包含同意协议、选择安装路径等,我不想通过交互模式一步一步的走下去,我希望通过脚本在这一步默认选择1,如何实现?

安装.PNG (10.36 KB, 下载次数: 24)

安装过程图片

安装过程图片

论坛徽章:
0
2 [报告]
发表于 2013-09-04 14:28 |显示全部楼层
谢谢,修改install.sh 就不尝试了,这只是我用来举例的一个工具,实际可能会比较复杂,全部修改脚本,可能就需要动人家所有的安装步骤,还是用expect命令来尝试一下。

论坛徽章:
0
3 [报告]
发表于 2013-09-05 13:51 |显示全部楼层
我做了尝试,我用写了个脚本mpiinstall.sh 来执行mpi的安装,uninter.sh 用来传递mpi安装过程中的install.sh 下的交互命令参数。提示是
spawn :command not found
couldn‘t  read file “Press  Enter Key to continute or q to quit :”  :no such file or directory
send :command not found
couldn’t read file “eof” :no such file or directory

我写的mpiinstall.sh 和uninter.sh 都在/tmp/test目录下,其中mpiinstall.sh 脚本如下:
#!/bin/sh
cd /tmp/test
tar zxvf l_mpi-rt_p_4.0.2.003.tgz &
wait
cd l_mpi-rt_p_4.0.2.003
sh /tmp/test/uninter.sh

其中uninter.sh 的脚本内容如下:


#!/usr/bin/expect
set timeout 50
spawn sh /tmp/test/l_mpi-rt_p_4.0.2.003/install.sh
expect " Press "Enter" key to continute or "q" to quit:"
send "q"
expect eof
exit
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP