Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7266
  • 博文数量: 1
  • 博客积分: 65
  • 博客等级: 民兵
  • 技术积分: 22
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-04 20:43
个人简介

http:/scc.ustc.edu.cn

文章分类
文章存档

2007年(1)

我的朋友
最近访客

分类: LINUX

2007-09-04 20:45:42

#!/bin/sh
#Program: install-intel-compiler
# Author: HM Li
#   Date: 07-09-02
#说明:
#   1、此脚本适用于debian系统,测试版本10.0.025下不包含ide的ifort、icc、idb成功
#   2、解压缩编译器包之后到data目录下用root权限执行:脚本名 rpm包名
#   3、主要作用:
#      a、利用alien安装rpm
#      b、修改编译命令及环境设置脚本,并将原始文件备份为对应的.bak文件
#      c、设置/etc/profile,最后调用vim确认修改/etc/profile

MOD( )
{
    FILE=$INSTALLDIR/bin/$1
    cp $FILE $FILE.bak
    chmod 644 $FILE.bak
    sed -i -e "1a INSTALLDIR=$INSTALLDIR" -e 's//$INSTALLDIR/g' $FILE
}

if [ $# != "1" ]
then
    echo "Usage : install-intel-compiler "
    exit 1
elif [ $1 = "-h" ]
then
    echo "Usage : install-intel-compiler "
    exit 0
fi

if [ ! -f $1 ]; then
    echo "$1 does not exist."
    exit 2
fi

if [ ${1##*.} != "rpm" ]; then
    echo "$1 is not a rpm file"
    exit 3
fi

alien -i $1
VERSION=`echo $1 | awk -F- '{print $3}'`
for i in cc ifort idb
do
    echo $1 | grep $i >/dev/null
    if [ $? = 0 ]
    then
        if [ $i = ifort ]
        then
            COMP=fc
        else
            COMP=$i
        fi
        break
    fi
done
INSTALLDIR=/opt/intel/$COMP/$VERSION
case $COMP in
    fc)
        CMD=ifort
        MOD $CMD
        MOD ${CMD}vars.sh
        MOD ${CMD}vars.csh
        ;;
    cc)
        CMD=icpc
        MOD $CMD
        CMD=icc
        MOD $CMD
        MOD ${CMD}vars.sh
        MOD ${CMD}vars.csh
        ;;
    idb)
        CMD=idb
        MOD ${CMD}vars.sh
        MOD ${CMD}vars.csh
        ;;
esac
echo ". $INSTALLDIR/bin/${CMD}vars.sh" >>/etc/profile
vim /etc/profile
阅读(1046) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~