Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1093401
  • 博文数量: 120
  • 博客积分: 887
  • 博客等级: 准尉
  • 技术积分: 1883
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-05 21:10
个人简介

RHCE,CCNA,熟悉shell脚本

文章分类

全部博文(120)

文章存档

2015年(16)

2014年(20)

2013年(48)

2012年(20)

2011年(16)

分类: Python/Ruby

2011-12-08 00:15:11

#! /bin/bash
#mv /root/cpan/mysql-mmm-* /root
pathname="/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/DBD"
cpanpath=/root/cpan
echo "/usr/local/mysql/lib/mysql/" >> /etc/ld.so.conf
ldconfig
file1="DBD-mysql-4.020.tar.gz"
file2="perl-DBI-1.52-2.el5.i386.rpm"
ls $cpanpath > /root/file
while read i
do
        file3=$(rpm -qa perl-DBI |awk -F "1" '{print $1}')
        if [ "$file3" != "perl-DBI-" ]
        then
                rpm -ivh $cpanpath/$i
                sleep 2
#                mv /root/cpan/perl-DBI* /root
        else
                if [ -d $pathname ]
                then
                        tar xf $cpanpath/$i -C /tmp && cd /tmp/$(echo $i |awk -F ".tar" '{print $1}')

                        perl Makefile.PL && make test && make install
                        mv $cpanpath/$i /root
                else
                        if [ "$i" = "$file1" ]
                        then
                                tar xf $cpanpath/$i -C /tmp && cd /tmp/$(echo $i |awk -F ".tar" '{print $1}')
                                perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql && make test && make install  && mv $cpanpath/$i /root
                                continue
                        fi
                fi
        fi

done < /root/file

for j in `ls /root/cpan`
do
         tar xf $cpanpath/$j -C /tmp && cd /tmp/$(echo $j |awk -F ".tar" '{print $1}')
         perl Makefile.PL && make test && make install
         mv $cpanpath/$j /root
done

tar xf /root/mysql-mmm* -C /tmp && cd /tmp/mysql-mmm* && make install
rm -rf /root/file


阅读(2771) | 评论(1) | 转发(1) |
给主人留下些什么吧!~~

泥亚鳅2011-12-09 00:58:25

感谢分享!学习了!