#!/bin/bash
# centos 安装 vscode 配置 gcc g++ cmake 开发环境
vscodeUrl="http://work.eisc.cn/ruanjian/ubuntu/server/"
dir="/datadisk/eisc/download/cmake"
installDir="/datadisk/eisc/server"
debList=(
cmake-3.27.0-rc3.tar.gz
make-4.4.tar.gz
gcc-12.3.0.tar.gz
)
downloadGF=(
https://ftp.gnu.org/gnu/gcc/gcc-12.3.0/gcc-12.3.0.tar.gz
https://ftp.gnu.org/gnu/make/make-4.4.tar.gz
)
debrun=(
cmake3
make4
gcc12
)
if [ $USER="root" ]
then
qx=" "
else
qx="sudo"
fi
xitong=` cat /etc/os-release | grep -w ID | awk -F"=" '{print $2}' | sed "s/\"//g" `
case "$xitong" in
"centos" ) iCMD="yum" ; rpmCMD="rpm -qa " ; echo "当前是 centos 系统" ;;
"ubuntu" ) iCMD="apt" ; rpmCMD="dpkg -l " ; echo "当前是 ubuntu 系统" ;;
esac
{
mathJaxContainer[0]}iCMD install -y openssl-devel gcc gcc-c++ g++ cmake make wget
{
mathJaxContainer[1]}dir {
mathJaxContainer[2]}qx chmod 777 {
mathJaxContainer[3]}installDir; cd $dir
download()
{
for i in ${
debList[*]}
do
debname=`echo $i | awk -F".tar.gz" '{print $1}'`
debnameInstalled=`$qx $rpmCMD | grep -w "ii $debname"`
debnameInstalledLength=${
#debnameInstalled}
{
mathJaxContainer[6]}installDir/$debname
if [ $debnameInstalledLength -gt 1 ]
then
echo "[ok] 该包 $i 已经安装,安装信息: $debnameInstalled"
installIF=0
else
installIF=1
echo "[runing] 正在检查是否下载安装包: $i"
if [ ! -e $i ]
then
echo "[runing] 当前没有下载,正在下载包:$i"
{
mathJaxContainer[8]}vscodeUrl/$i
echo "[running] 正在解压 $i 到目录: $installDir/$debname "
{
mathJaxContainer[10]}i -C $installDir
else
echo "[ok] 已经下载: $i "
fi
fi
done
}
debinstall(){
for((i=0;i<=${
#debrun[*]};i++))
do
if [ ! -e /bin/{
mathJaxContainer[11]}i]} ]
then
debname=`echo ${debList[$i]} | awk -F".tar.gz" '{print $1}'`
echo "[waring] 包没有安装 ${debList[$i]} 正在安装 文件不存在: /bin/${debrun[$i]} " ; ls /bin/{
mathJaxContainer[15]}i]} ; sleep 3;
cd {
mathJaxContainer[16]}debname ; {
mathJaxContainer[17]}qx make install ; {
mathJaxContainer[18]}{
debrun[$i]}
{
mathJaxContainer[19]}installDir/{
mathJaxContainer[20]}{
debrun[{
mathJaxContainer[21]}{
debrun[$i]}
else
echo "已经安装: ${debrun[$i]}"
fi
done
}
download ; debinstall