#!/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
阅读(1111) | 评论(0) | 转发(0) |