2015-09-14 16:52:37 +08:00
|
|
|
#! /bin/bash
|
|
|
|
#==============================================================#
|
|
|
|
# Description: Unixbench script #
|
|
|
|
# Author: Teddysun <i@teddysun.com> #
|
|
|
|
# Intro: https://teddysun.com/245.html #
|
|
|
|
#==============================================================#
|
2016-08-09 18:37:02 +09:00
|
|
|
cur_dir=/opt/unixbench
|
2015-09-14 16:52:37 +08:00
|
|
|
|
|
|
|
# Check System
|
|
|
|
[[ $EUID -ne 0 ]] && echo 'Error: This script must be run as root!' && exit 1
|
2015-09-14 17:16:24 +08:00
|
|
|
[[ -f /etc/redhat-release ]] && os='centos'
|
|
|
|
[[ ! -z "`egrep -i debian /etc/issue`" ]] && os='debian'
|
|
|
|
[[ ! -z "`egrep -i ubuntu /etc/issue`" ]] && os='ubuntu'
|
|
|
|
[[ "$os" == '' ]] && echo 'Error: Your system is not supported to run it!' && exit 1
|
2015-09-14 16:52:37 +08:00
|
|
|
|
|
|
|
# Install necessary libaries
|
|
|
|
if [ "$os" == 'centos' ]; then
|
2015-09-14 17:16:24 +08:00
|
|
|
yum -y install make automake gcc autoconf gcc-c++ time perl-Time-HiRes
|
2015-09-14 16:52:37 +08:00
|
|
|
else
|
|
|
|
apt-get -y update
|
|
|
|
apt-get -y install make automake gcc autoconf time perl
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create new soft download dir
|
2016-08-09 18:37:02 +09:00
|
|
|
mkdir -p ${cur_dir}
|
|
|
|
cd ${cur_dir}
|
2015-09-14 16:52:37 +08:00
|
|
|
|
|
|
|
# Download UnixBench5.1.3
|
|
|
|
if [ -s UnixBench5.1.3.tgz ]; then
|
|
|
|
echo "UnixBench5.1.3.tgz [found]"
|
|
|
|
else
|
|
|
|
echo "UnixBench5.1.3.tgz not found!!!download now..."
|
2016-08-09 18:37:02 +09:00
|
|
|
if ! wget -c http://dl.teddysun.com/files/UnixBench5.1.3.tgz; then
|
2015-09-14 16:52:37 +08:00
|
|
|
echo "Failed to download UnixBench5.1.3.tgz, please download it to ${cur_dir} directory manually and try again."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2016-08-09 18:37:02 +09:00
|
|
|
tar -zxvf UnixBench5.1.3.tgz && rm -f UnixBench5.1.3.tgz
|
2015-09-14 16:52:37 +08:00
|
|
|
cd UnixBench/
|
|
|
|
|
|
|
|
#Run unixbench
|
|
|
|
make
|
|
|
|
./Run
|
|
|
|
|
2016-08-09 18:37:02 +09:00
|
|
|
echo
|
|
|
|
echo
|
2015-09-14 16:52:37 +08:00
|
|
|
echo "======= Script description and score comparison completed! ======= "
|
2016-08-09 18:37:02 +09:00
|
|
|
echo
|
|
|
|
echo
|