#! /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